/* ============================================================
   DIGITAL SAMAAJ — PREMIUM DESKTOP HEADER v2.0
   Upgrades the header to 72–80px on desktop, larger logo,
   integrated search bar, prominent CTA, subtle scroll shadow.
   Mobile header is fully preserved (≤1023px untouched).
   ============================================================ */

/* ── DESKTOP (1024px+) ── */
@media (min-width: 1024px) {

  /* ── 1. HEIGHT & LAYOUT ── */
  :root {
    --top-h: 76px; /* 72–80px sweet spot */
  }

  .top-bar {
    height: var(--top-h);
    background: rgba(248, 247, 255, 0.96);
    border-bottom: 1px solid transparent;
    transition: border-color .25s, box-shadow .25s, background .25s;
  }
  .dark-theme .top-bar {
    background: rgba(14, 14, 26, 0.96);
  }

  /* Scroll shadow — stronger than mobile */
  .top-bar.scrolled {
    border-bottom-color: var(--border);
    box-shadow: 0 2px 24px rgba(91, 76, 255, .10);
    background: rgba(248, 247, 255, .98);
  }
  .dark-theme .top-bar.scrolled {
    background: rgba(14, 14, 26, .98);
    box-shadow: 0 2px 24px rgba(0, 0, 0, .35);
  }

  /* ── 2. INNER LAYOUT — logo | nav | search | actions ── */
  .top-bar-inner {
    max-width: 1440px;
    padding: 0 40px;
    display: grid;
    grid-template-columns: auto 1fr auto auto; /* logo | nav | search | actions */
    align-items: center;
    gap: 0;
    height: 100%;
  }

  /* ── 3. BRAND / LOGO ── */
  .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 32px;
    text-decoration: none;
    flex-shrink: 0;
  }
  .brand-logo {
    width: 48px !important;
    height: 48px !important;
    border-radius: 14px !important;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(91, 76, 255, .20);
    transition: transform .2s, box-shadow .2s;
    flex-shrink: 0;
  }
  .brand-logo:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 20px rgba(91, 76, 255, .30);
  }
  .brand-name {
    font-size: 20px !important;
    font-weight: 900;
    letter-spacing: -.4px;
    color: var(--primary);
    line-height: 1.1;
  }
  .brand-tagline {
    display: block !important;
    font-size: 10px;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: .4px;
    text-transform: uppercase;
    white-space: nowrap;
    margin-top: 1px;
  }

  /* ── 4. DESKTOP NAV — sits in col 2 ── */
  .desktop-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0;           /* reset any previous margin */
    justify-self: start;
  }
  .desktop-nav-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-2);
    cursor: pointer;
    transition: background .18s, color .18s, transform .15s;
    border: none;
    background: none;
    font-family: var(--font-body);
    white-space: nowrap;
    letter-spacing: -.1px;
  }
  .desktop-nav-item:hover {
    background: var(--surface-2);
    color: var(--primary);
  }
  .desktop-nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
  }
  /* hide emoji span — cleaner on desktop */
  .desktop-nav-item > span:first-child {
    display: none;
  }

  /* ── 5. INLINE SEARCH BAR — col 3 ── */
  /* The search trigger button becomes a visible pill on desktop */
  #searchBtn {
    /* transform the icon-btn into an expandable search field */
    display: flex !important;
    align-items: center;
    gap: 10px;
    width: 220px;
    height: 40px;
    padding: 0 16px;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, width .3s cubic-bezier(.4,0,.2,1), background .2s;
    margin: 0 20px;
    flex-shrink: 0;
    text-align: left;
    justify-content: flex-start;
    font-family: var(--font-body);
  }
  /* search pill label injected by JS as .search-pill-label span */
  #searchBtn:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91, 76, 255, .10);
    background: var(--surface);
    color: var(--primary);
  }
  #searchBtn svg {
    flex-shrink: 0;
    color: var(--muted);
    width: 16px; height: 16px;
  }
  /* Dark theme search bar */
  .dark-theme #searchBtn {
    background: var(--surface-2);
    border-color: var(--border);
  }
  .dark-theme #searchBtn:hover {
    border-color: var(--primary);
    background: var(--surface-3);
  }

  /* ── 6. TOP ACTIONS — col 4 ── */
  .top-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }

  /* Notification + theme icons — slightly larger */
  .top-actions .icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: var(--text-2);
  }
  .top-actions .icon-btn:hover {
    background: var(--surface-2);
    color: var(--primary);
  }
  .top-actions .icon-btn svg {
    width: 20px;
    height: 20px;
  }

  /* ── 7. PRIMARY CTA — injected as real button by JS ── */
  #desktopCTA {
    height: 40px !important;
    padding: 0 20px !important;
    font-size: 13px !important;
    margin-left: 4px;
    flex-shrink: 0;
    white-space: nowrap;
  }
  #desktopCTA:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(91, 76, 255, .5) !important;
  }

  /* User avatar pill (profile access) */
  .top-actions .icon-btn[aria-label="Profile"],
  .top-actions .icon-btn[aria-label="User"] {
    background: var(--primary-light);
    color: var(--primary);
    border: 1.5px solid var(--border);
  }
  .top-actions .icon-btn[aria-label="Profile"]:hover,
  .top-actions .icon-btn[aria-label="User"]:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
  }

  /* Notification badge — cleaner position */
  .notif-badge {
    top: 5px;
    right: 5px;
    width: 17px;
    height: 17px;
    font-size: 9px;
    border-width: 2px;
  }

  /* ── 8. SEARCH OVERLAY on desktop — centered modal style ── */
  .search-bar-wrap {
    /* on desktop, show as centered overlay rather than top-pinned bar */
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    background: rgba(10, 10, 30, .5);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 120px;
    transform: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    z-index: 600;
  }
  .search-bar-wrap.open {
    transform: none !important;
    opacity: 1;
    pointer-events: auto;
  }
  .search-bar {
    width: 100%;
    max-width: 640px;
    height: 56px;
    padding: 0 20px;
    border-radius: 20px;
    border: 2px solid var(--primary);
    box-shadow: 0 8px 40px rgba(91, 76, 255, .25);
    background: var(--surface);
    gap: 14px;
    font-size: 16px;
  }
  .search-bar input {
    font-size: 16px;
    font-weight: 500;
  }
  .search-bar svg {
    width: 20px;
    height: 20px;
    color: var(--primary);
  }
  .close-search {
    font-size: 20px;
    color: var(--muted);
    padding: 4px 10px;
    border-radius: 8px;
    transition: background .2s, color .2s;
  }
  .close-search:hover {
    background: var(--surface-2);
    color: var(--text);
  }

  /* ── 9. NOTIFICATION PANEL — repositioned for taller header ── */
  .notif-panel {
    top: calc(var(--top-h) + 8px);
    right: 40px;
    width: 380px;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(91, 76, 255, .15);
  }
}

/* ── WIDE DESKTOP (1280px+) ── */
@media (min-width: 1280px) {
  .top-bar-inner {
    padding: 0 56px;
  }
  #searchBtn {
    width: 260px;
    margin: 0 28px;
  }
  .brand-name {
    font-size: 22px !important;
  }
  .desktop-nav-item {
    padding: 9px 16px;
    font-size: 14px;
  }
  .desktop-nav-item > span:first-child {
    display: inline; /* show emoji on very wide screens */
    font-size: 15px;
  }
  .notif-panel {
    right: 56px;
  }
}

/* ── ENSURE MAIN CONTENT STARTS BELOW TALLER HEADER ── */
@media (min-width: 1024px) {
  .main-content {
    padding-top: var(--top-h);
  }
  /* learn tabs sticky offset update */
  .learn-tabs-bar,
  .learn-tabs {
    top: var(--top-h) !important;
  }
}
