/* ================================================================
   header.css v2.0 — eachSprint Premium Header
   Imports Inter from Google Fonts via index.html or inline.
   All classes prefixed es- to avoid collisions with course styles.
   ================================================================ */

/* ── Google Font (inject once if not in <head>) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── CSS Variables scoped to header ────────────────────────────── */
:root {
  --h-ink:          #111827;
  --h-ink2:         #1f2937;
  --h-accent:       #FA541C; /* Brand orange */
  --h-accent-dark:  #e04a17;
  --h-accent-glow:  rgba(250, 84, 28, 0.18);
  --h-text-muted:   #94a3b8;
  --h-text-light:   #cbd5e1;
  --h-text-nav:     #e2e8f0;
  --h-border:       rgba(255,255,255,0.07);
  --h-hover-bg:     rgba(255,255,255,0.07);
  --h-bar-height:   58px;
  --h-tech-height:  36px;
  --header-height:  94px; /* bar + tech */
}

/* ── TOP BAR ────────────────────────────────────────────────────── */
.top-bar {
  display: flex;
  align-items: center;
  height: var(--h-bar-height);
  padding: 0 20px;
  background: var(--h-ink);
  border-bottom: 1px solid var(--h-border);
  position: sticky;
  top: 0;
  z-index: 1001;
  gap: 6px;
  font-family: 'Inter', 'Segoe UI', sans-serif;
}

/* ── LOGO ───────────────────────────────────────────────────────── */
.es-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 8px;
  transition: opacity 0.15s;
}
.es-logo:hover { opacity: 0.85; }

.es-logo-icon {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 26px;
  font-weight: 100;
  letter-spacing: -2px;
  display: flex;
  align-items: center;
  margin-right: 6px;
  line-height: 1;
}

.es-logo-e {
  color: #ffffff;
  text-shadow: -2px 1px 0px #00E5FF, 1px -1px 0px rgba(250,84,28,0.5);
}

.es-logo-s {
  color: #FA541C;
  text-shadow: -2px 1px 0px #00E5FF, 2px -1px 0px #e60000;
}


.es-logo-text {
  font-size: 20px;
  font-weight: 800;
  color: #f3f4f6;
  letter-spacing: -0.5px;
}
.es-logo-accent { color: var(--h-accent); font-weight: 800; }

/* ── PRIMARY NAV (desktop) ─────────────────────────────────────── */
.es-primary-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: auto;
}

.es-nav-link,
.es-nav-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 13px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--h-text-nav);
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  font-family: 'Inter', 'Segoe UI', sans-serif;
}
.es-nav-link:hover,
.es-nav-btn:hover {
  background: var(--h-hover-bg);
  color: #fff;
}

.es-chevron { font-size: 10px; opacity: 0.7; transition: transform 0.2s; }
.es-has-dropdown.open .es-chevron { transform: rotate(180deg); }

/* ── DROPDOWN ───────────────────────────────────────────────────── */
.es-has-dropdown { position: relative; }

.es-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--h-ink2);
  border: 1px solid var(--h-border);
  border-radius: 12px;
  padding: 20px;
  gap: 24px;
  min-width: 560px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
  z-index: 1100;
  animation: es-dropdown-in 0.18s ease;
}
.es-dropdown.open { display: flex; }
@keyframes es-dropdown-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.es-dropdown-col { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.es-dropdown-heading {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--h-text-muted);
  margin: 0 0 8px;
  padding: 0 10px;
}

.es-dropdown-link {
  display: block;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--h-text-light);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.es-dropdown-link:hover {
  background: var(--h-hover-bg);
  color: #fff;
}

/* ── HEADER RIGHT ZONE ──────────────────────────────────────────── */
.es-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── SEARCH ─────────────────────────────────────────────────────── */
.es-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  padding: 0 12px;
  gap: 8px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.es-search-wrap:focus-within {
  background: rgba(255,255,255,0.18);
  border-color: rgba(250, 84, 28, 0.8);
  box-shadow: 0 0 15px rgba(250, 84, 28, 0.45);
}
.es-search-icon { font-size: 13px; opacity: 0.5; }
.es-search-input {
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: 13px;
  width: 175px;
  height: 34px;
  font-family: 'Inter', 'Segoe UI', sans-serif;
}
.es-search-input:focus, .es-search-input:focus-visible {
  outline: none !important;
}
.es-search-input::placeholder { color: var(--h-text-muted); }

