/* ═══════════════════════════════════════════════
   FOSS Course App — UI Components 
   (Pro Max Edition: Massive spacing, Glass UI)
   ═══════════════════════════════════════════════ */

/* ─── Navigation Bar ────────────────────────── */
.navbar {
  position: fixed;
  top: 16px; left: 16px; right: 16px;
  max-width: var(--max-width);
  margin-inline: auto;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding-inline: 32px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  transition: all var(--t);
}

.navbar__logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.navbar__logo svg { width: 36px; height: 36px; flex-shrink: 0; color: var(--primary); }

.navbar__links {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  list-style: none;
}

.navbar__links a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--t-fast);
  text-decoration: none;
}

.navbar__links a svg { width: 20px; height: 20px; }

.navbar__links a:hover,
.navbar__links a.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(13,148,136,0.3);
  transform: translateY(-1px);
}

.navbar__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--cta);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  width: 20px; height: 20px;
  border-radius: 50%;
  margin-left: 2px;
}

/* Hamburger for mobile */
.navbar__hamburger {
  display: none;
  background: var(--primary-faint);
  border: none;
  cursor: pointer;
  padding: 12px;
  border-radius: 50%;
  color: var(--primary-dark);
  margin-left: auto;
  transition: transform var(--t-fast);
}

.navbar__hamburger:active { transform: scale(0.9); }

@media (max-width: 768px) {
  .navbar { top: 12px; left: 12px; right: 12px; height: 64px; padding-inline: 20px; }
  .navbar__logo { font-size: 1.2rem; }
  .navbar__hamburger { display: flex; }
  .navbar__links {
    display: none;
    position: fixed;
    top: 84px;
    left: 12px; right: 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px) saturate(200%);
    -webkit-backdrop-filter: blur(24px) saturate(200%);
    border-radius: var(--radius-lg);
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-xl);
    animation: bounceIn 0.4s var(--ease-spring) both;
  }
  .navbar__links.open { display: flex; }
  .navbar__links a { padding: 16px 20px; border-radius: var(--radius-sm); font-size: 1.1rem; }
}

/* Page padding to account for fixed nav */
.page-body {
  padding-top: calc(var(--nav-height) + 64px);
  min-height: 100vh;
}

/* ─── Premium Buttons ────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 32px;
  border-radius: var(--radius-pill);
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all var(--t-fast);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn svg { width: 22px; height: 22px; transition: transform var(--t-fast); }
.btn:hover svg { transform: translateX(2px); }

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.15);
  opacity: 0;
  transition: opacity var(--t-fast);
}

.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; filter: grayscale(1); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 24px rgba(13,148,136,0.3);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 12px 32px rgba(13,148,136,0.4);
  transform: translateY(-2px);
}

.btn-outline {
  background: rgba(255,255,255,0.8);
  color: var(--primary);
  border: 2px solid var(--primary-faint);
  backdrop-filter: blur(12px);
}

.btn-outline:hover {
  background: var(--primary-faint);
  border-color: var(--primary-light);
  transform: translateY(-2px);
}

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

.btn-ghost:hover {
  background: rgba(255,255,255,0.8);
  color: var(--primary-dark);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 8px 24px rgba(239,68,68,0.3);
}

.btn-sm { padding: 10px 20px; font-size: 0.95rem; svg { width: 18px; height: 18px; } }
.btn-lg { padding: 20px 40px; font-size: 1.2rem; }
.btn-full { width: 100%; justify-content: center; }

/* Loading spinner */
.btn.loading { pointer-events: none; }
.btn.loading .btn-text { opacity: 0; }
.btn.loading::before {
  content: '';
  position: absolute;
  width: 24px; height: 24px;
  border: 3px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ─── Apple Cards ────────────────────────────── */
.card {
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  transition: transform var(--t), box-shadow var(--t);
  position: relative;
  overflow: hidden;
}

@media (max-width: 768px) {
  .card { padding: 24px; border-radius: var(--radius-lg); }
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.card.flat { box-shadow: var(--shadow-sm); }
.card.flat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* ─── Massive Form Elements ──────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-label {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-left: 4px;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 18px 20px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.9);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02), 0 2px 8px rgba(0,0,0,0.04);
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--text);
  transition: all var(--t-fast);
  outline: none;
}

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

