/* ============================================
   Price Check (/price-check/) styles
   Split out of global.css; loaded after it by includes/header.php
   on this page only. Rules keep their original relative order.
   ============================================ */

/* --- Price Check: Autocomplete --- */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #111827;
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition-fast);
}
.suggestion-icon { width: 28px; height: 28px; border-radius: 4px; background: rgba(0, 0, 0, 0.3); }
.suggestion-name { flex: 1; font-size: 0.95rem; }
.suggestion-type { font-size: 0.8rem; color: var(--color-text-muted); }
.suggestion-item.no-results:hover { background: transparent; }

/* --- Price Check: Search status --- */
.search-status {
    display: none;
    margin-top: 16px;
    padding: 12px 16px;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    border: 1px solid rgba(99, 179, 237, 0.15);
}

.results-header {
    padding: 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: center;
}

.item-info { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 200px; }

.item-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid var(--color-border);
}

.item-details h2 { font-size: 1.35rem; font-weight: 600; margin-bottom: 4px; }
.item-meta { font-size: 0.85rem; color: var(--color-text-muted); }

.results-summary { display: flex; gap: 32px; }
.summary-stat { text-align: center; }
.summary-stat .stat-label { display: block; font-size: 0.75rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.summary-stat .stat-value { font-size: 1.1rem; font-weight: 600; }

/* --- Price Check: Results table --- */
.results-table-wrapper { overflow-x: auto; }
.results-table { width: 100%; border-collapse: collapse; }
.results-table th, .results-table td { padding: 14px 20px; text-align: left; vertical-align: top; }
.results-table th { background: rgba(0, 0, 0, 0.2); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); }
.results-table tbody tr { border-top: 1px solid rgba(255, 255, 255, 0.05); }
.results-table tbody tr:first-child { background: rgba(128, 195, 66, 0.1); }
.results-table .realm-name { font-weight: 500; }
.results-table .price-cell { font-family: 'JetBrains Mono', 'Fira Code', monospace; white-space: nowrap; }
.results-table .quantity-cell { color: var(--color-text-muted); }
.results-table .diff-cell { font-size: 0.9rem; }
.diff-lowest { color: var(--color-success); font-weight: 600; }
.diff-low { color: var(--color-success); }
.diff-medium { color: var(--color-warning); }
.diff-high { color: var(--color-error); }
.realm-separator { color: rgb(148, 163, 184); margin: 0 4px; }

.panel-info { padding: 16px 20px; }
.data-status { font-size: 0.85rem; color: var(--color-text-muted); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.status-separator { opacity: 0.5; }
#last-updated { color: var(--color-text-light); }

.item-wowhead-link { text-decoration: none; }
.item-wowhead-link:hover, .item-wowhead-link:focus { text-decoration: underline; }

/* --- Price Check: Browse panel --- */
.panel-browse { padding: 0; overflow: hidden; }
.browse-container { display: flex; min-height: 500px; }

.browse-sidebar {
    width: 30%;
    min-width: 220px;
    max-width: 320px;
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    max-height: 600px;
}

.browse-sidebar-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    padding: 12px 16px;
    margin: 0;
    border-bottom: 1px solid rgba(99, 179, 237, 0.1);
}

/* Beat `.panel h2` (0,1,1) so the h2 keeps the small caps-label look */
.panel .browse-sidebar-title { font-size: 0.8rem; font-weight: 600; }

/* Mobile-only "Browse categories" disclosure button (shown <=959px) */
.category-toggle { display: none; }

.category-tree { padding: 8px 0; overflow-y: auto; flex: 1; }
.category-label:focus-visible { outline-offset: -2px; border-radius: 0; }
.category-item { cursor: pointer; user-select: none; }

.category-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    color: var(--color-text-light);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.category-label:hover { background: rgba(39, 170, 226, 0.1); color: var(--color-primary); }
.category-item.active > .category-label { background: rgba(39, 170, 226, 0.15); color: var(--color-primary); font-weight: 500; }
.category-arrow { font-size: 0.7rem; transition: transform var(--transition-normal); color: var(--color-text-dark); width: 12px; }
.category-item.expanded > .category-label .category-arrow { transform: rotate(90deg); }
.category-children { display: none; padding-left: 12px; }
.category-item.expanded > .category-children { display: block; }

