/* public/css/app.css
 *
 * Design language: "dark autumn" colour typing + "Natural/Relaxed" style
 * typing, drawn directly from Christina's own wardrobe colour analysis
 * rather than a generic dark-mode template. Deep warm charcoal-brown
 * background (not near-black — near-black reads sleek/cold, which works
 * against "warm and earthed"). Antique gold as the primary accent,
 * mirroring the 8ct/14ct gold jewellery family that recurs throughout the
 * catalogue. Burgundy and deep teal as secondary interactive accents.
 * Organic, slightly irregular serif for headings (Natural/Relaxed argues
 * against rigid geometric sans); clean humanist sans for body/UI text.
 */

:root {
    --bg-base:           #1c1410;   /* deep warm charcoal-brown, not black */
    --bg-surface:        #261c16;   /* cards, panels */
    --bg-surface-raised: #2f2319;   /* sticky bars, hover states */
    --bg-pill:           #2a1f18;
    --bg-pill-active:    #3d2c1a;

    --border-subtle:     #3a2c20;
    --border-strong:     #4a3826;

    --text-primary:      #f0e6d8;   /* warm cream, not stark white */
    --text-secondary:    #b8a890;
    --text-tertiary:     #8a7a64;

    --accent-gold:       #c9a35c;   /* antique gold — primary accent */
    --accent-gold-bright: #e0bc7a;
    --accent-burgundy:   #8b3a42;
    --accent-teal:       #2f6b5e;

    --score-badge-bg:    #3d2c14;
    --score-badge-text:  #e0bc7a;
    --score-badge-border:#6b5128;

    --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
    --font-body: 'Inter', -apple-system, 'Segoe UI', sans-serif;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-pill: 999px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* ---------------------------------------------------------------------
   Top navigation: main category pills (sticky, always visible)
   --------------------------------------------------------------------- */

.nav-categories {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--bg-base);
    padding: 0.85rem 1rem 0.6rem;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border-subtle);
}
.nav-categories::-webkit-scrollbar { display: none; }

.nav-categories .pill {
    flex: 0 0 auto;
    padding: 0.3rem 0.1rem;
    background: none;
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.88rem;
    font-family: var(--font-body);
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
    margin-right: 1.1rem;
    display: inline-flex;
    align-items: center;
}
.nav-categories .pill:hover { color: var(--text-primary); }
.nav-categories .pill.active {
    color: var(--accent-gold-bright);
    border-bottom-color: var(--accent-gold);
}
.nav-categories .favourite-pill svg { display: block; }

/* ---------------------------------------------------------------------
   Subcategory pills (sticky just below the main row, only when visible)
   --------------------------------------------------------------------- */

.nav-subcategories {
    position: sticky;
    top: 56px; /* sits directly under nav-categories */
    z-index: 29;
    background: var(--bg-base);
    padding: 0.5rem 1rem 0.6rem;
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border-subtle);
}
.nav-subcategories::-webkit-scrollbar { display: none; }
.nav-subcategories.hidden { display: none; }

.pill.sub {
    flex: 0 0 auto;
    font-size: 0.78rem;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.pill.sub:hover { color: var(--text-primary); border-color: var(--border-strong); }
.pill.sub.active {
    background: var(--bg-pill);
    color: var(--accent-gold);
    border-color: var(--accent-gold);
}

/* ---------------------------------------------------------------------
   Toolbar row: sort / filter / ask (left) + item count (right).
   NOT sticky — it hides on scroll-down, reappears on scroll-up.
   --------------------------------------------------------------------- */

.toolbar {
    position: sticky;
    top: 56px;
    z-index: 28;
    background: var(--bg-base);
    padding: 0.5rem 1rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: transform 0.22s ease, opacity 0.22s ease;
}
.toolbar.toolbar-with-subcats { top: 104px; }
.toolbar.scroll-hidden {
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
}
.toolbar-btn:hover { color: var(--text-primary); border-color: var(--border-strong); }
.toolbar-btn.ask-btn {
    background: var(--bg-pill-active);
    color: var(--accent-gold-bright);
    border-color: var(--border-strong);
}

.item-count {
    margin-left: auto;
    font-size: 0.78rem;
    color: var(--text-tertiary);
    white-space: nowrap;
}

/* ---------------------------------------------------------------------
   Item grid + cards
   --------------------------------------------------------------------- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.9rem;
    padding: 0.5rem 1rem 3rem;
}

.item-card {
    cursor: pointer;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.item-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
}

.item-photo-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    background: var(--bg-pill);
    overflow: hidden;
}
.item-photo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.item-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    text-align: center;
    padding: 0.5rem;
}

.score-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--accent-gold-bright);
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.score-badge.zero-score {
    color: rgba(240, 230, 216, 0.75);
    font-size: 0.85rem;
}
.score-badge.no-score {
    color: rgba(240, 230, 216, 0.55);
    font-size: 0.85rem;
}

.favourite-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(240, 230, 216, 0.85);
    cursor: pointer;
    padding: 0;
}
.favourite-btn svg {
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.55));
}
.favourite-btn.active { color: var(--accent-gold-bright); }
.favourite-btn:not(.active) svg { fill: none; stroke: currentColor; stroke-width: 1.8; }

.item-meta {
    padding: 0.55rem 0.7rem 0.7rem;
}
.item-code {
    font-size: 0.68rem;
    color: var(--text-tertiary);
    letter-spacing: 0.03em;
}
.item-title {
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-top: 0.1rem;
    line-height: 1.3;
}

/* ---------------------------------------------------------------------
   Filter panel — desktop inline, mobile bottom sheet
   --------------------------------------------------------------------- */

.filter-panel {
    position: fixed;
    z-index: 50;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    display: none;
}
.filter-panel.open { display: block; }

@media (min-width: 769px) {
    .filter-panel {
        top: 150px;
        left: 0;
        right: 0;
        width: auto;
        max-height: 70vh;
        overflow-y: auto;
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 1.3rem 2rem;
    }
    .filter-panel .filter-tags { max-width: 1100px; }
    .filter-panel .filter-section-label { max-width: 1100px; }
}

@media (max-width: 768px) {
    .filter-panel {
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        padding: 1rem 1rem 1.5rem;
        max-height: 75vh;
        overflow-y: auto;
        transform: translateY(100%);
        transition: transform 0.25s ease;
    }
    .filter-panel.open { transform: translateY(0); }
}

.filter-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 7, 5, 0.55);
    z-index: 49;
    display: none;
}
.filter-overlay.open { display: block; }

.filter-section-label {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin: 1rem 0 0.45rem;
}
.filter-section-label:first-child { margin-top: 0; }

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.filter-tag {
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-pill);
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
}
.filter-tag.selected {
    background: var(--bg-pill-active);
    border-color: var(--accent-gold);
    color: var(--accent-gold-bright);
}

/* ---------------------------------------------------------------------
   Ask / chat drawer — slides in from the right
   --------------------------------------------------------------------- */

.chat-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 380px;
    max-width: 92vw;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-subtle);
    z-index: 60;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}
.chat-drawer.open { transform: translateX(0); }

.chat-drawer-header {
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.chat-drawer-close {
    color: var(--text-tertiary);
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1.1rem;
}

.chat-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 7, 5, 0.45);
    z-index: 59;
    display: none;
}
.chat-drawer-overlay.open { display: block; }