.form-input:focus, .form-textarea:focus, .form-select:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02), 0 0 0 4px var(--primary-faint);
  transform: translateY(-1px);
}

.form-input.error { border-color: var(--danger); background: #FEF2F2; color: var(--danger); box-shadow: 0 0 0 4px rgba(239,68,68,0.15); }

.form-textarea { resize: vertical; min-height: 140px; line-height: 1.6; }
.form-hint { font-size: 0.9rem; color: var(--text-muted); margin-left: 4px; }
.form-error { font-size: 0.95rem; color: var(--danger); font-weight: 600; margin-left: 4px; display: flex; align-items: center; gap: 4px; }

.input-wrapper { position: relative; }
.input-wrapper .form-input { padding-left: 54px; }
.input-icon {
  position: absolute;
  left: 20px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
  width: 24px; height: 24px;
  transition: color var(--t-fast);
}

.form-input:focus ~ .input-icon { color: var(--primary); }

/* ─── Apple Progress Bar ─────────────────────── */
.progress-bar-wrap {
  width: 100%;
  background: var(--primary-faint);
  border-radius: var(--radius-pill);
  height: 16px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: var(--radius-pill);
  transition: width 0.8s var(--ease-spring);
  min-width: 0%;
  position: relative;
  overflow: hidden;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 2s infinite linear;
}

.progress-pct-label {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary-dark);
}

/* ─── Pill Badge ─────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
}

.badge-green   { background: var(--primary-faint); color: var(--primary-dark); }
.badge-yellow  { background: #FEF3C7; color: #92400E; }
.badge-red     { background: #FEE2E2; color: #991B1B; }
.badge-blue    { background: #DBEAFE; color: #1E40AF; }
.badge-gray    { background: #F1F5F9; color: #475569; }

/* ─── Premium Modals (Bottom-sheet on mobile) ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.3s var(--ease) both;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 600px;
  border: 1px solid var(--glass-border);
  animation: bounceIn 0.5s var(--ease-spring) both;
  overflow: hidden;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 40px 16px;
}

.modal__title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.modal__close {
  background: var(--bg-solid);
  border: none;
  border-radius: 50%;
  width: 44px; height: 44px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
}

.modal__close:hover { background: var(--primary-faint); color: var(--primary-dark); transform: rotate(90deg); }

.modal__body { padding: 16px 40px 40px; }

@media (max-width: 768px) {
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { max-width: 100%; border-radius: 32px 32px 0 0; animation: slideUpCard 0.4s var(--ease-spring) both; }
  .modal__header { padding: 24px 24px 8px; }
  .modal__body { padding: 16px 24px 32px; }
}

/* ─── Apple Stat / Section Cards ─────────────── */
.stat-card {
  background: var(--surface);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform var(--t-fast);
}

.stat-card:hover { transform: translateY(-4px) scale(1.02); box-shadow: var(--shadow-lg); }

.stat-card__icon {
  width: 56px; height: 56px;
  border-radius: var(--radius-sm);
  background: var(--primary-faint);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}

.stat-card__icon svg { width: 28px; height: 28px; }

.stat-card__value {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.04em;
}

.stat-card__label {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ─── Extravagant Empty State ────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 24px;
  text-align: center;
  color: var(--text-muted);
  background: rgba(255,255,255,0.4);
  border-radius: var(--radius-lg);
  border: 2px dashed rgba(13,148,136,0.2);
}

.empty-state svg {
  width: 80px; height: 80px;
  color: var(--primary-light);
  margin-bottom: 8px;
  filter: drop-shadow(0 8px 16px rgba(13,148,136,0.2));
}

.empty-state h3 { color: var(--text); font-size: 1.6rem; }
.empty-state p  { font-size: 1.1rem; max-width: 400px; }

/* ─── Avatars ────────────────────────────────── */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading);
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: var(--shadow);
  border: 2px solid #fff;
}

