/* ===================================================
   navbar.css — Navigation Bar, Profile Dropdown & Mobile Menu
   Depends on: variables.css, base.css
   =================================================== */

/* ── Navbar shell ─────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--white);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
  padding: 15px 0;
  transition: background 0.3s, border-color 0.3s;
}

body.dark-mode .navbar {
  background: var(--off-white);
  border-bottom-color: rgba(255, 255, 255, 0.07);
}

/* ── Nav container ────────────────────────────────── */
.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Logo ─────────────────────────────────────────── */
.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  height: 44px;          /* fits neatly inside the 64px nav-container */
}

.logo img {
  height: 100%;
  width: auto;           /* preserves 220×176 aspect ratio (~1.25:1) */
  display: block;
  object-fit: contain;
}
.logo .dark-logo { display: none; }

/* Theme-aware logo swap */
.dark-logo  { display: none; }
.dark_lp_img  { display: none; }
.why_dark_img { display: none; }

body.dark-mode .light-logo    { display: none; }
body.dark-mode .dark-logo     { display: block; }
body.dark-mode .light_lp_img  { display: none; }
body.dark-mode .dark_lp_img   { display: block; }
body.dark-mode .why_light_img { display: none; }
body.dark-mode .why_dark_img  { display: block; }

/* ── Nav links menu ───────────────────────────────── */
.nav-menu {
  display: flex;
  list-style: none;;
  gap: 0.25rem;
  margin-left: auto;
}

.nav-links{
  display: flex;

}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  position: relative;
  transition: color 0.2s, background 0.2s;
}

/* Underline indicator */
.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: var(--transition);
}

.nav-link:hover::after,
.nav-link.active::after { width: 100%; }

.nav-link:hover,
.nav-link.active,
.navigation-link:hover,
.navigation-link.active {
  color: var(--primary);
  background: hsla(24, 100%, 50%, 0.07);
}

body.dark-mode .nav-link           { color: var(--text); }
body.dark-mode .nav-link:hover,
body.dark-mode .nav-link.active    { color: var(--primary-light);}

/* ── Auth area ────────────────────────────────────── */
.nav-auth {
  display: flex;
  gap: 15px;
}

.nav-auth-guest {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ── Hamburger toggle ─────────────────────────────── */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: background 0.2s, transform 0.2s, opacity 0.2s;
}

body.dark-mode .nav-toggle span { background: var(--text); }

/* Open state (X icon) */
.nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ── Profile trigger ──────────────────────────────── */
.profile-trigger {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 2px solid transparent;
  border-radius: 50px;
  padding: 4px 10px 4px 4px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.profile-trigger:hover,
.profile-trigger[aria-expanded="true"] {
  border-color: var(--primary);
  background: hsla(24, 100%, 50%, 0.05);
}

body.dark-mode .profile-trigger:hover,
body.dark-mode .profile-trigger[aria-expanded="true"] {
  border-color: var(--primary-light);
  background: hsla(24, 100%, 65%, 0.08);
}

/* Avatar circle */
.trigger-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  font-family: 'Libre Caslon Text', serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  letter-spacing: 0.03em;
}

.trigger-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.trigger-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  max-width: 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.dark-mode .trigger-name { color: var(--text); }

.trigger-chevron {
  width: 14px;
  height: 14px;
  color: var(--gray);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s;
  flex-shrink: 0;
}

.profile-trigger[aria-expanded="true"] .trigger-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

body.dark-mode .trigger-chevron                                         { color: var(--gray); }
body.dark-mode .profile-trigger[aria-expanded="true"] .trigger-chevron { color: var(--primary-light); }

/* ── Profile dropdown panel ───────────────────────── */
.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 360px;
  background: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.09);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.06);
  z-index: 2000;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

body.dark-mode .profile-dropdown {
  background: var(--off-white);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Dropdown header */
.pd-header {
  padding: 1.5rem 1.5rem 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  position: relative;
  overflow: hidden;
}

.pd-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='28'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

/* Avatar wrapper inside dropdown */
.pd-avatar-wrap {
  position: relative;
  width: 68px;
  height: 68px;
  margin-bottom: 0.75rem;
  cursor: pointer;
}

.pd-avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 3px solid rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: 'Libre Caslon Text', serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: #fff;
  transition: border-color 0.2s;
}

