/* ============================================================
   AuctionAtlas — Mobile App Experience
   Dark theme. Premium. Applies to screens ≤ 768px only.
   Desktop layout is completely unchanged.
   ============================================================ */

/* Desktop: hide mobile-only elements */
.mobile-only { display: none !important; }
#mobile-nav-drawer { display: none; }
#mobile-nav-overlay { display: none; }
.mobile-bottom-nav { display: none; }
.mobile-fab { display: none; }
.mobile-top-bar { display: none; }

/* ============================================================
   MOBILE BREAKPOINT — everything below is mobile only
   ============================================================ */
@media screen and (max-width: 768px) {

/* ============================================================
   ROOT VARIABLES
   ============================================================ */
:root {
    --mob-pad: 18px;
    --mob-nav-h: 64px;
    --mob-header-h: 56px;
    --mob-radius: 16px;
}

/* ============================================================
   BASE — prevent overflow, safe bottom area
   ============================================================ */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

body {
    padding-bottom: calc(var(--mob-nav-h) + env(safe-area-inset-bottom, 0px)) !important;
}

/* ============================================================
   HIDE DESKTOP HEADER on mobile — we use mobile top bar instead
   ============================================================ */
.site-nav {
    display: none !important;
}

/* ============================================================
   MOBILE TOP BAR — sticky, dark, blurred
   ============================================================ */
.mobile-top-bar {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--mob-header-h);
    background: rgba(8, 12, 24, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    z-index: 200;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--mob-pad);
}

.mobile-top-bar .mobile-logo img {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.mobile-menu-btn,
.mobile-search-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn svg,
.mobile-search-btn svg {
    width: 18px;
    height: 18px;
    stroke: #94a3c4;
}

.mobile-menu-btn:active,
.mobile-search-btn:active {
    background: rgba(59,130,246,0.15);
    transform: scale(0.94);
}

/* Push page content below top bar */
body > *:not(.site-nav):not(.mobile-top-bar):not(#mobile-nav-drawer):not(#mobile-nav-overlay) {
    padding-top: var(--mob-header-h);
}

/* More targeted: push first section down */
main > section:first-child,
section:first-of-type,
body > section:first-of-type {
    padding-top: calc(var(--mob-header-h) + 24px) !important;
}

/* ============================================================
   NAV DRAWER OVERLAY
   ============================================================ */
#mobile-nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 300;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ============================================================
   NAV DRAWER — slides in from left
   ============================================================ */
#mobile-nav-drawer {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 82vw;
    max-width: 320px;
    background: #0f1623;
    border-right: 1px solid rgba(255,255,255,0.08);
    z-index: 400;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-overflow-scrolling: touch;
}

#mobile-nav-drawer.open {
    transform: translateX(0);
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px var(--mob-pad) 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.mobile-drawer-header img {
    height: 28px;
    width: auto;
}

.mobile-drawer-close {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: rgba(255,255,255,0.07);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.mobile-drawer-close svg {
    stroke: #94a3c4;
}

.mobile-drawer-close:active {
    background: rgba(255,255,255,0.12);
    transform: scale(0.94);
}

.mobile-drawer-nav {
    padding: 8px 0 32px;
}

.mobile-drawer-section-label {
    font-size: 0.62rem;
    font-weight: 700;
    color: #4a5a7a;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 16px var(--mob-pad) 6px;
}

.mobile-drawer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px var(--mob-pad);
    font-size: 0.9rem;
    font-weight: 500;
    color: #94a3c4;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, color 0.15s;
}

.mobile-drawer-item:active {
    background: rgba(59,130,246,0.1);
    color: #f0f4ff;
}

.mobile-drawer-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mobile-drawer-icon svg {
    stroke: #546180;
}

.mobile-drawer-sell-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 20px var(--mob-pad) 0;
    padding: 14px 20px;
    background: #f59e0b;
    color: #1f1500;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.mobile-drawer-sell-btn:active {
    background: #fbbf24;
    transform: scale(0.98);
}

/* ============================================================
   BOTTOM TAB BAR
   ============================================================ */
.mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mob-nav-h);
    background: rgba(10, 14, 26, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,0.07);
    z-index: 200;
    align-items: center;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-bottom-nav a.nav-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    text-decoration: none;
    color: #4a5a7a;
    font-size: 10px;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s;
}

.mobile-bottom-nav a.nav-link svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mobile-bottom-nav a.nav-link:active {
    color: #3b82f6;
    transform: scale(0.92);
}

.mobile-bottom-nav a.nav-link.active,
.mobile-bottom-nav a.nav-link[href="/"] {
    color: #3b82f6;
}

/* Floating "Sell" action button */
.mobile-fab {
    display: flex !important;
    position: fixed;
    bottom: calc(var(--mob-nav-h) + 12px);
    right: 18px;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: #f59e0b;
    align-items: center;
    justify-content: center;
    z-index: 199;
    box-shadow: 0 4px 20px rgba(245,158,11,0.4);
    -webkit-tap-highlight-color: transparent;
}

.mobile-fab svg {
    width: 22px;
    height: 22px;
    stroke: #1f1500;
    stroke-width: 2.5;
}

.mobile-fab:active {
    transform: scale(0.93);
    box-shadow: 0 2px 12px rgba(245,158,11,0.3);
}

/* ============================================================
   SECTION PADDING — consistent breathing room
   ============================================================ */
section {
    padding-left: var(--mob-pad) !important;
    padding-right: var(--mob-pad) !important;
}

/* ============================================================
   HERO SECTION — single column, full width
   ============================================================ */
section:first-of-type > div,
section > div[style*="grid-template-columns:1fr 420px"],
section > div[style*="grid-template-columns: 1fr 420px"] {
    display: block !important;
    grid-template-columns: 1fr !important;
}

/* Hero stat grid — 2 columns on mobile */
section div[style*="grid-template-columns:1fr 1fr"],
section div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    margin-top: 24px;
}

/* Stat card values — slightly smaller on mobile */
.stat-card .stat-value {
    font-size: 1.6rem !important;
}

/* ============================================================
   TRUST BAND — wrap on mobile
   ============================================================ */
div[style*="display:flex"][style*="gap:48px"],
div[style*="gap: 48px"] {
    gap: 16px !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
}

/* ============================================================
   CATEGORY GRID — 2×3 on mobile instead of 1×6
   ============================================================ */
div[style*="grid-template-columns:repeat(6"],
div[style*="grid-template-columns: repeat(6"] {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
}

/* ============================================================
   SELL SNIPPET — full width, single column
   ============================================================ */
div[style*="grid-template-columns:1fr auto"],
div[style*="grid-template-columns: 1fr auto"] {
    display: block !important;
    padding: 28px var(--mob-pad) !important;
}

/* Hide right-side feature boxes on mobile (shown in main content instead) */
div[style*="grid-template-columns:1fr auto"] > div:last-child,
div[style*="grid-template-columns: 1fr auto"] > div:last-child {
    display: none !important;
}

/* Sell snippet CTAs — stack vertically */
div[style*="grid-template-columns:1fr auto"] .btn-sell,
div[style*="grid-template-columns:1fr auto"] a[href="/sell"],
div[style*="grid-template-columns:1fr auto"] a[href="/sell#seller-guides"] {
    display: flex !important;
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    margin-bottom: 10px !important;
}

/* Sell stats row — wrap nicely */
div[style*="gap:20px"][style*="flex-wrap:wrap"],
div[style*="gap: 20px"] {
    gap: 12px !important;
    flex-wrap: wrap !important;
}

/* ============================================================
   MAP + TOOLS SECTION — single column
   ============================================================ */
section > div[style*="grid-template-columns:1fr 380px"],
section > div[style*="grid-template-columns: 1fr 380px"] {
    display: block !important;
    grid-template-columns: 1fr !important;
}

/* Hide map on mobile — too small to be useful */
div[style*="grid-template-columns:1fr 380px"] > div:first-child {
    display: none !important;
}

/* Tools list — full width on mobile */
div[style*="grid-template-columns:1fr 380px"] > div:last-child {
    width: 100% !important;
}

/* ============================================================
   CARDS — better mobile sizing
   ============================================================ */
