/* =========================================================
   PriceYar - isolated UI
   Loaded after the Suha/theme styles.
   ========================================================= */
.py-page,
.py-page * {
    box-sizing: border-box;
}

.py-page {
    --py-primary: #2563eb;
    --py-primary-dark: #1d4ed8;
    --py-primary-soft: #eff6ff;
    --py-bg: #f6f8fc;
    --py-card: #fff;
    --py-text: #172033;
    --py-muted: #667085;
    --py-border: #e5e7eb;
    --py-success: #16a34a;
    --py-danger: #dc2626;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px 20px 70px;
    color: var(--py-text);
    font-family: inherit;
    line-height: 1.75;
}

    .py-page button,
    .py-page input,
    .py-page select {
        font: inherit;
    }

    .py-page button {
        cursor: pointer;
    }

/* Hero */
.py-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 30px;
    margin-bottom: 20px;
    border: 1px solid rgba(37,99,235,.12);
    border-radius: 22px;
    background: linear-gradient(135deg,#ffffff 0%,#f7faff 55%,#eef5ff 100%);
    box-shadow: 0 14px 45px rgba(15,23,42,.07);
}

.py-kicker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    border-radius: 999px;
    background: var(--py-primary-soft);
    color: var(--py-primary);
    font-size: .82rem;
    font-weight: 800;
}

.py-hero h1 {
    margin: 10px 0 7px;
    font-size: clamp(1.45rem, 2.8vw, 2.2rem);
    line-height: 1.35;
    font-weight: 900;
}

.py-hero p {
    margin: 0;
    color: var(--py-muted);
}

.py-hero-badge {
    flex: 0 0 auto;
    padding: 12px 16px;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    background: #fff;
    color: #334155;
    font-size: .88rem;
    font-weight: 700;
    white-space: nowrap;
}

/* Main search card */
.py-search-card,
.py-panel {
    background: var(--py-card);
    border: 1px solid var(--py-border);
    border-radius: 20px;
    box-shadow: 0 10px 35px rgba(15,23,42,.055);
}

.py-search-card {
    padding: 20px;
    margin-bottom: 22px;
}

/* Main category tabs: horizontal, never wrapped into a mess */
.py-car-tabs {
    display: flex;
    align-items: stretch;
    gap: 9px;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 3px 2px 9px;
    margin-bottom: 18px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}

    .py-car-tabs::-webkit-scrollbar {
        height: 5px;
    }

    .py-car-tabs::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 99px;
    }

    .py-car-tabs::-webkit-scrollbar-track {
        background: transparent;
    }

.py-category {
    flex: 0 0 auto;
    min-width: 125px;
    min-height: 48px;
    padding: 8px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 13px;
    background: #fff;
    color: #475569;
    font-weight: 800;
    transition: .18s ease;
    scroll-snap-align: start;
}

    .py-category:hover {
        border-color: #93c5fd;
        background: #f8fbff;
        transform: translateY(-1px);
    }

    .py-category.active {
        color: #fff;
        background: linear-gradient(135deg,var(--py-primary),#3b82f6);
        border-color: var(--py-primary);
        box-shadow: 0 8px 20px rgba(37,99,235,.22);
    }

    .py-category.py-coming {
        color: #94a3b8;
        background: #f8fafc;
        cursor: not-allowed;
    }

    .py-category small {
        display: block;
        font-size: .67rem;
        font-weight: 600;
        opacity: .8;
    }

/* Future model dropdown UI - can be used directly by the view */
.py-model-groups {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 12px;
    margin: 0 0 18px;
}

.py-model-group {
    overflow: hidden;
    border: 1px solid var(--py-border);
    border-radius: 14px;
    background: #fff;
}

    .py-model-group > summary,
    .py-model-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        min-height: 48px;
        padding: 9px 13px;
        color: #1e293b;
        background: #f8fafc;
        font-weight: 850;
        cursor: pointer;
        list-style: none;
    }

        .py-model-group > summary::-webkit-details-marker {
            display: none;
        }

        .py-model-group > summary::after {
            content: '⌄';
            color: #64748b;
            transition: transform .2s;
        }

    .py-model-group[open] > summary::after {
        transform: rotate(180deg);
    }

.py-model-list {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 6px;
    padding: 9px;
    border-top: 1px solid var(--py-border);
}

    .py-model-list button {
        min-width: 0;
        padding: 8px 9px;
        border: 0;
        border-radius: 9px;
        background: #f8fafc;
        color: #475569;
        text-align: right;
        font-size: .82rem;
    }

        .py-model-list button:hover {
            background: var(--py-primary-soft);
            color: var(--py-primary);
        }