/* --- Price Check: Browse content --- */
.browse-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.browse-table-header {
    display: flex;
    padding: 0 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--color-border);
}

.browse-col {
    padding: 0;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.browse-col:hover { color: var(--color-text-light); }

/* Sort control: a real <button>, reset to look like the old header text */
.browse-sort-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 12px 0;
    margin: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    text-align: left;
    cursor: pointer;
}
.browse-sort-btn:focus-visible { outline-offset: -2px; }

/* Item name in a browse row: a <button> so rows are keyboard-reachable */
.browse-item-btn {
    display: block;
    min-width: 0;
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
}
.browse-item-btn .browse-item-name { display: block; }
.browse-col-name { flex: 1; min-width: 0; }
.browse-col-price { width: 120px; flex-shrink: 0; }
.browse-col-realm { width: 120px; flex-shrink: 0; }
.browse-col-available { width: 100px; flex-shrink: 0; }

.sort-arrow { font-size: 0.7rem; opacity: 0; transition: opacity var(--transition-fast); }
.browse-col.sorted .sort-arrow { opacity: 1; }
.sort-arrow::after { content: '▲'; }
.browse-col.sorted.desc .sort-arrow::after { content: '▼'; }

.browse-items { flex: 1; overflow-y: auto; max-height: 559px; }
.browse-empty { display: flex; align-items: center; justify-content: center; gap: 12px; height: 100%; min-height: 300px; color: var(--color-text-dark); font-size: 1rem; }
.browse-empty-arrow { font-size: 1.5rem; }
.browse-empty-mobile { display: none; }
.browse-items:focus { outline: none; } /* programmatic focus target after mobile category pick */

.browse-row {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background var(--transition-fast);
    cursor: pointer;
}

