@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #0b0f19;
    --bg-card: rgba(22, 31, 51, 0.75);
    --bg-card-hover: rgba(30, 42, 69, 0.85);
    --border-color: rgba(255, 255, 255, 0.1);
    --border-active: rgba(0, 242, 254, 0.5);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-cyan: #00f2fe;
    --accent-violet: #4facfe;
    --accent-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    --accent-glow: 0 0 20px rgba(0, 242, 254, 0.35);
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header & Navigation */
header {
    background: rgba(11, 15, 25, 0.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    gap: 1rem;
    list-style: none;
}

.nav-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.25s ease;
}

.nav-btn:hover, .nav-btn.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
}

.nav-btn.active {
    border-color: var(--accent-cyan);
    box-shadow: var(--accent-glow);
}

/* Main Container */
main {
    flex: 1;
    max-width: 1300px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 1.25rem;
}

.hero h1 {
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.hero p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Search Bar & Filters */
.search-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(12px);
}

.search-input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.search-input-group input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.85rem 1.2rem;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.search-input-group input:focus {
    border-color: var(--accent-cyan);
}

.btn-primary {
    background: var(--accent-cyan);
    border: none;
    color: #06202b;
    font-weight: 600;
    padding: 0.85rem 1.75rem;
    border-radius: 10px;
    cursor: pointer;
    transition: filter 0.15s ease;
}

.btn-primary:hover {
    filter: brightness(1.08);
}

.catalog-layout {
    display: grid;
    grid-template-columns: 230px 1fr;
    gap: 1.25rem;
    align-items: start;
}

/* A hidden panel is display:none, so it leaves the grid entirely and the product grid
   becomes the FIRST item - landing in the 230px sidebar column and collapsing to one
   card per row. Whenever there is no sidebar there is exactly one column. */
.catalog-layout.no-filters {
    grid-template-columns: 1fr;
}

/* Filters stack above the grid once there isn't room for a sidebar. */
@media (max-width: 860px) {
    .catalog-layout { grid-template-columns: 1fr; }
}

.filter-panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    position: sticky;
    top: 1rem;
}

.filter-panel[hidden] { display: none; }

.filter-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.9rem;
}

.filter-clear {
    background: none;
    border: none;
    color: var(--accent-cyan);
    cursor: pointer;
    font-size: 0.8rem;
}

.filter-group { margin-bottom: 0.9rem; }

.filter-group label {
    display: block;
    font-size: 0.75rem;
    text-transform: capitalize;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.filter-group select,
.filter-group input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.35rem 0.5rem;
    border-radius: 7px;
    font-size: 0.8rem;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

.filter-range {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-range span {
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.catalog-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.catalog-controls select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.4rem 0.7rem;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
}

.catalog-controls select:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

#result-count {
    margin-left: auto;
}

.category-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip:hover, .chip.active {
    background: var(--accent-cyan);
    color: #0b0f19;
    font-weight: 600;
    border-color: var(--accent-cyan);
}

/* Product Cards Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
    gap: 1rem;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s ease;
    backdrop-filter: blur(10px);
}

.product-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.22);
}

.product-img {
    width: 100%;
    height: 140px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    margin-bottom: 1rem;
}

.product-badge {
    align-self: flex-start;
    background: rgba(0, 242, 254, 0.15);
    color: var(--accent-cyan);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.product-title {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    line-height: 1.4;
    min-height: 2.4em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
}

.product-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.product-mrp {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: line-through;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-secondary {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--text-secondary);
}

/* PC Builder Section */
.builder-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.slots-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.slot-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: border-color 0.2s ease;
}

.slot-card:hover {
    border-color: var(--accent-cyan);
}

.slot-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slot-icon {
    width: 48px;
    height: 48px;
    background: rgba(0, 242, 254, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--accent-cyan);
}

.slot-title {
    font-weight: 600;
    font-size: 1.05rem;
}

.slot-selected-item {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Build Summary Sidebar */
.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    position: sticky;
    top: 100px;
}

.summary-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.compatibility-status {
    padding: 0.85rem;
    border-radius: 10px;
    font-weight: 600;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.compatibility-status.ok {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid var(--success);
}

.compatibility-status.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* Unverified: amber, distinct from green "passed" and red "problems" (FIT-02). */
.compatibility-status.unverified {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.warning-list {
    margin-bottom: 1.25rem;
}

.warning-item {
    font-size: 0.85rem;
    padding: 0.6rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    overflow-wrap: anywhere;

}

.warning-item.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);

}