/* Filters */
.py-filter-form {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 13px;
    align-items: end;
}

.py-field {
    min-width: 0;
}

.py-wide {
    grid-column: span 2;
}

.py-field label {
    display: block;
    margin: 0 0 6px;
    color: #344054;
    font-size: .83rem;
    font-weight: 800;
}

.py-input {
    display: block;
    width: 100%;
    min-height: 45px;
    padding: 8px 12px;
    border: 1px solid #d9dee8;
    border-radius: 11px;
    outline: none;
    background: #fff;
    color: #1f2937;
    transition: .16s ease;
}

    .py-input:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 3px rgba(37,99,235,.1);
    }

.py-input-help {
    display: block;
    margin-top: 4px;
    color: #98a2b3;
    font-size: .7rem;
}

.py-submit-field {
    grid-column: span 1;
}

.py-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 45px;
    padding: 8px 16px;
    border: 1px solid var(--py-primary);
    border-radius: 11px;
    background: var(--py-primary);
    color: #fff;
    font-weight: 850;
    transition: .18s ease;
}

    .py-button:hover {
        background: var(--py-primary-dark);
        transform: translateY(-1px);
    }

.py-search-button {
    width: 100%;
}

.py-status {
    min-height: 26px;
    margin-top: 10px;
    color: var(--py-muted);
    font-size: .85rem;
}

.py-query-suggestions {
    /*display: flex;*/
    gap: 7px;
    overflow-x: auto;
    padding: 7px 1px 2px;
    scrollbar-width: none;
}

    .py-query-suggestions::-webkit-scrollbar {
        display: none;
    }

.py-query-suggestion {
    flex: 0 0 auto;
    padding: 5px 9px;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    background: #f8fbff;
    color: #2563eb;
    font-size: .72rem;
}

/* Results */
.py-stat-grid {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 13px;
    margin-bottom: 16px;
}