/* ── AUTH: SIGN IN BUTTON ───────────────────────────────────────── */
.es-btn-signin {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--h-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  font-family: 'Inter', 'Segoe UI', sans-serif;
}
.es-btn-signin:hover {
  background: var(--h-accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(250,84,28,0.4);
}
.es-signin-icon { font-size: 14px; }

/* ── AUTH: PROFILE DROPDOWN ─────────────────────────────────────── */
.es-auth-wrap    { position: relative; }
.es-profile-wrap { position: relative; }

.es-profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 30px;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  color: var(--h-text-nav);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
  font-family: 'Inter', 'Segoe UI', sans-serif;
}
.es-profile-btn:hover { background: rgba(255,255,255,0.12); }

.es-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--h-accent);
}

.es-profile-name { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.es-profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--h-ink2);
  border: 1px solid var(--h-border);
  border-radius: 12px;
  padding: 8px;
  min-width: 200px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  z-index: 1100;
  animation: es-dropdown-in 0.18s ease;
}
.es-profile-dropdown.open { display: block; }

.es-profile-info {
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.es-profile-info strong { color: #fff; font-size: 13.5px; }
.es-profile-info small  { color: var(--h-text-muted); font-size: 11px; }

.es-profile-hr { border: none; border-top: 1px solid var(--h-border); margin: 4px 0; }

.es-profile-menu-item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--h-text-light);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  font-family: 'Inter', 'Segoe UI', sans-serif;
}
.es-profile-menu-item:hover { background: var(--h-hover-bg); color: #fff; }
.es-signout-btn { color: #f87171; }
.es-signout-btn:hover { background: rgba(248,113,113,0.12); color: #f87171; }

/* ── HAMBURGER (mobile only) ────────────────────────────────────── */
.es-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}
.es-hamburger:hover { background: var(--h-hover-bg); }
.es-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--h-text-nav);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}

/* Animated X when open */
.es-hamburger.open .es-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.es-hamburger.open .es-bar:nth-child(2) { opacity: 0; }
.es-hamburger.open .es-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── MOBILE MENU ────────────────────────────────────────────────── */
.es-mobile-menu {
  display: none;
  flex-direction: column;
  background: var(--h-ink2);
  border-bottom: 1px solid var(--h-border);
  position: absolute;
  top: var(--h-bar-height);
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 8px 0;
  animation: es-mob-in 0.2s ease;
  max-height: calc(100vh - var(--h-bar-height));
  overflow-y: auto;
}
.es-mobile-menu.open { display: flex; }
@keyframes es-mob-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.es-mob-section {
  padding: 12px 20px 4px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--h-text-muted);
}

