/**
 * Archive Product - Stylesheet
 * File: assets/css/archive-product.css
 * Dựa theo design inviva.vn — clean, professional, primary orange
 */

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
    --primary: #F07022;
    --primary-dark: #D55E10;
    --primary-light: #FFF3EC;
    --accent-teal: #00A99D;
    --text-main: #1A1A1A;
    --text-sub: #666666;
    --text-muted: #999999;
    --border: #E8E8E8;
    --border-hover: #CCCCCC;
    --bg-page: #F8F8F6;
    --bg-white: #FFFFFF;
    --bg-sidebar: #FAFAFA;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-card: 0 2px 12px rgba(0, 0, 0, .07);
    --shadow-hover: 0 6px 24px rgba(0, 0, 0, .12);
    --transition: .22s ease;
    --font-main: 'Be Vietnam Pro', 'Nunito', sans-serif;
}

/* ─── Base ──────────────────────────────────────────────────── */
.inviva-shop-wrapper {
    background: var(--bg-page);
    min-height: 80vh;
    font-family: var(--font-main);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ─── Breadcrumb ─────────────────────────────────────────────── */
.shop-breadcrumb {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    font-size: 13px;
    color: var(--text-sub);
}

.shop-breadcrumb a {
    color: var(--text-sub);
    text-decoration: none;
}

.shop-breadcrumb a:hover {
    color: var(--primary);
}

.shop-breadcrumb .breadcrumb_last {
    color: var(--text-main);
    font-weight: 500;
}

/* ─── Layout ─────────────────────────────────────────────────── */
.shop-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    padding: 24px 0 48px;
    align-items: start;
}

/* ─── SIDEBAR ────────────────────────────────────────────────── */
.shop-sidebar {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.shop-sidebar::-webkit-scrollbar {
    width: 4px;
}

.shop-sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-white);
    z-index: 2;
}

.sidebar-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-main);
}

.sidebar-reset {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-sub);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-reset:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* Filter Groups */
.filter-group {
    border-bottom: 1px solid var(--border);
}

.filter-group:last-of-type {
    border-bottom: none;
}

.filter-group-title {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 18px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
    text-align: left;
    transition: var(--transition);
}

.filter-group-title:hover {
    color: var(--primary);
}

.filter-group-title .chevron {
    transition: transform .2s ease;
    flex-shrink: 0;
    color: var(--text-muted);
}

.filter-group-title[aria-expanded="false"] .chevron {
    transform: rotate(-90deg);
}

.filter-group-body {
    padding: 4px 18px 14px;
}

/* Checkboxes */
.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    padding: 5px 0;
    font-size: 13px;
    color: var(--text-main);
    user-select: none;
}

.filter-checkbox:hover .label-text {
    color: var(--primary);
}

.filter-checkbox input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border-hover);
    border-radius: 4px;
    background: var(--bg-white);
    flex-shrink: 0;
    position: relative;
    transition: var(--transition);
}

.filter-checkbox input:checked+.checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.filter-checkbox input:checked+.checkmark::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: 2px solid white;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

.label-text {
    flex: 1;
}

.count {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-page);
    padding: 1px 6px;
    border-radius: 20px;
}

/* Price Range */
.price-range-wrap {
    padding-top: 6px;
}

.price-display {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 14px;
    font-weight: 500;
}

.range-slider {
    position: relative;
    height: 4px;
    margin: 10px 0 8px;
}

.range-track {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border);
    border-radius: 4px;
}

.range-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    background: var(--primary);
    border-radius: 4px;
}

.range-input {
    position: absolute;
    width: 100%;
    height: 4px;
    background: none;
    border: none;
    outline: none;
    pointer-events: none;
    -webkit-appearance: none;
    top: 0;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .2);
    cursor: pointer;
    pointer-events: all;
    position: relative;
    z-index: 1;
}