.py-stat {
    padding: 17px;
    border: 1px solid var(--py-border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 7px 22px rgba(15,23,42,.04);
}

    .py-stat span, .py-stat small {
        display: block;
        color: var(--py-muted);
    }

    .py-stat strong {
        display: block;
        margin: 3px 0;
        font-size: 1.1rem;
    }

    .py-stat small {
        font-size: .68rem;
    }

.py-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0,2fr) minmax(280px,1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.py-panel {
    padding: 18px;
    margin-bottom: 16px;
    min-width: 0;
}

.py-panel-large {
    min-width: 0;
}

.py-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

    .py-panel-head h2 {
        margin: 0;
        font-size: 1rem;
        font-weight: 900;
    }

    .py-panel-head > div {
        display: flex;
        align-items: center;
        gap: 8px;
    }

.py-chart, .py-price-bars {
    min-height: 130px;
}

.py-bar-row {
    display: grid;
    grid-template-columns: minmax(75px,110px) minmax(0,1fr) auto;
    align-items: center;
    gap: 9px;
    margin: 9px 0;
    font-size: .74rem;
}

    .py-bar-row > span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

.py-bar-track {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf2f7;
}

    .py-bar-track i {
        display: block;
        height: 100%;
        min-width: 4px;
        border-radius: inherit;
        background: linear-gradient(90deg,#60a5fa,#2563eb);
    }

.py-best-card {
    padding: 16px;
    border-radius: 14px;
    background: linear-gradient(145deg,#f8fbff,#eef5ff);
    border: 1px solid #dbeafe;
}

.py-best-title {
    font-weight: 850;
}

.py-best-price {
    margin: 8px 0 3px;
    color: var(--py-primary);
    font-size: 1.15rem;
    font-weight: 950;
}

.py-best-meta {
    color: var(--py-muted);
    font-size: .78rem;
}

.py-empty {
    padding: 22px 10px;
    text-align: center;
    color: #98a2b3;
}

/* Table */
.py-filter-row {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 10px;
}

.py-small-input {
    width: 180px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--py-border);
    border-radius: 13px;
}

.py-table {
    width: 100%;
    min-width: 650px;
    border-collapse: collapse;
    background: #fff;
}

    .py-table th, .py-table td {
        padding: 11px 12px;
        border-bottom: 1px solid #eef1f5;
        text-align: right;
        vertical-align: middle;
        font-size: .82rem;
    }

    .py-table th {
        background: #f8fafc;
        color: #475467;
        font-weight: 850;
        white-space: nowrap;
    }

    .py-table tbody tr:hover {
        background: #fbfdff;
    }

    .py-table tbody tr:last-child td {
        border-bottom: 0;
    }

.py-pick {
    width: 17px;
    height: 17px;
    accent-color: var(--py-primary);
}

.py-compare-button {
    min-height: 38px;
    padding: 6px 11px;
    font-size: .78rem;
}

.py-compare {
    margin-top: 14px;
}

.py-compare-grid {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 9px;
}

    .py-compare-grid > div {
        padding: 12px;
        border: 1px solid var(--py-border);
        border-radius: 12px;
        background: #f8fafc;
    }

    .py-compare-grid strong, .py-compare-grid span, .py-compare-grid small {
        display: block;
    }

    .py-compare-grid span {
        margin-top: 4px;
        color: var(--py-primary);
        font-weight: 900;
    }

    .py-compare-grid small {
        color: var(--py-muted);
    }

.py-alert-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

/* Dark mode compatibility with Bootstrap data-bs-theme */
[data-bs-theme="dark"] .py-page {
    --py-card: #151b26;
    --py-bg: #0f141d;
    --py-text: #eef2f7;
    --py-muted: #aab4c3;
    --py-border: #293344;
}

[data-bs-theme="dark"] .py-hero,
[data-bs-theme="dark"] .py-search-card,
[data-bs-theme="dark"] .py-panel,
[data-bs-theme="dark"] .py-stat,
[data-bs-theme="dark"] .py-category,
[data-bs-theme="dark"] .py-hero-badge,
[data-bs-theme="dark"] .py-input,
[data-bs-theme="dark"] .py-table {
    background: #151b26;
    color: var(--py-text);
}

[data-bs-theme="dark"] .py-hero {
    background: linear-gradient(135deg,#151b26,#18243a);
}

[data-bs-theme="dark"] .py-category {
    border-color: #344054;
    color: #d0d5dd;
}

    [data-bs-theme="dark"] .py-category.py-coming {
        background: #111827;
        color: #667085;
    }

[data-bs-theme="dark"] .py-field label,
[data-bs-theme="dark"] .py-table th {
    color: #d0d5dd;
}

[data-bs-theme="dark"] .py-table th {
    background: #101620;
}

[data-bs-theme="dark"] .py-table td {
    border-color: #293344;
}

[data-bs-theme="dark"] .py-model-group,
[data-bs-theme="dark"] .py-model-list button {
    background: #151b26;
    border-color: #293344;
}

    [data-bs-theme="dark"] .py-model-group > summary {
        background: #101620;
        color: #e5e7eb;
    }

[data-bs-theme="dark"] .py-model-list button {
    color: #cbd5e1;
}

/* Tablet */
@media (max-width: 1100px) {
    .py-filter-form {
        grid-template-columns: repeat(3,minmax(0,1fr));
    }

    .py-wide {
        grid-column: span 2;
    }

    .py-stat-grid {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }

    .py-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .py-model-groups {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }
}

/* Mobile: tabs remain horizontal, filters stack cleanly */
@media (max-width: 767.98px) {
    .py-page {
        padding: 14px 10px 45px;
    }

    .py-hero {
        display: block;
        padding: 20px 16px;
        border-radius: 17px;
    }

        .py-hero h1 {
            font-size: 1.3rem;
        }

    .py-hero-badge {
        display: inline-flex;
        margin-top: 14px;
        max-width: 100%;
        white-space: normal;
        font-size: .76rem;
    }

    .py-search-card {
        padding: 12px;
        border-radius: 16px;
    }

    .py-car-tabs {
        gap: 7px;
        margin-inline: -3px;
        padding-inline: 3px;
    }

    .py-category {
        min-width: 112px;
        min-height: 44px;
        padding: 7px 11px;
        font-size: .82rem;
    }

    .py-model-groups {
        display: block;
    }

    .py-model-group {
        margin-bottom: 8px;
    }

    .py-model-list {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }

    .py-filter-form {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 9px;
    }

    .py-wide, .py-submit-field {
        grid-column: 1 / -1;
    }

    .py-field label {
        font-size: .75rem;
    }

    .py-input {
        min-height: 43px;
        padding: 7px 9px;
        font-size: .82rem;
    }

    .py-input-help {
        font-size: .64rem;
    }

    .py-stat-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .py-stat {
        padding: 12px;
        border-radius: 13px;
    }

        .py-stat strong {
            font-size: .88rem;
            word-break: break-word;
        }

        .py-stat small {
            font-size: .6rem;
        }

    .py-panel {
        padding: 13px;
        border-radius: 15px;
    }

    .py-panel-head {
        align-items: flex-start;
        flex-wrap: wrap;
    }

        .py-panel-head h2 {
            font-size: .9rem;
        }

    .py-compare-grid {
        grid-template-columns: 1fr 1fr;
    }

    .py-alert-form {
        grid-template-columns: 1fr;
    }

        .py-alert-form .py-button {
            width: 100%;
        }

    .py-filter-row {
        width: 100%;
    }

    .py-small-input {
        width: 100%;
    }

    .py-bar-row {
        grid-template-columns: 72px minmax(0,1fr) auto;
        font-size: .67rem;
    }
}

@media (max-width: 420px) {
    .py-page {
        padding-inline: 7px;
    }

    .py-filter-form {
        grid-template-columns: 1fr;
    }

    .py-wide, .py-submit-field {
        grid-column: auto;
    }

    .py-stat-grid {
        grid-template-columns: 1fr;
    }

    .py-compare-grid {
        grid-template-columns: 1fr;
    }

    .py-model-list {
        grid-template-columns: 1fr 1fr;
    }
}

/* =========================================================
   PRICEYAR — DESKTOP CATALOG
   Brand tabs -> Series tabs -> Minor models dropdown
   ========================================================= */

.py-page .py-mobile-models {
    width: 100%;
    max-width: 1180px;
    margin: 20px auto 24px;
    padding: 24px 28px;
    border: 1px solid #e5eaf0;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(15,23,42,.06);
}

.py-page .py-mobile-models-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

    .py-page .py-mobile-models-head h2 {
        margin: 4px 0 0;
        font-size: 20px;
        line-height: 1.5;
    }

.py-page .py-mobile-kicker {
    display: block;
    margin: 0;
    font-size: 12px;
    font-weight: 800;
    color: #6b7280;
}

/* برندهای اصلی: همه کنار هم */
.py-page #pyMobileBrands {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 4px 2px 13px;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    border-bottom: 1px solid #edf0f4;
    scrollbar-width: thin;
}

    .py-page #pyMobileBrands .py-mobile-brand {
        flex: 0 0 auto !important;
        min-width: 104px !important;
        height: 52px;
        padding: 8px 17px !important;
        border: 1px solid #dfe5ec !important;
        border-radius: 12px !important;
        background: #f8fafc !important;
        color: #273244 !important;
        cursor: pointer;
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        font: inherit;
        transition: all .15s ease;
    }

        .py-page #pyMobileBrands .py-mobile-brand:hover {
            background: #f1f5f9 !important;
            border-color: #cbd5e1 !important;
        }

        .py-page #pyMobileBrands .py-mobile-brand.active {
            background: #2563eb !important;
            border-color: #2563eb !important;
            color: #fff !important;
            box-shadow: 0 7px 18px rgba(37,99,235,.18);
        }

        .py-page #pyMobileBrands .py-mobile-brand span {
            font-weight: 800;
            white-space: nowrap;
        }

        .py-page #pyMobileBrands .py-mobile-brand small {
            font-size: 10px;
            opacity: .58;
            direction: ltr;
            white-space: nowrap;
        }

