/* =================================================================
   main.css — CEFR Learning Platform Design System
   Colegio Reggio Emilia, Envigado, Colombia
   "Un mundo por descubrir"
   ================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&display=swap');

/* -----------------------------------------------------------------
   Custom Properties
   ----------------------------------------------------------------- */
:root {
  /* Brand colors */
  --blue:         #1A5276;
  --blue-light:   #2980B9;
  --blue-dark:    #154360;
  --green:        #1E8449;
  --green-light:  #27AE60;
  --orange:       #E67E22;
  --orange-light: #F39C12;
  --orange-bg:    #FEF3E7;

  /* Surfaces */
  --bg:        #F4F6F8;
  --surface:   #FFFFFF;
  --surface-2: #F8FAFC;

  /* Text */
  --text-primary:   #1A2332;
  --text-secondary: #5D6D7E;
  --text-muted:     #99A3AD;

  /* Borders & shadows */
  --border:     #DDE2E8;
  --border-focus: #2980B9;
  --shadow-sm:  0 2px 8px rgba(26,83,118,0.08);
  --shadow-md:  0 4px 20px rgba(26,83,118,0.12);
  --shadow-lg:  0 8px 40px rgba(26,83,118,0.16);

  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  /* Transitions */
  --transition: 0.18s ease;
}

/* -----------------------------------------------------------------
   Reset & Base
   ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* -----------------------------------------------------------------
   App Header
   ----------------------------------------------------------------- */
.app-header {
  background: linear-gradient(135deg, var(--blue) 0%, #1a6b40 100%);
  color: white;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(26,83,118,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.school-name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: white;
}

.school-tagline {
  font-size: 0.72rem;
  font-weight: 400;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.04em;
  font-style: italic;
}

.header-student {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.92);
  font-weight: 500;
}

.grade-badge {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.btn-logout {
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--transition);
}
.btn-logout:hover {
  background: rgba(255,255,255,0.15);
  color: white;
  border-color: rgba(255,255,255,0.65);
}

/* -----------------------------------------------------------------
   Shared Student Navigation
   ----------------------------------------------------------------- */
.student-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.student-nav a {
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}
.student-nav a:hover {
  background: rgba(255,255,255,0.15);
  color: white;
  border-color: rgba(255,255,255,0.65);
}
.student-nav a.nav-active {
  background: rgba(255,255,255,0.2);
  color: white;
  border-color: rgba(255,255,255,0.6);
  cursor: default;
}

/* -----------------------------------------------------------------
   Roadmap Page
   ----------------------------------------------------------------- */
.roadmap-page { background: var(--bg); }

.roadmap-main {
  max-width: 940px;
  margin: 0 auto;
  padding: 36px 24px 64px;
}

/* Hero: A1 → A2 display */
.roadmap-hero {
  text-align: center;
  margin-bottom: 40px;
  padding: 36px 24px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.roadmap-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--orange));
}

.cefr-journey {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 12px;
}

.cefr-current {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--blue);
  line-height: 1;
  letter-spacing: -0.02em;
}

.cefr-arrow {
  font-size: 2rem;
  color: var(--orange);
  font-weight: 700;
  opacity: 0.85;
}

.cefr-target {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--green);
  line-height: 1;
  letter-spacing: -0.02em;
}

.term-info {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
}

/* Two-column grid */
.roadmap-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
  align-items: start;
}

@media (max-width: 768px) {
  .roadmap-grid { grid-template-columns: 1fr; }
  .roadmap-hero { padding: 28px 16px; }
  .cefr-current, .cefr-target { font-size: 2.8rem; }
  .roadmap-main { padding: 24px 16px 48px; }
}

/* Column headings */
.weeks-column h2,
.skills-column h2 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* -----------------------------------------------------------------
   Week Items
   ----------------------------------------------------------------- */
.weeks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.week-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid transparent;
  transition: all var(--transition);
  animation: slideIn 0.3s ease both;
}

.week-item:nth-child(1)  { animation-delay: 0.05s; }
.week-item:nth-child(2)  { animation-delay: 0.08s; }
.week-item:nth-child(3)  { animation-delay: 0.11s; }
.week-item:nth-child(4)  { animation-delay: 0.14s; }
.week-item:nth-child(5)  { animation-delay: 0.17s; }
.week-item:nth-child(6)  { animation-delay: 0.20s; }
.week-item:nth-child(7)  { animation-delay: 0.23s; }
.week-item:nth-child(8)  { animation-delay: 0.26s; }
.week-item:nth-child(9)  { animation-delay: 0.29s; }
.week-item:nth-child(10) { animation-delay: 0.32s; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.week-complete {
  border-left-color: var(--green);
}
.week-current {
  border-left-color: var(--orange);
  background: var(--orange-bg);
  border-color: rgba(230,126,34,0.2);
  box-shadow: var(--shadow-sm);
}
.week-skipped {
  border-left-color: #BDC3C7;
  opacity: 0.75;
}
.week-locked {
  border-left-color: #E8EAED;
  opacity: 0.55;
}
.week-locked .week-title { color: var(--text-muted); }

.week-icon { font-size: 1.15rem; flex-shrink: 0; }

.week-info { flex: 1; min-width: 0; }

.week-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.week-current .week-title { color: var(--blue-dark); }

.week-focus {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.week-action { flex-shrink: 0; }

/* -----------------------------------------------------------------
   Buttons
   ----------------------------------------------------------------- */
.btn-practice,
.btn-practice-sm {
  background: var(--orange);
  color: white;
  text-decoration: none;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-block;
  transition: all var(--transition);
  letter-spacing: 0.01em;
  box-shadow: 0 2px 8px rgba(230,126,34,0.3);
}

.btn-practice:hover,
.btn-practice-sm:hover {
  background: var(--orange-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(230,126,34,0.4);
}

.btn-practice-sm { padding: 6px 14px; font-size: 0.8rem; }

.btn-review-sm {
  color: var(--blue);
  text-decoration: none;
  border: 1px solid var(--blue);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  display: inline-block;
  transition: all var(--transition);
}
.btn-review-sm:hover {
  background: var(--blue);
  color: white;
}

.btn-catchup-sm {
  color: #92400e;
  text-decoration: none;
  border: 1px solid #d97706;
  background: #fffbeb;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  display: inline-block;
  transition: all var(--transition);
}
.btn-catchup-sm:hover {
  background: #d97706;
  color: white;
  border-color: #d97706;
}

.journey-description {
  margin: -0.25rem 0 0.75rem;
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.5;
}

.roadmap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.2rem;
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #f8f9fa;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: #6b7280;
}
.roadmap-legend span { white-space: nowrap; }

/* -----------------------------------------------------------------
   Skills Panel
   ----------------------------------------------------------------- */
.skills-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.skill-bars {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.skill-bar label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}

.skill-bar .bar {
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 4px;
}

.skill-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-light));
  border-radius: 5px;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  width: 0%;
}