.browse-row:hover { background: rgba(39, 170, 226, 0.05); }
.browse-row-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.browse-item-icon { width: 28px; height: 28px; border-radius: 4px; background: rgba(0, 0, 0, 0.3); flex-shrink: 0; }
.browse-item-name { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.browse-row-price { width: 120px; font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 0.85rem; flex-shrink: 0; }
.browse-row-realm { width: 120px; font-size: 0.85rem; color: var(--color-success); flex-shrink: 0; }
.browse-row-available { width: 100px; font-size: 0.85rem; color: var(--color-success); flex-shrink: 0; }
.browse-not-listed { color: var(--color-text-dark); font-style: italic; }

.browse-row-loader {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(39, 170, 226, 0.2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    flex-shrink: 0;
}

.browse-row.loading .browse-row-loader { display: inline-block; }
.browse-loading { display: flex; align-items: center; justify-content: center; height: 100%; min-height: 300px; color: var(--color-text-muted); }

@media (max-width: 959px) {
    /* 44px minimum touch target for category rows */
    .category-label {
        min-height: 44px;
    }

    .browse-table-header {
        display: none;
    }
    
    .browse-empty-arrow {
        display: none;
    }
    
    .browse-row {
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px 16px;
    }
    
    .browse-row-name {
        flex: 0 0 100%;
        min-width: 0;
    }
    
    .browse-item-name {
        white-space: normal;
        word-break: break-word;
    }
    
    .browse-row-price,
    .browse-row-realm,
    .browse-row-available {
        width: auto;
        flex: 1;
        font-size: 0.8rem;
    }
    
    .browse-row-available {
        max-width: 90px;
    }
    
    .browse-row-price::before {
        content: 'Price: ';
        color: var(--color-text-muted);
        font-family: inherit;
    }
    
    .browse-row-realm::before {
        content: 'Realm: ';
        color: var(--color-text-muted);
    }
    
    .browse-row-available::before {
        content: 'Qty: ';
        color: var(--color-text-muted);
    }
}

@media (max-width: 600px) {
    .browse-row {
        flex-direction: column;
        text-align: center;
    }
    
    .browse-row-name,
    .browse-row-price,
    .browse-row-realm,
    .browse-row-available {
        width: 100%;
        max-width: none;
    }
    
    .browse-row-name {
        justify-content: center;
    }
}

@media (max-width: 959px) {
    .results-header {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }
    
    .item-info {
        min-width: 0;
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .item-details h2 {
        font-size: 1.15rem;
    }
    
    .results-summary {
        width: 100%;
        justify-content: space-around;
        gap: 16px;
    }
    
    .results-table thead {
        display: none;
    }
    
    .results-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        padding: 12px;
        gap: 8px;
    }
    
    .results-table td {
        padding: 0;
        border: none;
    }
    
    .results-table td:nth-child(1) {
        flex: 0 0 100%;
        font-weight: 600;
    }
    
    .results-table td:nth-child(2),
    .results-table td:nth-child(3),
    .results-table td:nth-child(4) {
        flex: 0 0 100%;
        font-size: 0.85rem;
    }
    
    .results-table td:nth-child(2)::before {
        content: 'Price: ';
        color: var(--color-text-muted);
        font-family: inherit;
    }
    
    .results-table td:nth-child(3)::before {
        content: 'Qty: ';
        color: var(--color-text-muted);
    }
    
    .results-table td:nth-child(4)::before {
        content: 'Diff: ';
        color: var(--color-text-muted);
    }
}

@media (max-width: 959px) {
    .price-check .search-container .btn { width: 100%; }
    .results-header { 
        flex-direction: column; 
        align-items: center; 
        text-align: center;
        justify-content: center;
    }
    .item-info { 
        flex-direction: column; 
        align-items: center; 
        text-align: center;
        justify-content: center;
    }
    .results-summary { 
        width: 100%; 
        justify-content: center; 
        text-align: center;
    }
    .summary-stat { text-align: center; }
    .results-table th, .results-table td { padding: 12px 14px; text-align: center; }
    .browse-container { flex-direction: column; min-height: 0; }
    .browse-sidebar {
        width: 100%;
        max-width: none;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }
    /* Heading stays for screen readers; the toggle button is the visible control */
    .panel .browse-sidebar-title {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
    .category-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        width: 100%;
        min-height: 48px;
        padding: 12px 16px;
        margin: 0;
        border: 0;
        background: rgba(39, 170, 226, 0.08);
        color: var(--color-text-light);
        font: inherit;
        font-size: 0.95rem;
        font-weight: 600;
        text-align: left;
        cursor: pointer;
        transition: background var(--transition-fast), color var(--transition-fast);
    }
    .category-toggle:hover { background: rgba(39, 170, 226, 0.15); color: var(--color-primary); }
    .category-toggle:focus-visible { outline-offset: -2px; border-radius: 0; }
    .category-toggle-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
    .category-toggle-current {
        font-size: 0.8rem;
        font-weight: 400;
        color: var(--color-primary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .category-toggle-current:empty { display: none; }
    .category-toggle-icon { flex-shrink: 0; transition: transform var(--transition-normal); }
    .category-toggle[aria-expanded="true"] .category-toggle-icon { transform: rotate(180deg); }
    .category-toggle[aria-expanded="true"] { border-bottom: 1px solid rgba(99, 179, 237, 0.1); }
    .browse-sidebar.is-collapsed .category-tree { display: none; }
    .browse-items { max-height: none; }
    .browse-empty { padding: 5%; text-align: center; min-height: 160px; }
    .browse-empty-desktop { display: none; }
    .browse-empty-mobile { display: inline; }
    .data-status { justify-content: center; }
}

@media (max-width: 600px) {
    .price-check .site-header { flex-wrap: wrap; }
    .results-summary { flex-direction: column; gap: 12px; }
    .browse-row-name { flex-direction: column; }
}

@media (max-width: 959px) {
    .suggestion-item {
        flex-direction: column;
        border-top: 1px solid var(--color-border-light);
    }
}

/* Search field on the dashboard Filters panel's scale: the Search button's
   size (0.92rem) at 500, placeholder regular */
#item-search {
    font-size: 0.92rem;
    font-weight: 500;
}

#item-search::placeholder {
    font-weight: 400;
}

/* ============================================
   Game (2026-09-29): the shared Which game? picker sits above the tool.
   Retail and MoP Classic have prices (.pc-tool[data-price-state="live"],
   set by price-check.js from includes/price-games.php). For a game without
   auction data (TBC Anniversary, Classic Era) or WoW Forever the price
   panels step aside and .pc-soon says so plainly.
   ============================================ */
.price-check .pc-tool:not([data-price-state="live"]) .pc-live-only { display: none !important; }
.price-check .pc-tool[data-price-state="live"] .pc-soon { display: none; }

/* A game-specific line (MoP Classic: no stackables). It takes the general hint's place
   rather than stacking under it, since it says the same thing more exactly. */
.price-check .panel-search:has(.pc-note:not([hidden])) .pc-search__hint { display: none; }

.price-check .pc-note {
    margin: 10px 0 0;
    font-size: 0.84rem;
    color: var(--color-text-muted);
}

.price-check .pc-soon {
    --a: var(--game-classic);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px 22px;
    padding: 24px 26px;
    border-color: color-mix(in srgb, var(--a) 30%, rgba(255, 255, 255, 0.06));
    background:
        radial-gradient(70% 160% at 0% 0%, color-mix(in srgb, var(--a) 12%, transparent), transparent 62%),
        var(--color-bg-panel);
}

.price-check .pc-soon[data-game="forever"] { --a: var(--game-forever); }

.price-check .pc-soon__icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--a) 14%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--a) 30%, transparent);
    color: var(--a);
}