/* Sidebar CTA */
.sidebar-cta {
    padding: 16px 18px 18px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-quote-quick {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}

.btn-quote-quick:hover {
    background: var(--primary-dark);
}

.link-download-price {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.link-download-price:hover {
    text-decoration: underline;
}

.sidebar-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    color: var(--text-sub);
    background: var(--bg-page);
    padding: 3px 8px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

/* ─── MAIN CONTENT ───────────────────────────────────────────── */
.shop-main {
    min-width: 0;
}

/* Toolbar */
.shop-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    background: var(--bg-white);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.toolbar-left {
    flex: 1;
}

.result-count {
    font-size: 13.5px;
    color: var(--text-sub);
    font-weight: 500;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Sort Select */
.sort-select-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.sort-select {
    appearance: none;
    -webkit-appearance: none;
    border: 1.5px solid var(--border);
    background: var(--bg-white);
    padding: 7px 32px 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-main);
    cursor: pointer;
    font-family: var(--font-main);
    outline: none;
    transition: var(--transition);
    min-width: 130px;
}

.sort-select:hover,
.sort-select:focus {
    border-color: var(--primary);
}

.sort-icon {
    position: absolute;
    right: 10px;
    pointer-events: none;
    color: var(--text-muted);
}

/* Search */
.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.live-search-input {
    border: 1.5px solid var(--border);
    background: var(--bg-white);
    padding: 7px 12px 7px 34px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-main);
    font-family: var(--font-main);
    outline: none;
    transition: var(--transition);
    width: 190px;
}

.live-search-input::placeholder {
    color: var(--text-muted);
}

.live-search-input:hover,
.live-search-input:focus {
    border-color: var(--primary);
}

.search-icon {
    position: absolute;
    left: 10px;
    pointer-events: none;
    color: var(--text-muted);
}

/* Search Suggestions */
.search-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-hover);
    min-width: 280px;
    z-index: 999;
    display: none;
    overflow: hidden;
}

.suggestions-list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 13px;
    transition: var(--transition);
}

.suggestion-item:hover {
    background: var(--primary-light);
}

.suggestion-thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.suggestion-thumb-placeholder {
    width: 36px;
    height: 36px;
    background: var(--bg-page);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.suggestion-title {
    display: block;
    font-weight: 500;
}

.suggestion-sku {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.no-suggestions {
    padding: 12px 14px;
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

/* Mobile Filter Toggle */
.mobile-filter-toggle {
    display: none;
    align-items: center;
    gap: 7px;
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-main);
    margin-bottom: 14px;
    width: 100%;
    justify-content: center;
}

.filter-active-count {
    background: var(--primary);
    color: white;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 20px;
}

/* Active Filters */
.active-filters {
    margin-bottom: 14px;
}

.active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 12.5px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(240, 112, 34, .2);
}

.filter-tag-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    padding: 0;
    display: flex;
    align-items: center;
    opacity: .7;
}

.filter-tag-remove:hover {
    opacity: 1;
}

/* ─── PRODUCT GRID ───────────────────────────────────────────── */
.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    position: relative;
}

.products-grid.loading {
    opacity: .5;
    pointer-events: none;
    transition: opacity .2s;
}

/* Product Card */
.product-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    transition: box-shadow var(--transition), transform var(--transition);
}

.product-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}

/* Badges */
.card-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-badge {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.badge-bestseller {
    background: #FF6B35;
    color: white;
}

.badge-new {
    background: #4CAF50;
    color: white;
}

.badge-fast {
    background: #2196F3;
    color: white;
}

.badge-moq {
    background: #FF9800;
    color: white;
}

/* Card Image */
.card-image-wrap {
    display: block;
    width: 100%;
    aspect-ratio: 4/3;
    position: relative;
    overflow: hidden;
    background: #F5F5F3;
}

.card-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12px;
    transition: transform .4s ease;
}

.product-card:hover .card-image-wrap img {
    transform: scale(1.04);
}