.pd-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pd-avatar-wrap:hover .pd-avatar { border-color: #fff; }

/* Camera icon overlay on avatar */
.pd-avatar-edit {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.pd-avatar-edit svg { color: var(--primary); }
.pd-avatar-wrap:hover .pd-avatar-edit { opacity: 1; transform: scale(1); }

#avatarFileInput { display: none; }

.pd-name {
  font-family: 'Libre Caslon Text', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 0.15rem;
}

.pd-meta {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.75);
  font-family: 'Roboto Mono', monospace;
}

/* Scrollable dropdown body */
.pd-body {
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.pd-body::-webkit-scrollbar       { width: 4px; }
.pd-body::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.12); border-radius: 4px; }
body.dark-mode .pd-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); }

/* Sections */
.pd-section {
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

body.dark-mode .pd-section { border-bottom-color: rgba(255, 255, 255, 0.06); }
.pd-section:last-child      { border-bottom: none; }

.pd-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 0.6rem;
  font-family: 'Roboto Mono', monospace;
}

body.dark-mode .pd-section-label { color: var(--gray); }

/* Courses list inside dropdown */
.pd-courses-empty {
  font-size: 0.8rem;
  color: var(--gray);
  text-align: center;
  padding: 0.5rem 0 0.25rem;
  font-style: italic;
}

body.dark-mode .pd-courses-empty { color: var(--gray); }

.pd-course-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.pd-course-item:last-child { border-bottom: none; }
body.dark-mode .pd-course-item { border-bottom-color: rgba(255, 255, 255, 0.05); }

.pd-course-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.pd-course-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

body.dark-mode .pd-course-name { color: var(--text); }

.pd-course-pct {
  font-size: 0.7rem;
  font-weight: 700;
  font-family: 'Roboto Mono', monospace;
  color: var(--primary);
  flex-shrink: 0;
}

body.dark-mode .pd-course-pct { color: var(--primary-light); }

.pd-progress-track {
  height: 4px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

body.dark-mode .pd-progress-track { background: rgba(255, 255, 255, 0.08); }

.pd-progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.pd-progress-fill.complete { background: linear-gradient(90deg, #2f855a, #48bb78); }

/* Achievements link */
.pd-achievements-link {
  display: inline-block;
  padding: 6px 0;
  font-size: 0.875rem;
  color: var(--primary);
  text-decoration: none;
}
.pd-achievements-link:hover { text-decoration: underline; }

/* Theme toggle row */
.pd-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

body.dark-mode .pd-toggle-row { border-top-color: rgba(255, 255, 255, 0.06); }

.pd-toggle-label {
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

body.dark-mode .pd-toggle-label { color: var(--text); }

/* Pill toggle switch */
.pill-toggle { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.pill-toggle input { opacity: 0; width: 0; height: 0; }

.pill-track {
  position: absolute;
  inset: 0;
  background: #ddd;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.25s;
}

.pill-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.pill-toggle input:checked + .pill-track            { background: var(--primary); }
.pill-toggle input:checked + .pill-track::after     { transform: translateX(20px); }
body.dark-mode .pill-toggle input:checked + .pill-track { background: var(--primary-light); }

/* Theme toggle buttons (floating) */
.theme-toggle {
  color: var(--text);
  background: none;
  border: none;
}
.theme-toggle:hover {
  color: var(--primary-light);
  box-shadow: var(--shadow-md);
}

/* Logout button */
.pd-footer {
  padding: 0.75rem 1.25rem 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

body.dark-mode .pd-footer { border-top-color: rgba(255, 255, 255, 0.06); }

.pd-logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  border: 1.5px solid rgba(220, 53, 69, 0.25);
  background: rgba(220, 53, 69, 0.04);
  color: #c0392b;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  font-family: 'Roboto', sans-serif;
}

.pd-logout-btn:hover {
  background: rgba(220, 53, 69, 0.10);
  border-color: rgba(220, 53, 69, 0.50);
  color: #a93226;
}

body.dark-mode .pd-logout-btn {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.20);
  background: rgba(255, 107, 107, 0.05);
}

body.dark-mode .pd-logout-btn:hover {
  background: rgba(255, 107, 107, 0.12);
  border-color: rgba(255, 107, 107, 0.40);
}

/* ── Floating theme-toggle icon button ────────────── */
.icon-btn {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--primary);
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.icon-btn:hover  { transform: translateY(-4px); box-shadow: var(--shadow-glow); }
.icon-btn:active { transform: scale(0.95); }

/* Sun/moon icon swap */
.sun-icon  { display: none; }
.moon-icon { display: block; }

body.dark-mode .sun-icon  { display: block; }
body.dark-mode .moon-icon { display: none; }

/* Dark-mode overrides for nav elements */
body.dark-mode .nav-link  { color: var(--text); }
body.dark-mode .nav-menu  { background: var(--off-white); }