.card, .glass-card, .stat-card {
    border-radius: var(--mob-radius) !important;
}

.card:hover,
.glass-card:hover,
.auction-card:hover {
    transform: none !important;
}

/* Tool cards in platform tools section */
a.card.card-sm {
    padding: 14px !important;
}

/* ============================================================
   BUTTONS — full width on mobile where appropriate
   ============================================================ */
.btn {
    min-height: 46px !important;
    font-size: 0.875rem !important;
}

/* Hero CTA buttons */
section div[style*="display:flex"][style*="gap:12px"] .btn,
section div[style*="display:flex"][style*="gap:12px"] a.btn {
    flex: 1 !important;
    justify-content: center !important;
    min-width: 0 !important;
}

/* ============================================================
   CALENDAR SECTION — single column, no overflow
   ============================================================ */
#aa-calendar {
    border-radius: 12px !important;
    overflow: hidden !important;
}

/* Calendar day cells — smaller min height on mobile */
#aa-grid > div {
    min-height: 60px !important;
    padding: 4px 3px !important;
}

/* Category filter pills — scroll horizontally */
#aa-cat-filters {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding-bottom: 4px !important;
}

#aa-cat-filters::-webkit-scrollbar {
    display: none;
}

#aa-date-filters {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
}

#aa-date-filters::-webkit-scrollbar {
    display: none;
}

/* Calendar legend — wrap on mobile */
#aa-legend {
    gap: 8px !important;
    flex-wrap: wrap !important;
}

/* ============================================================
   DIRECTORY PAGE — full width cards
   ============================================================ */
/* Directory grid — single column */
.grid.grid-cols-1.md\:grid-cols-2,
.grid.md\:grid-cols-3 {
    grid-template-columns: 1fr !important;
}

/* Directory sidebar + results layout */
div[style*="grid-template-columns:240px 1fr"],
div[style*="grid-template-columns: 240px 1fr"] {
    display: block !important;
}

/* Filter sidebar — full width, collapsed by default on mobile */
div[style*="grid-template-columns:240px 1fr"] > div:first-child {
    width: 100% !important;
    margin-bottom: 16px;
    position: static !important;
}

/* ============================================================
   SELL PAGE (sell.php) — single column
   ============================================================ */
/* Seller card metrics — 2-col grid on mobile */
div[style*="grid-template-columns:repeat(4,1fr)"],
div[style*="grid-template-columns: repeat(4,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
}

/* ============================================================
   PROFILE PAGE — full width
   ============================================================ */
div[style*="grid-template-columns:1fr 320px"],
div[style*="grid-template-columns: 1 fr 320px"],
div[style*="grid-template-columns:2fr 1fr"],
div[style*="grid-template-columns: 2fr 1fr"] {
    display: block !important;
    grid-template-columns: 1fr !important;
}

/* ============================================================
   COMPARE PAGE — horizontal scroll
   ============================================================ */
.table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

/* ============================================================
   FOOTER — hide on mobile (we use bottom nav instead)
   ============================================================ */
.site-footer {
    display: none !important;
}

/* ============================================================
   LOGO CONTAINERS
   ============================================================ */
.logo-container {
    height: 60px !important;
}

/* ============================================================
   CTA BAND
   ============================================================ */
div[style*="background:var(--accent-subtle)"] {
    padding: 40px var(--mob-pad) !important;
    text-align: center;
}

div[style*="background:var(--accent-subtle)"] h2 {
    font-size: 1.5rem !important;
}

div[style*="background:var(--accent-subtle)"] > div[style*="display:flex"] {
    flex-direction: column !important;
    gap: 10px !important;
}

div[style*="background:var(--accent-subtle)"] > div[style*="display:flex"] a {
    width: 100% !important;
    justify-content: center !important;
}

/* ============================================================
   GENERAL overflow protection
   ============================================================ */
* {
    max-width: 100%;
}

img {
    max-width: 100%;
    height: auto;
}

/* Remove any fixed px widths that could overflow */
[style*="min-width:"] {
    min-width: 0 !important;
}

} /* end @media screen and (max-width: 768px) */