.card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #CCC;
}

.card-sku {
    position: absolute;
    bottom: 8px;
    right: 10px;
    font-size: 10.5px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, .85);
    padding: 2px 7px;
    border-radius: 20px;
}

/* Card Body */
.card-body {
    padding: 14px 15px 15px;
}

.card-title {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-title a {
    color: var(--text-main);
    text-decoration: none;
}

.card-title a:hover {
    color: var(--primary);
}

.card-meta {
    margin-bottom: 12px;
}

.meta-sku {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-bottom: 6px;
}

.meta-item {
    font-size: 12px;
    color: var(--text-sub);
}

.meta-label {
    color: var(--text-muted);
    font-weight: 500;
}

.card-price {
    font-size: 12.5px;
    color: var(--text-sub);
}

.card-price strong {
    color: var(--primary);
    font-size: 13.5px;
    font-weight: 700;
}

/* Card Actions */
.card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-bottom: 8px;
}

.btn-detail,
.btn-quote {
    display: block;
    text-align: center;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
}

.btn-detail {
    background: var(--primary-light);
    color: var(--primary);
    border: 1.5px solid rgba(240, 112, 34, .25);
}

.btn-detail:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-quote {
    background: var(--primary);
    color: white;
}

.btn-quote:hover {
    background: var(--primary-dark);
}

.card-case-study {
    display: block;
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
    text-align: center;
}

.card-case-study:hover {
    text-decoration: underline;
}

/* No Products */
.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-products svg {
    margin-bottom: 16px;
    opacity: .4;
}

.no-products p {
    font-size: 15px;
    margin: 0 0 20px;
}

.no-products button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    cursor: pointer;
    font-weight: 600;
}

/* ─── LOADING ────────────────────────────────────────────────── */
.grid-loading {
    display: none;
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 10px 16px;
    box-shadow: var(--shadow-hover);
    z-index: 100;
}

.grid-loading.active {
    display: flex;
    align-items: center;
    gap: 8px;
}

.grid-loading.active::after {
    content: 'Đang tải...';
    font-size: 13px;
    color: var(--text-sub);
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ─── PAGINATION ─────────────────────────────────────────────── */
.shop-pagination {
    margin-top: 28px;
    display: flex;
    justify-content: center;
}

.pagination-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    border: 1.5px solid var(--border);
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    padding: 0 8px;
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    font-weight: 700;
}

.page-dots {
    color: var(--text-muted);
    padding: 0 4px;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .shop-layout {
        grid-template-columns: 220px 1fr;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .shop-layout {
        grid-template-columns: 1fr;
    }

    .shop-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        max-height: 100vh;
        transform: translateX(-100%);
        transition: transform .28s ease;
        z-index: 9999;
        border-radius: 0;
        box-shadow: 4px 0 24px rgba(0, 0, 0, .15);
    }

    .shop-sidebar.mobile-open {
        transform: translateX(0);
    }

    .mobile-filter-toggle {
        display: flex;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .toolbar-right {
        flex-wrap: wrap;
        gap: 8px;
    }

    .live-search-input {
        width: 150px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .shop-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ─── Search Clear Button ────────────────────────────────────── */
.search-clear-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px;
    display: flex;
    align-items: center;
    border-radius: 50%;
    transition: var(--transition);
}

.search-clear-btn:hover {
    color: var(--primary);
    background: var(--primary-light);
}

/* Thu hẹp input khi có clear button */
.search-wrap:has(#searchClearBtn[style*="display: block"]) .live-search-input,
.search-wrap:has(#searchClearBtn:not([style*="none"])) .live-search-input {
    padding-right: 30px;
}

/* ─── Search loading state ───────────────────────────────────── */
.live-search-input.searching {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='none' stroke='%23F07022' stroke-width='2' stroke-dasharray='30 70' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' dur='0.7s' from='0 12 12' to='360 12 12' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 28px center;
}