/*
 * Ascend LMS — Core Styles
 * Tailwind CSS via CDN + Custom utilities
 */

/* =============================================================================
   TAILWIND CDN CONFIG
   ============================================================================= */
/* Note: Tailwind loaded via CDN in base.html. This file contains custom utilities */

/* =============================================================================
   CSS CUSTOM PROPERTIES
   ============================================================================= */
:root {
  /* Dark mode (default) */
  --bg-primary: #09090b;
  --bg-secondary: #18181b;
  --bg-tertiary: #27272a;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  /* Brand */
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-muted: rgba(59, 130, 246, 0.1);
  
  /* Feedback */
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --info: #0ea5e9;
  
  /* Progress */
  --progress-bg: #27272a;
  --progress-fill: #3b82f6;
  --progress-complete: #22c55e;
  
  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  
  /* Transitions */
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Light mode (future) */
.light {
  --bg-primary: #fafafa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f4f4f5;
  --text-primary: #18181b;
  --text-secondary: #71717a;
  --text-muted: #a1a1aa;
}

/* =============================================================================
   BASE STYLES
   ============================================================================= */
html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =============================================================================
   TYPOGRAPHY
   ============================================================================= */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

code, pre, .font-mono {
  font-family: var(--font-mono);
}

/* =============================================================================
   BUTTONS
   ============================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all 200ms var(--ease-out);
  cursor: pointer;
  min-height: 44px; /* Touch target */
  min-width: 44px;
}

.btn-primary {
  background-color: var(--accent);
  color: white;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid #3f3f46;
}

.btn-secondary:hover {
  background-color: #3f3f46;
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* =============================================================================
   CARDS
   ============================================================================= */
.card {
  background-color: var(--bg-secondary);
  border: 1px solid #27272a;
  border-radius: 0.75rem;
  padding: 1.5rem;
  transition: all 200ms var(--ease-out);
}

.card:hover {
  border-color: #3f3f46;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  transform: translateY(-2px);
}

/* =============================================================================
   QUIZ OPTIONS
   ============================================================================= */
.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  width: 100%;
  padding: 1rem 1.25rem;
  background-color: var(--bg-secondary);
  border: 2px solid #27272a;
  border-radius: 0.75rem;
  text-align: left;
  transition: all 200ms var(--ease-out);
  cursor: pointer;
  min-height: 44px;
}

.quiz-option:hover {
  border-color: #3f3f46;
  background-color: var(--bg-tertiary);
}

.quiz-option.selected {
  border-color: var(--accent);
  background-color: var(--accent-muted);
}

.quiz-option.correct {
  border-color: var(--success);
  background-color: rgba(34, 197, 94, 0.1);
  animation: pulse-correct 0.6s ease;
}

.quiz-option.incorrect {
  border-color: var(--error);
  background-color: rgba(239, 68, 68, 0.1);
  animation: shake 0.3s ease;
}

.option-key {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background-color: var(--bg-tertiary);
  border-radius: 0.375rem;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.quiz-option.selected .option-key {
  background-color: var(--accent);
  color: white;
}

/* =============================================================================
   PROGRESS BAR
   ============================================================================= */
.progress-bar {
  width: 100%;
  height: 0.5rem;
  background-color: var(--progress-bg);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--progress-fill);
  border-radius: 9999px;
  transition: width 300ms var(--ease-out);
}

.progress-fill.complete {
  background-color: var(--progress-complete);
}

/* =============================================================================
   TIMER
   ============================================================================= */
.timer {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  background-color: var(--bg-tertiary);
  border-radius: 0.5rem;
}

.timer.warning {
  color: var(--warning);
  background-color: rgba(245, 158, 11, 0.1);
}

.timer.danger {
  color: var(--error);
  background-color: rgba(239, 68, 68, 0.1);
  animation: pulse 1s infinite;
}

/* =============================================================================
   FORMS
   ============================================================================= */
.input {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--bg-secondary);
  border: 1px solid #27272a;
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 200ms var(--ease-out);
  min-height: 44px;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.input::placeholder {
  color: var(--text-muted);
}

.textarea {
  min-height: 8rem;
  resize: vertical;
}

.label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

/* =============================================================================
   HOOK COMPONENT
   ============================================================================= */
.hook {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  background-color: var(--bg-secondary);
}

.hook-image {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.hook-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hook-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem 1.5rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: white;
  font-weight: 500;
}

.hook-content {
  padding: 1.5rem;
}

.hook-headline {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.hook-points {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
}

.hook-points li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.hook-points li::before {
  content: "→";
  color: var(--accent);
  flex-shrink: 0;
}

.hook-meta {
  display: flex;
  gap: 1.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* =============================================================================
   ANIMATIONS
   ============================================================================= */
@keyframes pulse-correct {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =============================================================================
   HTMX LOADING
   ============================================================================= */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: flex;
}

.htmx-request.htmx-indicator {
  display: flex;
}

/* =============================================================================
   UTILITY CLASSES
   ============================================================================= */
.fade-in {
  animation: fade-in 200ms var(--ease-out);
}

.slide-up {
  animation: slide-up 300ms var(--ease-out);
}

.truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.truncate-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  padding: 1rem;
  background: var(--accent);
  color: white;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* =============================================================================
   REDUCED MOTION
   ============================================================================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */
@media (max-width: 640px) {
  html {
    font-size: 16px;
  }
  
  .card {
    padding: 1rem;
  }
  
  .btn {
    width: 100%;
  }
  
  .hook-headline {
    font-size: 1.25rem;
  }
}
