:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #06b6d4;
  --accent-hover: #0891b2;
  --accent-soft: rgba(6, 182, 212, 0.1);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border: #334155;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --day1: #6366f1;
  --day2: #06b6d4;
  --day3: #f59e0b;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

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

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  padding: calc(var(--safe-top) + 12px) 16px 12px;
}

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

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo svg {
  flex-shrink: 0;
}

.app-logo h1 {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.back-btn {
  display: none;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.back-btn:active {
  background: var(--accent-soft);
}

.view.active .back-btn {
  display: flex;
}

/* Bottom Tabs */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 8px 0 calc(var(--safe-bottom) + 4px);
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 8px 4px;
  cursor: pointer;
  transition: color 0.2s;
}

.tab-btn svg {
  width: 24px;
  height: 24px;
}

.tab-btn.active {
  color: var(--accent);
}

.tab-btn:active {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}

/* Views */
.view {
  display: none;
  padding: 16px;
  padding-bottom: calc(80px + var(--safe-bottom));
  max-width: 720px;
  margin: 0 auto;
}

.view.active {
  display: block;
}

/* Home View */
.hero-section {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-radius: var(--radius);
  padding: 28px 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.hero-badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
}

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

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

.days-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.day-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.day-card:active {
  transform: scale(0.98);
  border-color: var(--accent);
}

.day-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.day-card[data-day="1"]::before { background: var(--day1); }
.day-card[data-day="2"]::before { background: var(--day2); }
.day-card[data-day="3"]::before { background: var(--day3); }

.day-number {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 6px;
}

.day-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.day-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.day-meta {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.day-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 24px 0 14px;
  color: var(--text-primary);
}

/* Curriculum View */
.day-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
}

.day-tabs::-webkit-scrollbar { display: none; }

.day-tab {
  flex-shrink: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.day-tab.active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

.module-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.module-header {
  padding: 16px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.module-header:active {
  background: var(--accent-soft);
}

.module-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

.module-card[data-day="1"] .module-indicator { background: var(--day1); }
.module-card[data-day="2"] .module-indicator { background: var(--day2); }
.module-card[data-day="3"] .module-indicator { background: var(--day3); }

.module-info {
  flex: 1;
}

.module-id {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.module-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 2px 0 4px;
  color: var(--text-primary);
}

.module-duration {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.module-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 6px;
  transition: transform 0.2s;
}

.module-card.expanded .module-chevron {
  transform: rotate(180deg);
}

.module-body {
  display: none;
  border-top: 1px solid var(--border);
}

.module-card.expanded .module-body {
  display: block;
}

.module-section {
  padding: 16px;
}

.module-section + .module-section {
  border-top: 1px solid rgba(51, 65, 85, 0.5);
}

.module-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.module-section ul {
  list-style: none;
}

.module-section ul li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 6px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.module-section ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1.5px solid var(--accent);
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 4px;
  margin-right: 4px;
  margin-bottom: 4px;
}

.badge-lab {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.badge-exercise {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.badge-demo {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.badge-capstone {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.phase-list {
  display: grid;
  gap: 8px;
}

.phase-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.phase-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.phase-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Progress View */
.progress-overview {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  margin-bottom: 20px;
}

.progress-pct {
  font-size: 2.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.progress-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  margin: 16px 0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.progress-badge {
  background: rgba(0,0,0,0.08);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-left: 8px;
}

.progress-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 20px 0 10px;
}

.slide-list {
  list-style: none;
  padding: 0;
}

.slide-item {
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 4px;
}

.slide-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}

.slide-header:active {
  background: var(--accent-soft);
}

.slide-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.slide-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  line-height: 1.3;
}

.slide-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.slide-body {
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border);
}

.slide-content {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
  padding: 12px;
  white-space: pre-wrap;
  overflow-x: hidden;
}
.slide-content svg {
  display: block;
  margin: 8px auto;
  max-width: 100%;
  height: auto;
}

.progress-card-mobile {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  margin-top: 16px;
}

.progress-card-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 4px;
}

.progress-card-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 12px;
}

.progress-card-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-card-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-card-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}

.progress-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
}

.progress-item:active {
  background: var(--accent-soft);
}

.progress-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
}

.progress-check.checked {
  background: var(--success);
  border-color: var(--success);
}

.progress-check.checked svg {
  display: block;
}

.progress-check svg {
  display: none;
}

.progress-item-text {
  flex: 1;
}

.progress-item-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.progress-item-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Resources View */
.resource-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 10px;
}

.resource-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.resource-card ul {
  list-style: none;
  padding-left: 0;
}

.resource-card li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.resource-card li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.cert-grid {
  display: grid;
  gap: 8px;
}

.cert-item {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.cert-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cert-icon.labs { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.cert-icon.exercises { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.cert-icon.capstone { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.cert-icon.attendance { background: rgba(99, 102, 241, 0.15); color: #818cf8; }

.cert-text {
  flex: 1;
}

.cert-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.cert-detail {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Transition animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.view.active {
  animation: fadeIn 0.25s ease;
}

/* Scrollbar styles */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 2px; }

/* Selection */
::selection {
  background: var(--accent);
  color: var(--bg-primary);
}

/* Print */
@media print {
  .bottom-nav, .app-header { display: none; }
  .view { padding: 0; }
  .module-body { display: block !important; }
  body { background: white; color: black; }
}

/* Large phones / small tablets */
@media (min-width: 420px) {
  .hero-title { font-size: 1.8rem; }
  .view { padding: 20px; max-width: 780px; }
}

/* Desktop */
@media (min-width: 768px) {
  .view { padding: 24px; max-width: 860px; }
  .hero-section { padding: 36px 28px; }
  .hero-title { font-size: 2rem; }
  .days-grid { grid-template-columns: repeat(3, 1fr); }
  .cert-grid { grid-template-columns: repeat(2, 1fr); }
}
