/* ══════════════════════════════════════
   Bannu Market — market-page.css
   Dark App Theme — matches style.css & market.css tokens
   ══════════════════════════════════════ */

/* ══ Page Header Band ══ */
.market-hero {
    background: var(--bg-elevated, #162038);
    padding: 2.5rem 0 2rem;
    position: relative;
    overflow: hidden;
}

/* Dot pattern — matches style.css .pattern-bg */
.market-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 1px 1px, rgba(61,126,255,0.09) 1px, transparent 0);
    background-size: 24px 24px;
    pointer-events: none;
}

/* Accent bottom line — matches header::before in style.css */
.market-hero::after {
    content: '';
    display: block;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--accent-dim, #1A4FCC) 20%,
        var(--accent, #3D7EFF) 45%,
        var(--accent-bright, #6698FF) 50%,
        var(--accent, #3D7EFF) 55%,
        var(--accent-dim, #1A4FCC) 80%,
        transparent
    );
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

/* Ambient glow from top-left */
.market-hero-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.market-hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 800;
    color: var(--text-primary, #EFF4FF);
    margin: 0 0 0.3rem;
    letter-spacing: -0.025em;
}

.market-hero p {
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: var(--text-muted, #6B7A9A);
    margin: 0;
    max-width: 46ch;
}

/* Sell button — WhatsApp green, matches market.css */
.sell-hero-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #16a34a;
    color: #fff;
    padding: 0.75rem 1.4rem;
    border-radius: var(--radius-md, 14px);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid rgba(34,197,94,0.32);
    cursor: pointer;
    transition: background 0.2s, transform 0.15s var(--ease), box-shadow 0.2s;
    box-shadow: 0 4px 18px rgba(22,163,74,0.32);
    white-space: nowrap;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.sell-hero-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}

.sell-hero-btn:hover {
    background: #15803d;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(22,163,74,0.44);
}

.sell-hero-btn:hover::before { opacity: 1; }

/* ══ Filter Bar ══ */
.filter-bar {
    background: var(--bg-surface, #0F1629);
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.07));
    padding: 14px 0;
    position: sticky;
    top: 64px;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.filter-bar-inner {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-bar select,
.filter-bar input[type="text"] {
    font-family: var(--font-body);
    font-size: 0.85rem;
    padding: 9px 12px;
    border: 1.5px solid var(--border-strong, rgba(255,255,255,0.13));
    border-radius: 100px;
    background: var(--bg-elevated, #162038);
    color: var(--text-primary, #EFF4FF);
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    height: 40px;
}

.filter-bar input[type="text"] {
    flex: 1;
    min-width: 180px;
}

.filter-bar input[type="text"]::placeholder {
    color: var(--text-disabled, #3D4A63);
}

.filter-bar select:focus,
.filter-bar input[type="text"]:focus {
    outline: none;
    border-color: var(--accent, #3D7EFF);
    box-shadow: 0 0 0 4px rgba(61,126,255,0.16);
}

.filter-count {
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--text-muted, #6B7A9A);
    white-space: nowrap;
    margin-left: auto;
}

/* ══ Market Content ══ */
.market-content {
    padding: 1.5rem 0 4rem;
}

/* ══ Sell FAB (mobile) ══ */
.sell-fab {
    position: fixed;
    bottom: 24px;
    right: 20px;
    z-index: 998;
    background: var(--accent, #3D7EFF);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 0.8rem 1.3rem;
    font-size: 0.88rem;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    box-shadow: var(--shadow-accent, 0 0 24px rgba(61,126,255,0.35)),
                var(--shadow-md, 0 4px 22px rgba(0,0,0,0.55));
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s;
    text-decoration: none;
    border: 1px solid var(--border-accent, rgba(61,126,255,0.4));
}

.sell-fab:hover {
    background: var(--accent-bright, #6698FF);
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(61,126,255,0.5);
}

@media (min-width: 768px) {
    .sell-fab { display: none; }
}

/* ══ Lightbox ══ */
#image-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(4,7,14,0.97);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 1rem;
}

#image-lightbox.lb-open {
    display: flex !important;
}

#lightbox-img {
    max-width: 93vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-md, 14px);
    border: 1px solid var(--border-strong, rgba(255,255,255,0.1));
    box-shadow: 0 8px 48px rgba(0,0,0,0.85),
                var(--shadow-glow, 0 0 48px rgba(61,126,255,0.08));
    display: block;
}

#lightbox-close-btn {
    position: fixed;
    top: 16px;
    right: 20px;
    color: var(--text-primary, #EFF4FF);
    font-size: 1.2rem;
    cursor: pointer;
    background: var(--bg-elevated, #162038);
    border: 1px solid var(--border-strong, rgba(255,255,255,0.13));
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: background 0.2s var(--ease), border-color 0.2s;
}

#lightbox-close-btn:hover {
    background: var(--accent-subtle, rgba(61,126,255,0.18));
    border-color: var(--border-accent, rgba(61,126,255,0.4));
}

#lightbox-counter {
    color: var(--text-muted, #6B7A9A);
    font-family: var(--font-body);
    font-size: 0.8rem;
    margin-top: 0.6rem;
    letter-spacing: 0.04em;
}

.lightbox-prev,
.lightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-elevated, #162038);
    border: 1px solid var(--border-strong, rgba(255,255,255,0.13));
    color: var(--text-primary, #EFF4FF);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10001;
    transition: background 0.2s var(--ease), border-color 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-prev { left: 14px; }
.lightbox-next { right: 14px; }

.lightbox-prev:hover,
.lightbox-next:hover {
    background: var(--accent-subtle, rgba(61,126,255,0.18));
    border-color: var(--border-accent, rgba(61,126,255,0.4));
    box-shadow: var(--shadow-accent, 0 0 24px rgba(61,126,255,0.35));
}

/* ══ Sell Form Section ══ */
.sell-section {
    background: var(--bg-card, #111827);
    border-radius: var(--radius-lg, 20px);
    border: 1px solid var(--border, rgba(255,255,255,0.07));
    border-top: 3px solid var(--accent, #3D7EFF);
    box-shadow: var(--shadow-md, 0 4px 22px rgba(0,0,0,0.55));
    padding: clamp(1.25rem, 4vw, 2.25rem);
    margin-top: 3rem;
    position: relative;
    overflow: hidden;
    transition: border-color 0.25s var(--ease), box-shadow 0.25s;
}

/* Top-edge glow — consistent .card pattern */
.sell-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent, #3D7EFF), transparent);
    opacity: 0.6;
}

.sell-section:hover {
    border-color: var(--border-accent, rgba(61,126,255,0.32));
    box-shadow: var(--shadow-lg, 0 14px 44px rgba(0,0,0,0.65)),
                var(--shadow-glow, 0 0 48px rgba(61,126,255,0.1));
}

.sell-section h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.2rem, 3vw, 1.6rem);
    color: var(--text-primary, #EFF4FF);
    font-weight: 800;
    margin-bottom: 0.4rem;
    letter-spacing: -0.025em;
}

.sell-section > p {
    color: var(--text-muted, #6B7A9A);
    font-family: var(--font-body);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* Form grid */
.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

/* ══ Section Divider ══ */
.section-divider {
    border: none;
    border-top: 1px solid var(--border, rgba(255,255,255,0.07));
    margin: 2.5rem 0;
}

/* ══ Loading state ══ */
#market-container .loading {
    padding: 4rem 1rem;
}

/* ══ Responsive filter bar ══ */
@media (max-width: 600px) {
    .filter-bar {
        padding: 10px 0;
        top: 52px;
    }

    .filter-bar-inner {
        gap: 7px;
        flex-wrap: wrap;
    }

    .filter-bar input[type="text"] {
        order: -1;
        width: 100%;
        min-width: 0;
        font-size: 0.83rem;
        height: 38px;
        padding: 8px 11px;
        border-radius: var(--radius-md, 14px);
    }

    .filter-bar select {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
        font-size: 0.8rem;
        height: 38px;
        padding: 8px 10px;
        border-radius: var(--radius-md, 14px);
    }

    .filter-count { display: none; }

    /* Market hero — compact */
    .market-hero {
        padding: 1.25rem 0;
    }

    .market-hero h1 {
        font-size: 1.35rem;
        margin-bottom: 0.2rem;
    }

    .market-hero p {
        font-size: 0.82rem;
    }

    .market-hero-inner {
        gap: 1rem;
    }

    .sell-hero-btn {
        width: 100%;
        justify-content: center;
        padding: 0.7rem 1rem;
        font-size: 0.88rem;
        border-radius: var(--radius-md, 14px);
    }

    .sell-section {
        padding: 1.1rem;
        border-radius: var(--radius-md, 14px);
        margin-top: 1.5rem;
    }

    .sell-section h2 { font-size: 1.15rem; }
    .sell-section > p { font-size: 0.84rem; margin-bottom: 1.1rem; }

    .form-grid-2 {
        grid-template-columns: 1fr;
        gap: 0.9rem;
        margin-bottom: 0.9rem;
    }

    .sell-section .btn,
    .sell-section .btn-secondary {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .sell-fab {
        bottom: 18px;
        right: 14px;
        padding: 0.75rem 1.1rem;
        font-size: 0.84rem;
    }

    .market-content {
        padding: 1rem 0 3rem;
    }
}

/* ══ Focus visible ══ */
.sell-hero-btn:focus-visible,
.sell-fab:focus-visible,
#lightbox-close-btn:focus-visible,
.lightbox-prev:focus-visible,
.lightbox-next:focus-visible,
.filter-bar select:focus-visible,
.filter-bar input[type="text"]:focus-visible {
    outline: 2px solid var(--accent, #3D7EFF);
    outline-offset: 3px;
}

/* ══ Reduced motion ══ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
    }
}