/**
 * Hint Checklist Styles - F-030.A1, F-030.A3
 *
 * Styles for the hint checklist component that shows students
 * what they need to include for full marks with real-time feedback
 *
 * Part of F-030: Enhanced Quiz System (Gate 2 - Phase 1 & 2)
 *
 * Phase 2 additions:
 * - F-030.A3: Partial match state indicators
 * - Enhanced transitions for state changes
 */

/* ==================== CONTAINER ==================== */

.hint-checklist-container {
  margin: var(--space-md, 1rem) 0;
  position: relative;
}

/* Hint content wrapper with collapsible behavior */
.quiz-hint-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 300ms ease, opacity 200ms ease;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 8px;
  padding: var(--space-md, 1rem);
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
  z-index: 100;
}

.hint-checklist-container.expanded .quiz-hint-content {
  max-height: 400px;
  opacity: 1;
}

/* Toggle Button - Matches Math Symbols exactly */
.quiz-hint-toggle {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-secondary, #9ca3af);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 150ms ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.quiz-hint-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.quiz-hint-toggle:active {
  transform: translateY(0);
}

/* Toggle icon - chevron that rotates */
.quiz-hint-toggle::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 6px solid currentColor;
  transition: transform 200ms ease;
  flex-shrink: 0;
}

.hint-checklist-container.collapsed .quiz-hint-toggle::after {
  transform: rotate(180deg);
}

.hint-checklist-container.expanded .quiz-hint-toggle::after {
  transform: rotate(0deg);
}

/* Update toggle text styling */
.quiz-hint-toggle span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hint-checklist-fallback {
  margin-top: var(--space-lg, 1.5rem);
  padding: var(--space-md, 1rem);
  background: var(--bg-secondary, #f8f9fa);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--radius-md, 0.5rem);
}

.hint-fallback-message {
  display: flex;
  align-items: center;
  gap: var(--space-sm, 0.5rem);
  color: var(--text-muted, #6b7280);
}

.hint-fallback-message svg {
  flex-shrink: 0;
  color: var(--accent, #2563EB);
}

.hint-fallback-message p {
  margin: 0;
  font-size: var(--font-sm, 0.875rem);
  line-height: 1.5;
}

/* ==================== HEADER ==================== */

.hint-checklist-header {
  margin-bottom: var(--space-md, 1rem);
  padding-bottom: var(--space-sm, 0.5rem);
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.hint-checklist-header h4 {
  margin: 0;
  font-size: var(--font-sm, 0.875rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary, #4b5563);
}

/* ==================== ITEMS ==================== */

.hint-checklist-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm, 0.5rem);
}

.hint-checklist-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm, 0.5rem);
  padding: var(--space-sm, 0.5rem) var(--space-md, 0.75rem);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  transition: all 150ms ease;
  color: var(--text-secondary, #9ca3af);
  font-size: 13px;
}

.hint-checklist-item[data-state="pending"] {
  opacity: 0.6;
}

.hint-checklist-item[data-state="partial"] {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.1);
  opacity: 1;
}

.hint-checklist-item[data-state="complete"] {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.1);
  opacity: 1;
}

