/* ============================================
   iPhone Xịn — Product Page Styles
   Apple/Google Store–inspired clean UI
   ============================================ */

/* ---- Product Archive / Filters ---- */
.product-archive .section__header {
    text-align: left;
}

/* ================================
   FILTER BAR — New Design System
   ================================ */
.filter-bar {
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.filter-bar__row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.filter-bar__row--bottom {
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-border-light);
    gap: var(--space-md);
    align-items: flex-end;
}

.filter-bar__label {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    white-space: nowrap;
    min-width: 80px;
}

/* Filter Pills */
.filter-pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    background: var(--color-bg-alt);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
    border: 1.5px solid transparent;
}

.filter-pill:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.filter-pill.is-active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(59,130,246,0.35);
}

/* Price Filter */
.price-filter {
    flex: 1;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.price-range-display {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
}

.price-sep {
    color: var(--color-text-muted);
    margin: 0 2px;
}

.price-unit {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    font-weight: normal;
}

/* Price Filter Form layout */
.price-filter-form {
    display: flex;
    align-items: flex-end;
    gap: var(--space-md);
    flex: 1;
}

.filter-apply-btn {
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Sort Dropdown */
.sort-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sort-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 8px 36px 8px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    background: var(--color-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center;
    cursor: pointer;
    transition: border-color 0.2s;
    min-width: 160px;
    outline: none;
}

.sort-select:hover, .sort-select:focus {
    border-color: var(--color-primary);
}

/* Active Filter Tags */
.active-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: var(--space-sm);
    border-top: 1px dashed var(--color-border-light);
}

.active-filters__label {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    font-weight: var(--font-weight-medium);
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: #EFF6FF;
    color: var(--color-primary);
    border: 1px solid #BFDBFE;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.active-filter-tag:hover {
    background: #DBEAFE;
    border-color: var(--color-primary);
}

.active-filter-tag svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.active-filters__clear {
    font-size: var(--font-size-xs);
    color: #EF4444;
    text-decoration: underline;
    cursor: pointer;
    margin-left: var(--space-sm);
    transition: color 0.15s;
}

.active-filters__clear:hover {
    color: #DC2626;
}

/* Mobile Filter Toggle */
.mobile-filter-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-bg);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    cursor: pointer;
    margin-bottom: var(--space-md);
    transition: all 0.2s ease;
}

.mobile-filter-toggle:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.filter-badge {
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: var(--font-weight-bold);
    padding: 1px 7px;
    line-height: 1.6;
}

/* ---- Range Slider (new) ---- */
.range-slider {
    position: relative;
    width: 100%;
    height: 6px;
    background: var(--color-border);
    border-radius: var(--radius-full);
    margin: 10px 0 4px;
}

.range-slider-track {
    position: absolute;
    height: 100%;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    z-index: 1;
}

.range-slider input[type="range"] {
    position: absolute;
    width: 100%;
    height: 6px;
    top: 0;
    left: 0;
    -webkit-appearance: none;
    background: none;
    pointer-events: none;
    z-index: 2;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #fff;
    border: 2.5px solid var(--color-primary);
    pointer-events: auto;
    -webkit-appearance: none;
    box-shadow: 0 2px 8px rgba(59,130,246,0.25);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.range-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 12px rgba(59,130,246,0.4);
}

.range-slider input[type="range"]::-moz-range-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #fff;
    border: 2.5px solid var(--color-primary);
    pointer-events: auto;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(59,130,246,0.25);
}

/* Archive grid */
.products-grid--archive {
    grid-template-columns: repeat(2, 1fr);
}

/* ---- Responsive ---- */
@media (max-width: 767px) {
    .mobile-filter-toggle {
        display: inline-flex;
    }
    .filter-bar {
        display: none;
        padding: var(--space-md);
    }
    .filter-bar.is-open {
        display: flex;
    }
    .filter-bar__row {
        flex-direction: column;
        align-items: flex-start;
    }
    .filter-bar__row--bottom {
        flex-direction: column;
        align-items: stretch;
    }
    .price-filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-apply-btn {
        width: 100%;
        justify-content: center;
    }
    .sort-select {
        width: 100%;
    }
}

@media (min-width: 768px) {
    .mobile-filter-toggle {
        display: none;
    }
    .filter-bar {
        display: flex !important;
    }
}

@media (min-width: 1024px) {
    .products-grid--archive {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .products-grid--archive {
        grid-template-columns: repeat(4, 1fr);
    }
}


.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-md);
}

.empty-state__icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
}

.empty-state__title {
    font-size: var(--font-size-xl);
    color: var(--color-secondary);
    margin-bottom: var(--space-sm);
}

.empty-state__desc {
    font-size: var(--font-size-base);
    color: var(--color-text-light);
    margin-bottom: var(--space-xl);
}

/* ---- Product Detail ---- */
.product-detail {
    padding-bottom: var(--space-2xl);
}