.price-check .pc-soon__icon svg { width: 26px; height: 26px; }

.price-check .pc-soon__title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    text-align: left;
}

.price-check .pc-soon__text {
    margin: 6px 0 0;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--color-text-muted);
}

.price-check .pc-soon__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 18px;
    font-size: 0.92rem;
    font-weight: 600;
    white-space: nowrap;
}

.price-check .pc-soon__btn .btn-label { top: 0; }
.price-check .pc-soon__btn-icon { display: inline-flex; color: var(--game-retail); }
.price-check .pc-soon__btn-icon svg { width: 17px; height: 17px; }

/* ============================================
   The search bar (the auction house panels below are untouched): a visible
   label, a 52px field with the search icon inside, the button at the same
   height, a hint line, and suggestions as a floating panel like the game menu.
   ============================================ */
.price-check .panel-search { padding: 24px 26px 22px; }

.price-check .pc-search__label {
    display: block;
    margin: 0 0 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.price-check .search-container { gap: 12px; align-items: stretch; }

.price-check .pc-search__icon {
    position: absolute;
    left: 16px;
    top: 17px;
    color: var(--color-text-muted);
    pointer-events: none;
    transition: color 0.2s ease;
}

.price-check .search-input-wrapper:focus-within .pc-search__icon { color: var(--color-primary); }

.price-check .search-input {
    height: 52px;
    padding: 0 16px 0 46px;
    border: 1px solid var(--color-border-input);
    border-radius: 12px;
    background: var(--color-bg-input);
    font-size: 1rem;
    font-weight: 500;
    text-align: left; /* the old stacked-layout rule centered it; the icon sits on the left */
}

.price-check .search-input::placeholder { font-weight: 400; color: rgba(148, 163, 184, 0.75); }

.price-check #search-btn {
    height: 52px;
    min-width: 150px;
    padding: 0 22px;
    border-radius: var(--radius-full);
    justify-content: center;
}

.price-check .pc-search__hint {
    margin: 10px 0 0;
    font-size: 0.84rem;
    color: var(--color-text-muted);
}

.price-check .search-suggestions {
    top: calc(100% + 6px);
    padding: 6px;
    border: 1px solid var(--color-border-input);
    border-radius: 12px;
    background: #0b111b;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
    max-height: 340px;
}

.price-check .suggestion-item {
    min-height: 44px;
    padding: 6px 10px;
    border-radius: 8px;
}

.price-check .suggestion-item:hover,
.price-check .suggestion-item.selected { background: rgba(39, 170, 226, 0.14); }

.price-check .suggestion-icon { width: 30px; height: 30px; border-radius: 6px; }

.price-check .search-status {
    margin-top: 14px;
    border-radius: 12px;
}

@media (max-width: 760px) {
    .price-check .pc-soon { grid-template-columns: auto minmax(0, 1fr); padding: 20px; }
    .price-check .pc-soon__btn { grid-column: 1 / -1; justify-content: center; width: 100%; }
    .price-check .panel-search { padding: 20px 18px; }
    .price-check #search-btn { width: 100%; }
}
