/* =======================================================
   DESKTOP LAYOUT — En Ville / In Da City
   All rules use @media (min-width: 1024px) — zero impact on mobile.
   Loaded after styles.css, homepage.css, admin.css.
   ======================================================= */

/* ── CSS VARIABLES ─────────────────────────────────────── */
@media (min-width: 1024px) {
  :root {
    --ev-desktop-topnav-h: 64px;
    --ev-desktop-max: 1200px;
  }
}

@media (min-width: 1440px) {
  :root {
    --ev-desktop-max: 1320px;
  }
}

/* ═══════════════════════════════════════════════════════════
   TOP NAV — show on desktop, override ev theme's global hide
   ═══════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {

  /* Override [data-theme="ev"] .topbar { display: none !important } */
  [data-theme="ev"] .topbar,
  body.page-dashboard .topbar,
  body.page-map       .topbar,
  body.page-create-event .topbar {
    display: flex !important;
    left: 0 !important;
    height: var(--ev-desktop-topnav-h);
    padding: 0 20px;
    gap: 0;
    z-index: 1000;     /* above hero (z-index:800) and any modals */
    background: var(--background-color);
    border-bottom: 1px solid var(--border-color);
    align-items: center;
  }

  /* Keep mobile-menu-btn and old search hidden inside the visible topbar */
  .topbar .mobile-menu-btn,
  .topbar .search-container {
    display: none !important;
  }

  /* ── BRAND ── */
  .ev-desktop-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 20px;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    text-decoration: none;
    border: none;
    background: none;
    padding: 0;
  }

  .ev-desktop-brand-fox {
    width: 75px;
    height: 75px;
    object-fit: contain;
  }

  .ev-desktop-brand-name {
    font-family: 'Bebas Neue', 'Inter', sans-serif;
    font-size: 21px;
    letter-spacing: 1.5px;
    color: var(--text-primary);
    white-space: nowrap;
    line-height: 1;
  }

  /* ── NAV LINKS ── */
  .ev-desktop-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
  }

  .ev-desktop-navlink {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border: none;
    background: none;
    white-space: nowrap;
    font-family: inherit;
  }

  .ev-desktop-navlink i {
    font-size: 13px;
  }

  .ev-desktop-navlink:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
  }

  /* Active state driven by body.page-* class set by App.UI.navigate() */
  body.page-dashboard    .ev-desktop-navlink[data-page="dashboard"],
  body.page-events       .ev-desktop-navlink[data-page="events"],
  body.page-map          .ev-desktop-navlink[data-page="map"],
  body.page-create-event .ev-desktop-navlink[data-page="create-event"] {
    color: var(--accent-color, #FF5C35);
    background: rgba(255, 92, 53, 0.10);
  }

  /* ── TOPBAR-RIGHT ── */
  .topbar-right {
    display: flex !important;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
  }

  /* Ce soir button */
  .ev-desktop-cesoir-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 20px;
    background: var(--accent-color, #FF5C35);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    font-family: inherit;
    transition: opacity 0.15s, transform 0.1s;
  }

  .ev-desktop-cesoir-btn:hover {
    opacity: 0.88;
    transform: translateY(-1px);
  }

  .ev-desktop-cesoir-fox {
    width: 18px;
    height: 18px;
    object-fit: contain;
  }

  /* ── DESKTOP SEARCH AREA ── */
  .ev-desktop-search-area {
    position: relative;
    display: flex;
    align-items: center;
  }

  /* Search icon button */
  .ev-desktop-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s, color 0.15s, opacity 0.15s;
    flex-shrink: 0;
  }

  .ev-desktop-search-btn:hover {
    background: rgba(255, 255, 255, 0.13);
    color: var(--text-primary);
  }

  /* Hide the icon button when pill is open */
  body.search-open .ev-desktop-search-btn {
    display: none;
  }

  /* ── Expanding search pill ── */
  .ev-desktop-search-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid transparent;
    border-radius: 20px;
    padding: 0;
    transition: max-width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                opacity     0.22s ease,
                border-color 0.22s ease,
                padding     0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  body.search-open .ev-desktop-search-pill {
    max-width: 260px;
    opacity: 1;
    padding: 5px 10px 5px 12px;
    border-color: var(--border-color);
  }

  .ev-desktop-pill-icon {
    color: var(--text-muted);
    font-size: 12px;
    flex-shrink: 0;
  }

  .ev-desktop-pill-input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    width: 180px; /* forces pill to expand to a useful size */
  }

  .ev-desktop-pill-input::placeholder {
    color: var(--text-muted);
  }

  .ev-desktop-pill-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.10);
    color: var(--text-muted);
    font-size: 9px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
  }

  .ev-desktop-pill-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
  }

  /* ── Dropdown card (fixed, below topbar) ── */
  .ev-desktop-pill-dropdown {
    position: fixed;
    top: calc(var(--ev-desktop-topnav-h) + 8px);
    /* align to right edge of topbar-right area */
    right: 8px;
    width: 360px;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 16px 56px rgba(0, 0, 0, 0.6);
    max-height: 62vh;
    overflow-y: auto;
    z-index: 3000;
  }

  /* Lang toggle already in topbar-right — show it */
  .topbar .lang-toggle-btn {
    display: flex !important;
  }

  /* Hide user display name — avatar is enough */
  .topbar .user-name {
    display: none;
  }

  /* Make user-menu show inside topbar */
  .topbar .user-menu {
    display: flex !important;
  }

  /* ═══════════════════════════════════════════════════════
     HIDE MOBILE CHROME
     ═══════════════════════════════════════════════════════ */
  .ev-bottom-nav,
  .ev-fab,
  .ev-lang-pill,
  .sidebar,
  .sidebar-overlay,
  .hp-hero-search,           /* redundant on desktop — topbar has search button */
  .hp-hero-search-icon-btn { /* dashboard hero's inline search icon — also redundant */
    display: none !important;
  }

  /* ═══════════════════════════════════════════════════════
     MAIN LAYOUT
     ═══════════════════════════════════════════════════════ */

  /* ev theme sets margin-left:0 and margin-top:0 — we need to restore top margin */
  [data-theme="ev"] .main-wrapper {
    margin-left: 0;
  }

  [data-theme="ev"] .main-content {
    margin-top: var(--ev-desktop-topnav-h);
    padding: 32px 24px 80px;
    max-width: var(--ev-desktop-max);
    margin-left: auto;
    margin-right: auto;
    min-width: 0;
  }

  /* ═══════════════════════════════════════════════════════
     DASHBOARD PAGE
     ═══════════════════════════════════════════════════════ */

  /* Hero: push below topbar on both dashboard and events */
  body.page-dashboard .hp-hero,
  body.page-events    .hp-hero {
    top: var(--ev-desktop-topnav-h) !important;
  }

  /* ── Desktop: collapse hero branding on dashboard + events — ticker+pills only ── */
  body.page-dashboard .hp-hero-title-row,
  body.page-dashboard .hp-hero-sub,
  body.page-events    .hp-hero-title-row,
  body.page-events    .hp-hero-sub {
    display: none !important;
  }

  /* Hero becomes a flat nav-extension strip — no rounded corners, locked padding
     (!important beats .hp-hero--compact so the strip never shrinks on scroll) */
  body.page-dashboard .hp-hero,
  body.page-events    .hp-hero {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
    border-radius: 0;
  }

  /* Lock content offset at 100px — overrides JS inline style from _measureHero() */
  body.page-dashboard #hp-root {
    margin-top: 100px !important;
  }

  /* Dashboard main-content: no extra padding, hero manages its own spacing */
  body.page-dashboard [data-theme="ev"] .main-content,
  body.page-dashboard .main-content {
    padding: 0;
    max-width: 100%;
  }

  /* Admin panel: full width, no side padding — shell manages its own layout */
  body.page-admin [data-theme="ev"] .main-content,
  body.page-admin .main-content {
    padding: 0;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  /* ═══════════════════════════════════════════════════════
     EVENTS PAGE
     ═══════════════════════════════════════════════════════ */

  /* Two-column time-group layout at 1024px */
  #events-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 32px;
    align-items: start;
  }

  /* Each time-group is a self-contained column block */
  .ev-timegroup {
    break-inside: avoid;
  }

  /* ── 3-col at wide desktop ── */
  /* (covered in 1440px block below) */

  /* Events page: full-width layout, no centering constraints */
  body.page-events [data-theme="ev"] .main-content,
  body.page-events .main-content {
    padding: 0;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  /* Ctrl bar: mobile-only — hidden on desktop (hero provides filtering via segment pills) */
  body.page-events .ev-ctrl-bar {
    display: none !important;
  }

  /* Desktop toolbar: view toggle + create button above the date pills */
  .ev-desktop-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 28px 4px;
  }

  /* Events container: CSS var --hp-hero-full is set by _measureHero(); JS also updates
     inline style on scroll. The CSS var ensures correct offset even before JS fires. */
  body.page-events .ev-page-content {
    padding-top: var(--hp-hero-full, 200px);
    padding-left: 0;
    padding-right: 0;
  }

  body.page-events #panel-events-list {
    padding: 12px 28px 48px;
  }

  /* Date pills: align with events list */
  body.page-events .ev-date-pills {
    padding: 6px 28px 2px;
  }

  /* Hide the notification bell — notifications live in the user dropdown on desktop */
  .topbar .notification-wrapper {
    display: none !important;
  }

  /* ═══════════════════════════════════════════════════════
     MAP PAGE
     ═══════════════════════════════════════════════════════ */

  /* Map page: full height below the topbar */
  body.page-map [data-theme="ev"] .main-content,
  body.page-map .main-content {
    padding: 0;
    max-width: 100%;
    margin-top: var(--ev-desktop-topnav-h);
  }

  /* Fix: use position:fixed to avoid any parent layout interference */
  #page-map .ev-map-fullscreen {
    position: fixed !important;
    top: var(--ev-desktop-topnav-h) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: auto !important;   /* override any JS-set height */
    margin-top: 0 !important;
  }

  /* ═══════════════════════════════════════════════════════
     CREATE EVENT PAGE
     ═══════════════════════════════════════════════════════ */

  /* Hide the mobile create-nav — topbar takes over */
  body.page-create-event .ev-create-nav {
    display: none !important;
  }

  /* Desktop back button for create-event page */
  .ev-desktop-create-back {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    background: none;
    color: var(--accent-color, #FF5C35);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s;
  }

  .ev-desktop-create-back:hover {
    opacity: 0.75;
  }

  /* Restore content offset */
  body.page-create-event [data-theme="ev"] .main-content,
  body.page-create-event .main-content {
    margin-top: var(--ev-desktop-topnav-h);
    padding: 0;
    max-width: 100%;
  }

  /* Cover hero: cap height on wide screens */
  body.page-create-event .ev-create-cover-hero {
    max-height: 300px;
  }

  /* Form body: 2-column grid (text fields left, map right) */
  .ev-create-form-body {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 0 32px;
    align-items: start;
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 24px 80px;
  }

  /* General info section → spans both columns */
  .ev-create-form-body > .form-section:nth-child(1) {
    grid-column: 1 / -1;
  }

  /* Date & time → left column */
  .ev-create-form-body > .form-section:nth-child(2) {
    grid-column: 1;
  }

  /* Location (venue + address + map) → right column, sticky */
  .ev-create-form-body > .form-section:nth-child(3) {
    grid-column: 2;
    grid-row: 2 / 8;
    position: sticky;
    top: calc(var(--ev-desktop-topnav-h) + 16px);
  }

  /* Price & details → left column */
  .ev-create-form-body > .form-section:nth-child(4) {
    grid-column: 1;
  }

  /* Tags section → left column */
  .ev-create-form-body > #evt-tags-section {
    grid-column: 1;
  }

  /* Private event toggle → left column */
  .ev-create-form-body > .private-event-toggle {
    grid-column: 1;
  }

  /* Submit button section → left column */
  .ev-create-form-body > .form-section:last-child {
    grid-column: 1;
  }

  /* Hide sticky submit bar — use in-form button */
  .ev-create-submit-bar {
    display: none !important;
  }

  /* ═══════════════════════════════════════════════════════
     SEARCH MODAL — centered card instead of full-screen
     ═══════════════════════════════════════════════════════ */

  /* Not open → completely removed from rendering. display:none beats any
     compositing/backdrop-filter artifact that persists at opacity:0. */
  .sp-overlay:not(.open) {
    display: none !important;
  }

  /* Open → dark backdrop, centered card layout */
  .sp-overlay.open {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
    background: rgba(0, 0, 0, 0.72) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    padding-top: calc(var(--ev-desktop-topnav-h) + 16px);
  }

  .sp-shell {
    max-width: 700px;
    width: 100%;
    max-height: 72vh;
    border-radius: 16px !important;
    overflow: hidden;
    box-shadow: 0 32px 96px rgba(0, 0, 0, 0.7);
    margin: 0 auto;
    /* Give the card its own background — overlay is now transparent */
    background: var(--background-color) !important;
    border: 1px solid var(--border-color);
    /* Override any full-screen styles */
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    height: auto;
    display: flex;
    flex-direction: column;
  }

  /* ── Mobile back arrow: hidden on desktop ── */
  .sp-back {
    display: none !important;
  }

  /* ── Desktop close button (× top-right of modal topbar) ── */
  .sp-close-desktop {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: none;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    margin-left: 8px;
  }

  .sp-close-desktop:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
  }

  /* sp-body needs to scroll within the capped shell */
  .sp-shell .sp-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
  }

  /* ── SEARCH OPEN ANIMATION — nav pills "push left" ── */

  /* Give the nav transition so the push feels smooth */
  .ev-desktop-nav {
    transition: max-width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                opacity   0.22s ease;
    overflow: hidden;
    max-width: 600px;
  }

  body.search-open .ev-desktop-nav {
    max-width: 0;
    opacity: 0;
    pointer-events: none;
  }

  /* Brand compresses slightly too */
  .ev-desktop-brand {
    transition: opacity 0.22s ease;
  }

  body.search-open .ev-desktop-brand {
    opacity: 0.45;
  }

  /* (search-btn active state removed — button is hidden when pill is open) */

  /* ═══════════════════════════════════════════════════════
     CE SOIR MODAL — show nav arrows on desktop
     ═══════════════════════════════════════════════════════ */

  .ev-cesoir-arrow {
    display: flex !important;
  }

  /* ═══════════════════════════════════════════════════════
     PROFILE PAGE
     ═══════════════════════════════════════════════════════ */

  #page-profile {
    max-width: 900px;
    margin: 0 auto;
    padding-bottom: 48px;
  }

  /* ═══════════════════════════════════════════════════════
     SETTINGS PAGE
     ═══════════════════════════════════════════════════════ */

  #page-settings .section-card {
    max-width: 780px;
    margin: 0 auto;
  }

  /* ═══════════════════════════════════════════════════════
     MODALS — ensure they center on wide screens
     ═══════════════════════════════════════════════════════ */

  .modal-overlay {
    align-items: center;
  }

  /* ═══════════════════════════════════════════════════════
     USER DROPDOWN — sections with RSVP + notification previews
     ═══════════════════════════════════════════════════════ */

  #user-menu .user-dropdown {
    min-width: 300px;
    padding: 6px 0;
  }

  /* Preview sections (RSVPs / Notifications) */
  .dropdown-section {
    padding: 10px 14px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
  }

  .dropdown-section-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted, rgba(255,255,255,0.45));
    margin-bottom: 7px;
  }

  .dropdown-section-title i {
    width: 13px;
    text-align: center;
  }

  .dropdown-preview-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .dropdown-preview-item {
    padding: 5px 8px;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.12s;
  }

  .dropdown-preview-item:hover {
    background: rgba(255,255,255,0.06);
  }

  .dropdown-preview-item-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
  }

  .dropdown-preview-item-sub {
    font-size: 11px;
    color: var(--text-muted, rgba(255,255,255,0.45));
    margin-top: 1px;
  }

  .dropdown-preview-empty {
    font-size: 12px;
    font-style: italic;
    color: var(--text-muted, rgba(255,255,255,0.35));
    padding: 2px 8px 4px;
  }

  .dropdown-section-footer {
    font-size: 12px;
    color: var(--primary-color, #FF5C35);
    padding: 6px 8px 2px;
    cursor: pointer;
    display: inline-block;
    transition: opacity 0.12s;
  }
  .dropdown-section-footer:hover { opacity: 0.75; }

  /* Red pulsing dot for pending admin items */
  .dropdown-admin-dot {
    margin-left: auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff3b30;
    flex-shrink: 0;
    animation: dropdown-admin-pulse 2s ease-in-out infinite;
  }

  @keyframes dropdown-admin-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
  }

}

/* Hide desktop-only elements on mobile */
@media (max-width: 1023px) {
  .ev-desktop-create-back,
  .sp-close-desktop {
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════════
   WIDE DESKTOP (≥ 1440px)
   ═══════════════════════════════════════════════════════════ */
@media (min-width: 1440px) {

  /* Events: 3 time-group columns */
  #events-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 0 40px;
  }

}