/* سری‌های اصلی: کنار هم */
.py-page .py-series-tabs {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 18px 2px 14px;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: thin;
}

.py-page .py-series-tab {
    flex: 0 0 auto !important;
    min-width: 136px;
    height: 46px;
    padding: 9px 20px;
    border: 1px solid #dce3eb;
    border-radius: 11px;
    background: #fff;
    color: #273244;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    white-space: nowrap;
    transition: all .15s ease;
}

    .py-page .py-series-tab:hover {
        background: #f8fafc;
        border-color: #c6d0dc;
    }

    .py-page .py-series-tab.active {
        background: #eff6ff;
        border-color: #2563eb;
        color: #2563eb;
        box-shadow: 0 3px 10px rgba(37,99,235,.08);
    }

/* مدل‌های ریز: فقط Dropdown */
.py-page .py-model-dropdown {
    width: 520px;
    max-width: 100%;
    margin-top: 2px;
}

    .py-page .py-model-dropdown label {
        display: block;
        margin-bottom: 8px;
        font-size: 13px;
        font-weight: 800;
        color: #374151;
    }

.py-page #pyMobileModelSelect {
    display: block !important;
    width: 100% !important;
    height: 50px;
    padding: 0 15px;
    border: 1px solid #d8e0e8 !important;
    border-radius: 11px !important;
    background: #fff !important;
    color: #273244 !important;
    font: inherit;
    outline: none;
    cursor: pointer;
}

    .py-page #pyMobileModelSelect:focus {
        border-color: #2563eb !important;
        box-shadow: 0 0 0 3px rgba(37,99,235,.10);
    }

.py-page .py-model-clear {
    padding: 9px 14px;
    border: 1px solid #dfe5ec;
    border-radius: 10px;
    background: #f8fafc;
    cursor: pointer;
    font: inherit;
}

.py-page .py-mobile-models[hidden] {
    display: none !important;
}