.skill-level {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green);
  display: block;
}

/* -----------------------------------------------------------------
   Goal Card
   ----------------------------------------------------------------- */
.goal-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  text-align: center;
  border: 2px solid var(--orange);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.goal-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--orange), var(--orange-light));
}

.goal-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.goal-target {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 18px;
}

.goal-target strong { color: var(--green); }

/* -----------------------------------------------------------------
   Focus Area Card (AI-powered grammar focus from conversation analysis)
   ----------------------------------------------------------------- */
.focus-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 16px;
  border: 2px solid #f6ad55;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.focus-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #f6ad55, #ed8936);
}

.focus-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.focus-pattern {
  font-size: 1rem;
  font-weight: 600;
  color: #7b341e;
  margin-bottom: 6px;
  text-transform: capitalize;
}

.focus-advice {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* -----------------------------------------------------------------
   Login Page
   ----------------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--blue-dark) 0%, var(--blue) 40%, #1a6b40 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
  top: -200px; right: -200px;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(230,126,34,0.1);
  bottom: -150px; left: -100px;
}

.login-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  position: relative;
  z-index: 1;
}

.login-header {
  text-align: center;
  margin-bottom: 36px;
}

.login-school-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 4px;
}

.login-tagline {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 24px;
}

.login-title {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.2;
}

.login-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* -----------------------------------------------------------------
   Form Elements
   ----------------------------------------------------------------- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: 'Outfit', sans-serif;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(41,128,185,0.12);
}

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

/* -----------------------------------------------------------------
   Primary Button (login, submit)
   ----------------------------------------------------------------- */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-light) 100%);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.02em;
  box-shadow: 0 4px 14px rgba(26,83,118,0.35);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(26,83,118,0.45);
  background: linear-gradient(135deg, var(--blue-light) 0%, #3498DB 100%);
}

.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* -----------------------------------------------------------------
   Alert / Message boxes
   ----------------------------------------------------------------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  margin-top: 16px;
  display: none;
}
.alert-error {
  background: #FDECEA;
  color: #C0392B;
  border: 1px solid #F5C6C2;
}
.alert-success {
  background: #EAFAF1;
  color: #1E8449;
  border: 1px solid #A9DFBF;
}

/* -----------------------------------------------------------------
   Chat Page
   ----------------------------------------------------------------- */
.chat-page { background: var(--bg); }

/* Chat header (for Task 15 override) */
.chat-header-bar {
  background: linear-gradient(135deg, var(--blue) 0%, #1a6b40 100%);
  color: white;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 12px rgba(26,83,118,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.btn-back-journey {
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-back-journey:hover {
  background: rgba(255,255,255,0.15);
  color: white;
  border-color: rgba(255,255,255,0.65);
}

/* -----------------------------------------------------------------
   Teacher Dashboard additions
   ----------------------------------------------------------------- */
.cefr-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.cefr-A1 { background: #EBF5FB; color: #1A5276; }
.cefr-A2 { background: #EAF7F2; color: #1E8449; }
.cefr-B1 { background: #FEF9E7; color: #D68910; }
.cefr-B2 { background: #FDF2E9; color: #D35400; }
.cefr-C1, .cefr-C2 { background: #F5EEF8; color: #6C3483; }

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--blue-light);
  background: rgba(41,128,185,0.04);
}
.upload-zone-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.upload-result {
  margin-top: 16px;
  font-size: 0.88rem;
  font-weight: 500;
}
.upload-result.success { color: var(--green); }
.upload-result.error   { color: #C0392B; }

/* -----------------------------------------------------------------
   Loading & Error states
   ----------------------------------------------------------------- */
.loading {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.loading::after {
  content: '';
  display: block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 16px auto 0;
}

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

.error {
  padding: 24px;
  text-align: center;
  color: #C0392B;
  font-size: 0.9rem;
  background: #FDECEA;
  border-radius: var(--radius-md);
  border: 1px solid #F5C6C2;
}

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