/* =======================================================
   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: 26px;
    height: 26px;
    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;
  }

  /* 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;
  }

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

  /* 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 {
    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 (.hp-hero) is position:fixed, top:0, z-index:800 — push it below the topbar */
  body.page-dashboard .hp-hero,
  body.page-events    .hp-hero {
    top: var(--ev-desktop-topnav-h) !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%;
  }

  /* ═══════════════════════════════════════════════════════
     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) */

  /* Ctrl bar: slightly more spacious */
  .ev-ctrl-bar {
    max-width: var(--ev-desktop-max);
    margin-left: auto;
    margin-right: auto;
  }

  /* ═══════════════════════════════════════════════════════
     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); /* standard topbar offset */
  }

  #page-map .ev-map-fullscreen {
    height: calc(100vh - var(--ev-desktop-topnav-h));
    margin-top: 0;
  }

  /* ═══════════════════════════════════════════════════════
     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
     ═══════════════════════════════════════════════════════ */

  .sp-overlay {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
    background: rgba(0, 0, 0, 0.6) !important;
    padding-top: 8vh;
  }

  .sp-shell {
    max-width: 760px;
    width: 100%;
    max-height: 78vh;
    border-radius: 16px !important;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    margin: 0 auto;
    /* Override any full-screen styles */
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    height: auto;
  }

  /* ═══════════════════════════════════════════════════════
     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;
  }

}

/* Hide desktop-only elements that live outside the topbar on mobile */
@media (max-width: 1023px) {
  .ev-desktop-create-back {
    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;
  }

}
