:root {
  --primary: #074336;
  --primary-dark: #042921;
  --primary-light: #0d5f4e;
  --primary-subtle: #e6f4f1;
  --accent: #10b981;
  --accent-warm: #f59e0b;
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);
  --sidebar-w: 260px;
  --header-h: 70px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* Lucide Icon Standard Styling */
.lucide-icon, svg.lucide {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  vertical-align: middle;
  display: inline-block;
}

.icon-sm {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.icon-md {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.icon-lg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

/* App Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px 20px 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.brand-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #074336 0%, #10b981 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar-menu {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  font-weight: 700;
  padding: 8px 12px 4px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.nav-item.active {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 600;
}

.nav-item svg.lucide {
  width: 18px;
  height: 18px;
  stroke: var(--text-muted);
  flex-shrink: 0;
}

.nav-item.active svg.lucide {
  stroke: var(--primary);
}

/* Main Area */
.app-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top Header */
.app-header {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.header-breadcrumbs svg.lucide {
  width: 13px;
  height: 13px;
  stroke: var(--text-subtle);
}

.header-breadcrumbs a:hover {
  color: var(--primary);
}

.header-breadcrumbs .current {
  color: var(--text-main);
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.badge-notification {
  background: #fef3c7;
  color: #b45309;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-notification svg.lucide {
  width: 14px;
  height: 14px;
  stroke: #b45309;
}

.btn-renew {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 30px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-renew:hover {
  background: #d1fae5;
}

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 30px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.user-info {
  line-height: 1.1;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
}

.user-role {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Page Content */
.content-body {
  padding: 32px;
  width: 100%;
  max-width: none;
}

/* Hero Banner */
.hero-banner {
  background: linear-gradient(135deg, #053329 0%, #0a4d3c 100%);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  color: white;
  margin-bottom: 36px;
  box-shadow: 0 12px 24px -8px rgba(7, 67, 54, 0.25);
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.15) 0%, rgba(255,255,255,0) 70%);
  border-radius: 50%;
}

.hero-tag {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
  color: #a7f3d0;
}

.hero-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.hero-subtitle {
  font-size: 14px;
  color: #cbd5e1;
  font-weight: 400;
}

/* Mode Selection Cards */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.mode-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  position: relative;
}

.mode-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-icon-box {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.card-icon-box svg.lucide {
  width: 20px;
  height: 20px;
  stroke: var(--primary);
}

.card-badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 6px;
}

.badge-recommended {
  background: var(--primary);
  color: white;
}

.badge-test {
  background: #e2e8f0;
  color: #334155;
}

.badge-tip {
  background: #fef3c7;
  color: #92400e;
}

.badge-custom {
  background: #fee2e2;
  color: #991b1b;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
  min-height: 40px;
}

.card-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.15s ease;
  width: 100%;
}

.card-cta-btn svg.lucide {
  width: 16px;
  height: 16px;
}

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

.btn-primary-cta:hover {
  background: var(--primary-dark);
}

.btn-secondary-cta {
  background: #f8fafc;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary-cta:hover {
  background: #f1f5f9;
}

/* Part Grid Cards */
.part-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.part-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.part-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.part-badge-tone {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.tone-blue { background: #e0f2fe; color: #0369a1; }
.tone-green { background: #dcfce7; color: #15803d; }
.tone-amber { background: #fef3c7; color: #b45309; }
.tone-rose { background: #ffe4e6; color: #be123c; }

.part-card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.part-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
  min-height: 48px;
}

.part-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 20px;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
}

.part-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.part-meta-item svg.lucide {
  width: 14px;
  height: 14px;
  stroke: var(--text-subtle);
}

/* Test Runner */
.test-runner-container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
}

.test-content-area {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.question-block {
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid #f1f5f9;
}

.question-block:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.question-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.question-num-badge {
  background: #f1f5f9;
  color: var(--text-main);
  font-weight: 700;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 6px;
  flex-shrink: 0;
}

.question-prompt-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.5;
}

.audio-player-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.audio-player-box audio {
  width: 100%;
  height: 36px;
}

.audio-player-box svg.lucide {
  width: 20px;
  height: 20px;
  stroke: var(--primary);
  flex-shrink: 0;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
}

.option-item:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.option-item.selected {
  background: var(--primary-subtle);
  border-color: var(--primary);
}

.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f1f5f9;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  flex-shrink: 0;
}

.option-item.selected .option-letter {
  background: var(--primary);
  color: white;
}

.option-text {
  font-size: 14px;
  color: var(--text-main);
}

/* Sidebar Navigator */
.test-sidebar-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  height: fit-content;
  position: sticky;
  top: 90px;
}

.test-panel-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-main);
}

.pills-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.q-pill {
  height: 36px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.q-pill.answered {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.q-pill:hover {
  border-color: var(--primary);
}

/* Flashcard Styles */
.flashcard-box {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 48px 32px;
  text-align: center;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
}

.flashcard-box:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.flashcard-word {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
}

.flashcard-phonetic {
  font-size: 16px;
  color: var(--text-muted);
  font-family: monospace;
  margin-bottom: 16px;
}

.flashcard-meaning {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 12px;
}

.flashcard-example {
  font-size: 14px;
  color: var(--text-muted);
  font-style: italic;
  max-width: 500px;
}

/* Responsive */
@media (max-width: 900px) {
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
  }
  .test-runner-container {
    grid-template-columns: 1fr;
  }
}