.warning-item.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);

}

/* As prominent as a warning - never collapsed, hidden or smaller. */
.warning-item.unverified {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border-left: 3px dashed var(--warning);
}

/* Informational (a typical TDP was used): muted, same readable size. */
.warning-item.estimate {
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-secondary);
    border-left: 3px solid var(--text-secondary);
}

.total-cost {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-cyan);
    margin-top: 1rem;
}

/* Modal Styling */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.active {
    display: flex;
}

.modal {
    background: #111827;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.75rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Table Styling for Compare */
.compare-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.compare-table th, .compare-table td {
    padding: 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.compare-table th {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Price history ---------------------------------------------------------- */

.price-chart {
    width: 100%;
    height: auto;
    margin: 0.9rem 0 0.4rem;
    display: block;
}

.price-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 0.7rem 0;
}

.price-stats div {
    display: flex;
    flex-direction: column;
}

.price-stats span {
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.price-stats strong {
    color: var(--text-primary);
    font-size: 1.05rem;
}

.verdict {
    display: inline-block;
    font-size: 0.82rem;
    color: var(--text-secondary);
    border-left: 3px solid var(--border-color);
    padding-left: 0.6rem;
}

.verdict.good {
    color: var(--accent-cyan);
    border-left-color: var(--accent-cyan);
    font-weight: 600;
}

.chart-note {
    color: var(--text-secondary);
    font-size: 0.73rem;
    line-height: 1.5;
}

/* Non-sealed stock. Deliberately warning-coloured rather than decorative: these
   listings undercut sealed ones on price, so the label is the whole point. */
.condition-badge {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.12rem 0.5rem;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--warning);
    border: 1px solid var(--warning);
    background: rgba(245, 158, 11, 0.12);
    vertical-align: middle;
}

/* Stat bar --------------------------------------------------------------- */
/* Trust signals. Every figure is fetched from /products/stats, never written into
   the markup - hardcoded numbers are what make a tracker look fabricated, and they
   go stale the moment a retailer is added. */

.stat-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 2.25rem;
    justify-content: center;
    padding: 0.9rem 1.25rem;
    margin-bottom: 1.5rem;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.stat-bar[hidden] { display: none; }

.stat-bar div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
}

.stat-bar strong {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.stat-bar span {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Card detail ------------------------------------------------------------ */

.card-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

/* Which shop the price is from. A price with no retailer attached is the single
   biggest reason a comparison site reads as fake. */
.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    margin-bottom: 0.7rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.store-name {
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stock-dot {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.stock-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.stock-dot.in { color: var(--success); }
.stock-dot.out { color: var(--text-secondary); }

.product-save {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--success);
    margin-left: auto;
}

/* A broken image should read as "no photo", not as a snapped-image glyph, which is
   the most obviously unfinished thing a catalog can show. */
.img-missing {
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
}

.img-missing::after {
    content: 'No image';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.card-actions .btn-secondary {
    font-size: 0.75rem;
    padding: 0.45rem 0.3rem;
}

/* Component picker: model first, then store ------------------------------ */

.model-row {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
}

.model-head {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    font-size: 0.87rem;
}

.model-head:hover { background: rgba(255, 255, 255, 0.04); }

.model-name { flex: 1; font-weight: 600; }

.model-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.25;
    white-space: nowrap;
}

.model-price strong { font-size: 0.95rem; font-variant-numeric: tabular-nums; }

.model-price em {
    font-style: normal;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.model-caret { color: var(--text-secondary); font-size: 0.7rem; }

.model-head[aria-expanded="true"] .model-caret { transform: rotate(180deg); }

.model-offers {
    border-top: 1px solid var(--border-color);
    padding: 0.35rem 0.85rem 0.6rem;
}

.model-offers[hidden] { display: none; }

.offer-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0;
    font-size: 0.82rem;
}

.offer-row + .offer-row { border-top: 1px solid rgba(255, 255, 255, 0.05); }

.offer-store { flex: 1; color: var(--text-secondary); }

.offer-price {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}

.offer-best {
    font-style: normal;
    font-size: 0.66rem;
    color: var(--success);
    margin-left: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.offer-pick {
    padding: 0.3rem 0.85rem;
    font-size: 0.78rem;
    border-radius: 7px;
}

/* Footer ------------------------------------------------------------------ */

.site-footer {
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
    padding: 1.75rem 1.5rem 2.5rem;
    background: rgba(0, 0, 0, 0.2);
}

.footer-inner {
    max-width: 1300px;
    margin: 0 auto;
}

.site-footer h2 {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.store-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.9rem;
}

.store-chip {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.store-chip:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.25);
}

.footer-note {
    font-size: 0.74rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 62ch;
}

/* Pagination ------------------------------------------------------------- */

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.pager:empty { display: none; }

.page-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1.1rem;
    border-radius: 8px;
    font-size: 0.83rem;
    cursor: pointer;
}

.page-btn:hover:not(:disabled) { border-color: rgba(255, 255, 255, 0.28); }

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* Budget range in the control row */
.budget-range {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.budget-range input {
    width: 82px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    font-size: 0.82rem;
}

.budget-range input:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

/* "from ₹X" — the price is the cheapest of several offers, and saying so is the
   difference between an honest figure and one that looks like the only price. */
.price-from {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 0.3rem;
}

.price-spread {
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: center;
    padding: 3rem 1rem;
    text-align: center;
}

.empty-state strong { font-size: 1rem; }

.empty-state span {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Chained filters -------------------------------------------------------- */

.facet-more {
    background: none;
    border: none;
    color: var(--accent-cyan);
    font-size: 0.72rem;
    cursor: pointer;
    padding: 0.25rem 0 0;
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
}

.active-filters[hidden] { display: none; }

/* With filters chained, the panel alone doesn't show how narrow a search has become -
   a lower filter may already have collapsed to one option. */
.active-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--accent-cyan);
    background: rgba(0, 242, 254, 0.1);
    color: var(--accent-cyan);
    border-radius: 20px;
    font-size: 0.74rem;
    cursor: pointer;
    text-transform: capitalize;
}

.active-chip span { font-size: 0.9rem; line-height: 1; }

.active-chip:hover { background: rgba(0, 242, 254, 0.2); }

/* Mobile filter drawer ---------------------------------------------------- */
/* Below 860px there is no room for a persistent sidebar, and a panel stacked above
   the grid pushes every result below the fold. The panel becomes a drawer instead -
   the pattern faceted-search guidance recommends for narrow screens. */

.filter-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.55rem 1.1rem;
    border-radius: 9px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 0.9rem;
}

.drawer-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 860px) {
    .filter-toggle:not([hidden]) { display: inline-block; }

    /* Hidden until opened, rather than stacked above the results. */
    .filter-panel:not([hidden]) { display: none; }

    .filter-panel.drawer-open {
        display: block;
        position: fixed;
        inset: 0 0 0 auto;
        width: min(320px, 88vw);
        z-index: 200;
        border-radius: 0;
        overflow-y: auto;
        padding: 1.25rem;
        background: var(--bg-dark);
        border-left: 1px solid var(--border-color);
        box-shadow: -12px 0 32px rgba(0, 0, 0, 0.5);
    }

    .filter-panel.drawer-open .drawer-close { display: block; }

    /* Stop the page behind the drawer from scrolling with it. */
    body.drawer-locked { overflow: hidden; }
}

/* Phone and small-tablet widths (WEB-04). Desktop layout is unchanged. */
@media (max-width: 860px) {
    /* The build summary stacks under the slots instead of squeezing beside them. */
    .builder-layout { grid-template-columns: minmax(0, 1fr); }
    .summary-card { position: static; }
}

@media (max-width: 600px) {
    .search-container { padding: 1rem; }
    .search-input-group { gap: 0.5rem; }
    .search-input-group input { min-width: 0; padding: 0.75rem 0.9rem; }
    .search-input-group .btn-primary { padding: 0.75rem 1rem; }

    .slot-card { padding: 0.9rem; gap: 0.75rem; }
    .slot-info { min-width: 0; gap: 0.75rem; }
    .slot-info > div:last-child { min-width: 0; }
    .slot-icon { width: 40px; height: 40px; flex-shrink: 0; }
    .slot-selected-item { overflow-wrap: anywhere; }
    .slot-card .btn-secondary { flex-shrink: 0; }
}