.avatar-sm  { width: 44px;  height: 44px;  font-size: 1.1rem; }
.avatar-md  { width: 64px;  height: 64px;  font-size: 1.5rem; }
.avatar-lg  { width: 96px;  height: 96px;  font-size: 2.2rem; }
.avatar-xl  { width: 140px; height: 140px; font-size: 3rem; border: 4px solid #fff; }

/* ─── Hero / Auth Page Focus ─────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background:
    radial-gradient(circle at 10% 20%, rgba(94, 234, 212, 0.4) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(13, 148, 136, 0.2) 0%, transparent 60%),
    var(--bg-solid);
  overflow: hidden;
}

.auth-card {
  width: 100%;
  max-width: 520px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 40px 80px rgba(13,148,136,0.15), inset 0 2px 4px rgba(255,255,255,0.8);
  padding: 56px 48px;
  position: relative;
  z-index: 10;
  animation: slideUpCard 0.6s var(--ease-spring) both;
}

@media (max-width: 600px) {
  .auth-page { padding: 16px; align-items: flex-end; }
  .auth-card { padding: 40px 24px; border-radius: 32px 32px 24px 24px; }
}

/* ─── Divider ────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-light);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 32px 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 2px;
  background: rgba(13,148,136,0.1);
  border-radius: 2px;
}

/* ─── Toasts ─────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 32px; right: 32px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 440px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-xl);
  animation: slideInLeft 0.4s var(--ease-spring) both;
  min-width: 320px;
}

.toast.leaving { animation: fadeIn 0.3s var(--ease) both reverse; }

.toast__icon { width: 28px; height: 28px; flex-shrink: 0; margin-top: 2px; }
.toast__body { flex: 1; }
.toast__title { font-weight: 800; font-size: 1.1rem; margin-bottom: 4px; letter-spacing: -0.01em; }
.toast__msg   { font-size: 0.95rem; color: var(--text-muted); }

.toast.success .toast__icon { color: var(--success); }
.toast.error   .toast__icon { color: var(--danger);  }
.toast__close { background: none; border: none; cursor: pointer; color: var(--text-light); font-size: 1.4rem; padding: 4px; border-radius: 50%; transition: background var(--t-fast); }
.toast__close:hover { background: var(--bg-solid); color: var(--text); }

@media (max-width: 480px) {
  #toast-container { left: 16px; right: 16px; bottom: 24px; max-width: 100%; }
}

/* ─── Vertical Timeline ──────────────────────── */
.pro-timeline {
  display: flex;
  flex-direction: column;
  position: relative;
  margin: 3em 0;
  padding-left: 24px;
}

.pro-timeline::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(to bottom, var(--primary-faint), var(--primary-light), var(--primary-faint));
  border-radius: 4px;
}

.timeline-item {
  position: relative;
  margin-bottom: 32px;
  display: flex;
  flex-direction: column;
  padding-left: 24px;
}

.timeline-item:last-child { margin-bottom: 0; }

.timeline-marker {
  position: absolute;
  left: -24px; top: 0; width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: 0 0 12px rgba(13,148,136,0.5);
  transform: translateX(-50%) translateY(4px);
  z-index: 2;
}

.timeline-content { display: flex; flex-direction: column; gap: 8px; }

.timeline-year {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.timeline-card {
  background: var(--surface);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin: 0;
}

.timeline-event {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 8px 0;
}

.timeline-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

@media (min-width: 768px) {
  .pro-timeline { padding-left: 0; align-items: center; }
  .pro-timeline::before { left: 50%; transform: translateX(-50%); }
  
  .timeline-item {
    flex-direction: row; align-items: stretch;
    width: 100%;
    justify-content: space-between;
    padding-left: 0;
  }
  
  .timeline-marker {
    left: 50%; top: 24px; transform: translate(-50%, -50%);
    width: 20px; height: 20px; border-width: 4px;
  }
  
  .timeline-content {
    flex-direction: row;
    width: 100%; gap: 64px;
    align-items: center;
  }

  /* Alternating layout: EVEN (year on left, card on right) */
  .timeline-year { width: 50%; text-align: right; font-size: 1.8rem; padding-right: 32px; box-sizing: border-box; }
  .timeline-card { width: 50%; margin-left: 0; text-align: left; box-sizing: border-box; }
  
  /* Alternating layout: ODD (year on right, card on left) */
  .timeline-item:nth-child(odd) .timeline-content { flex-direction: row-reverse; }
  .timeline-item:nth-child(odd) .timeline-year { text-align: left; padding-right: 0; padding-left: 32px; }
  .timeline-item:nth-child(odd) .timeline-card { margin-left: 0; text-align: right; }
}