.hint-checklist-item.hint-item-updating {
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ==================== ICON ==================== */

.hint-icon-container {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.hint-icon {
  position: relative;
  width: 20px;
  height: 20px;
}

/* Hide all icons by default */
.hint-icon svg {
  position: absolute;
  width: 20px;
  height: 20px;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity 150ms ease-in-out;
}

/* Show appropriate icon based on state */
.hint-checklist-item[data-state="pending"] .hint-icon-pending {
  opacity: 1;
  color: var(--text-muted, #9ca3af);
}

.hint-checklist-item[data-state="partial"] .hint-icon-partial {
  opacity: 1;
  color: var(--warning, #f59e0b);
}

.hint-checklist-item[data-state="complete"] .hint-icon-complete {
  opacity: 1;
  color: var(--success, #22c55e);
}

/* Pending icon pulse animation */
.hint-checklist-item[data-state="pending"] .hint-icon-pending circle {
  stroke-dasharray: 63;
  stroke-dashoffset: 0;
  animation: hint-pulse 2s ease-in-out infinite;
}

@keyframes hint-pulse {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.6;
  }
}

/* Partial icon rotation animation (for visual interest) */
.hint-checklist-item[data-state="partial"] .hint-icon-partial {
  animation: hint-partial-rotate 0.3s ease-out;
}

@keyframes hint-partial-rotate {
  0% {
    transform: rotate(-15deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

/* Complete checkmark animation */
.hint-checklist-item[data-state="complete"] .hint-icon-complete {
  animation: hint-check-bounce 0.4s ease-out;
}

@keyframes hint-check-bounce {
  0% {
    transform: scale(0.8);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* Checkmark path animation */
.hint-icon-complete path {
  stroke-dasharray: 15;
  stroke-dashoffset: 15;
}

.hint-checklist-item[data-state="complete"] .hint-icon-complete path {
  animation: hint-check-draw 0.3s ease-out forwards;
}

@keyframes hint-check-draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* ==================== TEXT ==================== */

.hint-text-container {
  flex: 1;
  font-size: var(--font-sm, 0.875rem);
  line-height: 1.4;
  color: var(--text-primary, #1f2937);
}

.hint-checklist-item[data-state="pending"] .hint-text-container {
  color: var(--text-muted, #6b7280);
}

/* ==================== MARKS BADGE ==================== */

.hint-item-marks {
  flex-shrink: 0;
  padding: 0.125rem 0.375rem;
  font-size: var(--font-xs, 0.75rem);
  font-weight: 600;
  background: var(--bg-tertiary, #f3f4f6);
  color: var(--text-muted, #6b7280);
  border-radius: var(--radius-sm, 0.25rem);
}

.hint-checklist-item[data-state="complete"] .hint-item-marks {
  background: var(--success, #22c55e);
  color: white;
}

.hint-checklist-item[data-state="partial"] .hint-item-marks {
  background: var(--warning, #f59e0b);
  color: white;
}

/* ==================== SCORE DISPLAY ==================== */

.hint-score-display {
  margin-top: var(--space-md, 1rem);
  padding-top: var(--space-md, 1rem);
  border-top: 1px solid var(--border, #e5e7eb);
  display: flex;
  align-items: center;
  gap: var(--space-sm, 0.5rem);
  font-size: var(--font-sm, 0.875rem);
}

.hint-score-label {
  color: var(--text-secondary, #4b5563);
  font-weight: 500;
}

.hint-score-value {
  font-weight: 700;
  color: var(--text-primary, #1f2937);
  transition: all 150ms ease;
}

.hint-score-value.hint-score-updating {
  transform: scale(1.1);
  color: var(--accent, #2563EB);
}

.hint-score-percent {
  color: var(--text-muted, #6b7280);
  font-size: var(--font-xs, 0.75rem);
}

/* Score styling based on completion */
.hint-score-display.hint-score-perfect {
  background: var(--success-bg, #d1fae5);
  padding: var(--space-sm, 0.5rem);
  margin: var(--space-md, 1rem) calc(var(--space-md, 1rem) * -1) 0;
  border-radius: var(--radius-sm, 0.375rem);
}

.hint-score-display.hint-score-perfect .hint-score-value {
  color: var(--success, #22c55e);
}

.hint-score-display.hint-score-good {
  background: var(--info-bg, #dbeafe);
  padding: var(--space-sm, 0.5rem);
  margin: var(--space-md, 1rem) calc(var(--space-md, 1rem) * -1) 0;
  border-radius: var(--radius-sm, 0.375rem);
}

.hint-score-display.hint-score-good .hint-score-value {
  color: var(--accent, #2563EB);
}

/* ==================== LIGHT MODE (body.light-mode) ==================== */

/* Toggle button */
body.light-mode .quiz-hint-toggle {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  color: #4b5563;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.light-mode .quiz-hint-toggle:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
}

body.light-mode .quiz-hint-toggle::after {
  border-bottom-color: #6b7280;
}

/* Hint content popup */
body.light-mode .quiz-hint-content {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #d1d5db;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Checklist header */
body.light-mode .hint-checklist-header {
  border-bottom-color: #e5e7eb;
}

body.light-mode .hint-checklist-header h4 {
  color: #4b5563;
}

/* Checklist items */
body.light-mode .hint-checklist-item {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  color: #374151;
}

body.light-mode .hint-checklist-item[data-state="pending"] {
  opacity: 0.7;
}

body.light-mode .hint-checklist-item[data-state="partial"] {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.4);
}

body.light-mode .hint-checklist-item[data-state="complete"] {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.4);
}

/* SVG icon colors in light mode */
body.light-mode .hint-checklist-item[data-state="pending"] .hint-icon-pending {
  color: #9ca3af;
}

body.light-mode .hint-checklist-item[data-state="partial"] .hint-icon-partial {
  color: #d97706;
}

body.light-mode .hint-checklist-item[data-state="complete"] .hint-icon-complete {
  color: #16a34a;
}

/* Text */
body.light-mode .hint-text-container {
  color: #1f2937;
}

body.light-mode .hint-checklist-item[data-state="pending"] .hint-text-container {
  color: #6b7280;
}

/* Marks badge */
body.light-mode .hint-item-marks {
  background: #e5e7eb;
  color: #6b7280;
}

body.light-mode .hint-checklist-item[data-state="complete"] .hint-item-marks {
  background: #22c55e;
  color: white;
}

body.light-mode .hint-checklist-item[data-state="partial"] .hint-item-marks {
  background: #f59e0b;
  color: white;
}

/* Score display */
body.light-mode .hint-score-label {
  color: #4b5563;
}

body.light-mode .hint-score-value {
  color: #1f2937;
}

body.light-mode .hint-score-percent {
  color: #6b7280;
}

body.light-mode .hint-score-display {
  border-top-color: #e5e7eb;
}

/* ==================== DARK MODE ==================== */

@media (prefers-color-scheme: dark) {
  .hint-checklist-container {
    background: var(--bg-secondary-dark, #1f2937);
    border-color: var(--border-dark, #374151);
  }

  .hint-checklist-item {
    background: var(--bg-card-dark, #111827);
  }

  .hint-checklist-item[data-state="partial"] {
    background: rgba(245, 158, 11, 0.15);
    border-color: var(--warning, #f59e0b);
  }

  .hint-checklist-item[data-state="complete"] {
    background: rgba(34, 197, 94, 0.15);
    border-color: var(--success, #22c55e);
  }

  .hint-text-container {
    color: var(--text-primary-dark, #f9fafb);
  }

  .hint-checklist-item[data-state="pending"] .hint-text-container {
    color: var(--text-muted-dark, #9ca3af);
  }

  .hint-score-display.hint-score-perfect {
    background: rgba(34, 197, 94, 0.2);
  }

  .hint-score-display.hint-score-good {
    background: rgba(59, 130, 246, 0.2);
  }
}

/* ==================== MOBILE RESPONSIVE ==================== */

@media (max-width: 640px) {
  .hint-checklist-container {
    padding: var(--space-sm, 0.75rem);
  }

  .hint-checklist-header h4 {
    font-size: var(--font-xs, 0.75rem);
  }

  .hint-checklist-item {
    padding: var(--space-xs, 0.375rem);
    gap: var(--space-xs, 0.375rem);
  }

  .hint-text-container {
    font-size: var(--font-xs, 0.75rem);
  }

  .hint-item-marks {
    font-size: 0.625rem;
    padding: 0.125rem 0.25rem;
  }

  .hint-score-display {
    font-size: var(--font-xs, 0.75rem);
    gap: var(--space-xs, 0.375rem);
  }
}

/* ==================== ACCESSIBILITY ==================== */

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus styles for keyboard navigation */
.hint-checklist-item:focus {
  outline: 2px solid var(--accent, #2563EB);
  outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .hint-checklist-item,
  .hint-icon-svg,
  .hint-score-value {
    transition: none;
    animation: none;
  }
}
