/* Data Entry Styling
 * Touch-optimized trial recording interface
 */

/* Trial buttons must be 140px minimum with clear visual feedback */
.trial-button {
  min-height: 140px;
  min-width: 140px;
  font-size: 3rem;
  border-radius: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s, background-color 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.trial-button:active {
  transform: scale(0.95);
}

.trial-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.trial-button:disabled:active {
  transform: none;
}

/* Trial display grid */
.trial-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

/* New trial indicator styles - circles with checkmarks/X */
.trial-indicator-new {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.trial-indicator-new:not(.empty) {
  cursor: pointer;
}

.trial-indicator-new:hover:not(.empty) {
  transform: scale(1.1);
}

/* Pencil edit affordance on hover */
.trial-indicator-new:not(.empty):hover::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z'/%3E%3C/svg%3E") no-repeat center / 10px;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.dark .trial-indicator-new:not(.empty):hover::after {
  background-color: #44403c;
}

.trial-indicator-new:active:not(.empty) {
  transform: scale(0.95);
}

.trial-indicator-new.correct {
  background-color: #dcfce7; /* green-100 */
  color: #16a34a; /* green-600 */
  box-shadow: 0 0 0 2px #bbf7d0; /* green-200 */
}

.trial-indicator-new.incorrect {
  background-color: #fee2e2; /* red-100 */
  color: #dc2626; /* red-600 */
  box-shadow: 0 0 0 2px #fecaca; /* red-200 */
}

.trial-indicator-new.empty {
  background-color: #f5f5f4; /* stone-100 */
  border: 2px dashed #d6d3d1; /* stone-300 */
  cursor: default;
}

/* Dark mode variants for new trial indicators */
.dark .trial-indicator-new.correct {
  background-color: #14532d; /* green-900 */
  color: #86efac; /* green-300 */
  box-shadow: 0 0 0 2px #166534; /* green-800 */
}

.dark .trial-indicator-new.incorrect {
  background-color: #7f1d1d; /* red-900 */
  color: #fca5a5; /* red-300 */
  box-shadow: 0 0 0 2px #991b1b; /* red-800 */
}

.dark .trial-indicator-new.empty {
  background-color: #292524; /* warm-800 */
  border-color: #44403c; /* warm-700 */
}

/* Trial indicator with prompt override badge */
.trial-indicator-override {
  position: relative;
}

.trial-prompt-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 0.5rem;
  background-color: #f59e0b; /* amber-500 */
  color: white;
  padding: 2px 4px;
  border-radius: 4px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.dark .trial-prompt-badge {
  background-color: #d97706; /* amber-600 */
}

/* Prompt picker dropdown */
.trial-prompt-picker {
  min-width: 180px;
  animation: slideUp 0.15s ease-out;
}

/* Current prompt indicator styling */
.trial-prompt-indicator {
  transition: background-color 0.2s, color 0.2s;
}

/* Undo button countdown styling */
.undo-button .undo-countdown,
.action-btn .undo-countdown {
  opacity: 0.7;
}

.undo-button:disabled .undo-countdown,
.action-btn:disabled .undo-countdown {
  display: none;
}

/* Warm button shadows */
.trial-button.correct {
  box-shadow: 0 10px 15px -3px rgba(34, 197, 94, 0.2);
}

.trial-button.incorrect {
  box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.2);
}

/* Review card animation */
.review-card:not(.hidden) {
  animation: slideUp 0.3s ease-out;
}

/* Session complete toast styles */
.session-complete-toast {
  animation: toastSlideUp 0.3s ease-out forwards;
}

.session-complete-toast.translate-y-full {
  animation: none;
}

@keyframes toastSlideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 100%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Prompt guide panel styles */
.prompt-guide-panel {
  will-change: transform;
}

/* Mobile bottom sheet behavior */
@media (max-width: 639px) {
  .prompt-guide-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 85vh;
    border-radius: 1.5rem 1.5rem 0 0;
    transform: translateY(100%);
  }

  .prompt-guide-panel:not(.translate-x-full) {
    transform: translateY(0);
  }
}

/* Desktop side panel behavior */
@media (min-width: 640px) {
  .prompt-guide-panel {
    transform: translateX(100%);
  }

  .prompt-guide-panel:not(.translate-x-full) {
    transform: translateX(0);
  }
}

/* Prompt selector dropdown */
.prompt-selector .prompt-dropdown {
  animation: dropdownSlideDown 0.15s ease-out;
}

@keyframes dropdownSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Keyboard hint styling */
.kbd-key {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  margin: 0 0.25rem;
  background-color: #fff;
  border: 1px solid #d6d3d1;
  border-radius: 0.25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.625rem;
  font-weight: 500;
  line-height: 1.5;
}

.dark .kbd-key {
  background-color: #44403c;
  border-color: #57534e;
  color: #e7e5e4;
}

/* Session complete modal animations (legacy) */
.session-complete-modal .completion-content {
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Help modal styling */
.help-modal-content {
  animation: slideUp 0.2s ease-out;
}

/* Touch optimization */
@media (pointer: coarse) {
  .trial-button {
    min-height: 160px;
    min-width: 160px;
  }

  .trial-indicator,
  .trial-indicator-new {
    width: 44px;
    height: 44px;
  }

  .action-btn {
    padding: 0.75rem 1rem;
  }
}

/* Landscape mode on mobile - side by side layout */
@media (max-height: 500px) and (orientation: landscape) {
  .data-entry-session main {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1rem;
  }

  .trial-display-area {
    width: 100%;
  }

  .session-stats {
    width: auto;
    border: none;
    gap: 1.5rem;
  }

  .trial-buttons {
    padding: 1rem;
  }

  .trial-button {
    min-height: 120px;
    min-width: 120px;
  }

  .action-buttons-row {
    width: 100%;
    justify-content: center;
  }

  .keyboard-hint {
    width: 100%;
  }
}

/* Prompt guide panel scrollbar styling */
.prompt-guide-body::-webkit-scrollbar {
  width: 6px;
}

.prompt-guide-body::-webkit-scrollbar-track {
  background: transparent;
}

.prompt-guide-body::-webkit-scrollbar-thumb {
  background-color: #d6d3d1;
  border-radius: 3px;
}

.dark .prompt-guide-body::-webkit-scrollbar-thumb {
  background-color: #57534e;
}