.product-detail__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-xl);
}

/* Gallery */
.gallery__main {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--color-bg-alt);
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery__main img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transition: opacity var(--transition-base);
}

.gallery__thumbs {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
    overflow-x: auto;
    padding-bottom: var(--space-xs);
    -webkit-overflow-scrolling: touch;
}

.gallery__thumb {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--color-border);
    cursor: pointer;
    transition: border-color var(--transition-fast);
    background: var(--color-bg-alt);
    padding: 4px;
}

.gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gallery__thumb.is-active,
.gallery__thumb:hover {
    border-color: var(--color-primary);
}

/* Product Info */
.product-detail__title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-secondary);
    line-height: var(--line-height-tight);
    margin-bottom: var(--space-sm);
}

.product-detail__brand,
.product-detail__condition {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    margin-bottom: var(--space-xs);
}

.product-detail__brand strong,
.product-detail__condition strong {
    color: var(--color-text);
}

/* Price Box */
.product-detail__price-box {
    background: var(--color-bg-alt);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin: var(--space-md) 0;
    border: 1px solid var(--color-border-light);
}

.product-detail__price-box .price__current {
    font-size: var(--font-size-2xl);
    color: var(--color-accent);
}

.product-detail__installment {
    margin-top: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

/* Variants */
.product-detail__variants {
    margin-bottom: var(--space-md);
}

.product-detail__variants-label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    margin-bottom: var(--space-sm);
}

.variant-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.variant-option {
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    min-width: 80px;
}

.variant-option:hover {
    border-color: var(--color-primary);
}

.variant-option.is-active {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.variant-option__name {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
}

.variant-option__price {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
    margin-top: 2px;
}

/* Color Options */
.color-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.color-option {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.color-option:hover {
    border-color: var(--color-primary);
}

.color-option.is-active {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.color-option__image {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.color-option__name {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.color-option__price {
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
}

/* Short Description */
.product-detail__short-desc {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    line-height: var(--line-height-relaxed);
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    background: var(--color-bg-alt);
    border-radius: var(--radius-lg);
}

/* CTA */
.product-detail__cta {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

/* ---- Product Tabs ---- */
.product-tabs {
    margin-top: var(--space-2xl);
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-lg);
}

.product-tabs__nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border-light);
    margin-bottom: var(--space-lg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.product-tabs__btn {
    padding: var(--space-md) var(--space-lg);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.product-tabs__btn:hover {
    color: var(--color-primary);
}

.product-tabs__btn.is-active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.product-tab {
    display: none;
}

.product-tab.is-active {
    display: block;
}

.product-content {
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
    color: var(--color-text);
}

.product-content h2,
.product-content h3 {
    margin-top: var(--space-lg);
    margin-bottom: var(--space-sm);
    color: var(--color-secondary);
}

.product-content p {
    margin-bottom: var(--space-md);
}

.product-content img {
    border-radius: var(--radius-md);
    margin: var(--space-md) 0;
}

.product-content table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-md) 0;
    font-size: var(--font-size-sm);
}

.product-content table th,
.product-content table td {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--color-border-light);
    text-align: left;
}

.product-content table th {
    background: var(--color-bg-alt);
    font-weight: var(--font-weight-semibold);
    color: var(--color-secondary);
    width: 35%;
}

.product-content table tr:nth-child(even) {
    background: var(--color-bg-alt);
}

/* Related Products */
.related-products {
    border-top: 1px solid var(--color-border-light);
}

/* Sticky CTA - hidden by default on desktop */
.sticky-cta {
    display: none;
}

/* ---- Price Filter Slider ---- */
.price-filter-group {
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border-light);
}

.price-slider-wrap {
    margin-bottom: var(--space-md);
}

.price-inputs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.price-inputs .input-group {
    display: flex;
    flex-direction: column;
    width: 48%;
}

.price-inputs label {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.price-inputs input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    outline: none;
    transition: border-color var(--transition-fast);
}

.price-inputs input:focus {
    border-color: var(--color-primary);
}

.range-slider {
    position: relative;
    width: 100%;
    height: 6px;
    background-color: var(--color-border);
    border-radius: var(--radius-full);
    margin-top: var(--space-lg);
    margin-bottom: var(--space-sm);
}

.range-slider-track {
    position: absolute;
    height: 100%;
    background-color: var(--color-primary);
    border-radius: var(--radius-full);
    z-index: 1;
}

.range-slider input[type="range"] {
    position: absolute;
    width: 100%;
    height: 6px;
    top: 0;
    left: 0;
    -webkit-appearance: none;
    background: none;
    pointer-events: none;
    z-index: 2;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--color-primary);
    pointer-events: auto;
    -webkit-appearance: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    cursor: pointer;
}

.range-slider input[type="range"]::-moz-range-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--color-primary);
    pointer-events: auto;
    -moz-appearance: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    cursor: pointer;
}