.es-mob-link {
  display: block;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--h-text-nav);
  text-decoration: none;
  border-bottom: 1px solid var(--h-border);
  transition: background 0.12s, color 0.12s;
}
.es-mob-link:hover { background: var(--h-hover-bg); color: #fff; }
.es-mob-sub { padding-left: 34px; font-size: 13px; color: var(--h-text-muted); }
.es-mob-sub:hover { color: #fff; }

/* ── TECH BAR ───────────────────────────────────────────────────── */
.es-tech-bar {
  display: flex;
  align-items: center;
  height: var(--h-tech-height);
  background: var(--h-ink2);
  border-bottom: 1px solid var(--h-border);
  position: sticky;
  top: var(--h-bar-height);
  z-index: 999;
  font-family: 'Inter', 'Segoe UI', sans-serif;
}

.es-tech-arrow {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #475569;
  width: 28px;
  height: 100%;
  font-size: 18px;
  cursor: pointer;
  transition: color 0.15s;
}
.es-tech-arrow:hover { color: var(--h-text-nav); }

.es-tech-bar-inner {
  display: flex;
  flex: 1;
  height: 100%;
  align-items: center;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.es-tech-bar-inner::-webkit-scrollbar { display: none; }

/* tech-link: shared between new header and the SPA route system */
.tech-link {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  border-right: 1px solid var(--h-border);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  letter-spacing: 0.2px;
}
.tech-link:hover { color: var(--h-accent); background: rgba(255,255,255,0.04); }
.tech-link.active {
  color: var(--h-accent);
  background: rgba(250,84,28,0.08);
  border-bottom: 2px solid var(--h-accent);
  font-weight: 700;
}

/* ── RESPONSIVE ─────────────────────────────────────────────────── */
.es-social-icons {
  display: flex;
  align-items: center;
  gap: 12px;
}
.es-social-icons a {
  text-decoration: none;
  font-size: 16px;
  opacity: 0.8;
  transition: opacity 0.2s, transform 0.2s;
}
.es-social-icons a:hover {
  opacity: 1;
  transform: translateY(-2px);
}
.desktop-only { display: flex; }
.mobile-only { display: none; }

.es-social-icons.mobile-only {
  padding: 16px;
  border-bottom: 1px solid var(--h-border);
  margin-bottom: 10px;
  justify-content: space-around;
}
.es-social-icons.mobile-only a {
  font-size: 14px;
  color: var(--h-text-nav);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

@media (max-width: 992px) {
  .es-search-input { width: 130px; }
}

@media (max-width: 768px) {
  .es-primary-nav { display: none; }
  .desktop-only { display: none; }
  .mobile-only { display: flex; }
  
  /* Top Bar Reordering: Logo -> Search -> Profile -> Hamburger */
  .top-bar { justify-content: space-between; position: relative; }
  .es-logo { order: 1; margin-right: auto; } /* Pushes the rest to the right */
  .es-header-right { 
    order: 2; 
    gap: 12px; 
  }
  .es-hamburger { 
    display: flex; 
    order: 3; 
    margin: 0; 
  }

  .es-logo-text { font-size: 16px; }

  /* Reorder Profile/Search inside es-header-right: Search -> Profile */
  .es-search-wrap { 
    order: 1; 
    display: flex;
    background: transparent;
    border: none;
    padding: 0;
  }
  .es-auth-wrap { order: 2; }

  /* Tap to expand search on mobile */
  .es-search-input { 
    width: 0; 
    padding: 0; 
    opacity: 0; 
    transition: width 0.2s, opacity 0.2s, padding 0.2s; 
  }
  .es-search-icon {
    font-size: 18px; /* Slightly larger for touch */
    opacity: 0.8;
    padding: 4px;
    cursor: pointer;
  }
  
  .es-search-wrap.active, .es-search-wrap:focus-within {
    position: absolute; 
    left: 10px; 
    right: 10px; 
    top: 10px; 
    height: 38px;
    background: var(--h-ink2); 
    border: 1px solid var(--h-border); 
    z-index: 2000;
    padding: 0 12px; 
    border-radius: 8px;
  }
  .es-search-wrap.active .es-search-input, .es-search-wrap:focus-within .es-search-input {
    width: 100%; 
    padding: 0 8px; 
    opacity: 1;
  }

  .es-profile-btn { padding: 4px; }
  .es-profile-name { display: none; } /* Hide name on mobile to save space */
}

@media (max-width: 480px) {
  .top-bar { padding: 0 12px; }
  .es-btn-signin { padding: 6px 10px; font-size: 12px; }
}

/* ── SEARCH RESULTS ──────────────────────────────────────────────── */
.es-search-results a {
  display: block;
  padding: 10px 16px;
  color: #333;
  text-decoration: none;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
  text-align: left;
}
.es-search-results a:last-child { border-bottom: none; }
.es-search-results a:hover { background: #f9f9f9; }
.es-search-results .res-course {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 2px;
  display: block;
}
.es-search-results .res-title {
  font-size: 14px;
  font-weight: 500;
  display: block;
}
.es-search-results .res-empty {
  padding: 16px;
  color: #888;
  text-align: center;
  font-size: 13px;
}