/**
 * Custom Shop Styles
 * RTL Persian Design
 */

/* ===== CSS Variables ===== */
:root {
    --shop-primary: #4CAF50;
    --shop-primary-hover: #43A047;
    --shop-secondary: #f5f5f5;
    --shop-text: #333;
    --shop-text-light: #666;
    --shop-text-muted: #999;
    --shop-border: #e0e0e0;
    --shop-bg: #fff;
    --shop-bg-hover: #fafafa;
    --shop-sale: #e53935;
    --shop-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shop-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shop-radius: 12px;
    --shop-radius-sm: 8px;
    --shop-transition: all 0.3s ease;
    --shop-font: 'DanaVF', 'Vazir', 'Tahoma', sans-serif;
}

/* ===== Category Archive Header ===== */
.category-archive-header {
    max-width: 1400px;
    margin: 0 auto 30px;
    padding: 30px 20px;
    text-align: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--shop-radius);
}

.category-archive-header .category-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--shop-text);
    margin: 0 0 10px;
    font-family: var(--shop-font);
}

.category-archive-header .category-description {
    font-size: 14px;
    color: var(--shop-text-light);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.8;
}

.category-archive-header .category-description p {
    margin: 0;
}

/* Page content full width for archive pages */
.site-main .page-content {
    max-width: 100%;
    padding: 50px 0 50px 0;
}

/* ===== Reset & Base ===== */
.sfp-shop-wrapper {
    display: flex;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: var(--shop-font);
    direction: rtl;
}

.sfp-shop-wrapper * {
    box-sizing: border-box;
}

/* ===== Mobile Filter Toggle ===== */
.mobile-filter-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--shop-bg);
    border: 1px solid var(--shop-border);
    border-radius: var(--shop-radius-sm);
    font-family: var(--shop-font);
    font-size: 14px;
    color: var(--shop-text);
    cursor: pointer;
    transition: var(--shop-transition);
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    box-shadow: var(--shop-shadow-hover);
}

.mobile-filter-toggle:hover {
    background: var(--shop-primary);
    color: #fff;
    border-color: var(--shop-primary);
}

/* ===== Sidebar Filters ===== */
.shop-filters {
    width: 280px;
    flex-shrink: 0;
    background: var(--shop-bg);
    border-radius: var(--shop-radius);
    box-shadow: var(--shop-shadow);
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--shop-border);
}

.filters-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--shop-text);
}

.close-filters {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--shop-text-light);
    padding: 5px;
}

/* ===== Filter Sections ===== */
.filter-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--shop-border);
}

.filter-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 15px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--shop-text);
}

.filter-title.collapsible {
    cursor: pointer;
    user-select: none;
}

.filter-title.collapsible svg {
    transition: transform 0.3s ease;
}

.filter-title.collapsible.collapsed svg {
    transform: rotate(-90deg);
}

.filter-content {
    max-height: 250px;
    overflow-y: auto;
    padding-left: 5px;
}

.filter-content::-webkit-scrollbar {
    width: 4px;
}

.filter-content::-webkit-scrollbar-track {
    background: var(--shop-secondary);
    border-radius: 2px;
}

.filter-content::-webkit-scrollbar-thumb {
    background: var(--shop-border);
    border-radius: 2px;
}

/* ===== Search Box ===== */
.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 1px solid var(--shop-border);
    border-radius: var(--shop-radius-sm);
    font-family: var(--shop-font);
    font-size: 14px;
    transition: var(--shop-transition);
}

.search-box input:focus {
    outline: none;
    border-color: none;
}

.search-box svg {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--shop-text-muted);
}

/* ===== Filter Checkboxes ===== */
.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    transition: var(--shop-transition);
}

.filter-checkbox:hover {
    color: var(--shop-primary);
}

.filter-checkbox input[type="checkbox"] {
    display: none;
}

.filter-checkbox .checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--shop-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--shop-transition);
    flex-shrink: 0;
}

.filter-checkbox input[type="checkbox"]:checked+.checkmark {
    background: var(--shop-primary);
    border-color: var(--shop-primary);
}

.filter-checkbox input[type="checkbox"]:checked+.checkmark::after {
    content: '✓';
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}

.filter-checkbox .label-text {
    flex: 1;
    font-size: 14px;
    color: var(--shop-text);
}

.filter-checkbox .count {
    font-size: 12px;
    color: var(--shop-text-muted);
}

/* Sub-categories indentation */
.sub-categories {
    padding-right: 20px;
    border-right: 2px solid var(--shop-border);
    margin-right: 8px;
}

/* ===== Price Range Slider ===== */
.price-range-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--shop-text);
}

.price-range-display .price-separator {
    color: var(--shop-text-muted);
}

.price-range-display .currency {
    font-size: 12px;
    color: var(--shop-text-muted);
    font-weight: 400;
}

.price-range-slider {
    position: relative;
    height: 40px;
    direction: ltr;
}

.slider-track {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    right: 0;
    height: 6px;
    background: var(--shop-border);
    border-radius: 3px;
}

.slider-range {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    background: var(--shop-primary);
    border-radius: 3px;
    left: 0;
    right: 0;
}

.price-range-slider input[type="range"] {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    z-index: 2;
    margin: 0;
    padding: 0;
}

.price-range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--shop-primary);
    border: 3px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.price-range-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.price-range-slider input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--shop-primary);
    border: 3px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ===== Filter Actions ===== */
.filter-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--shop-border);
}

.clear-filters-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: transparent;
    color: var(--shop-sale);
    border: 1px solid var(--shop-sale);
    border-radius: var(--shop-radius-sm);
    font-family: var(--shop-font);
    font-size: 14px;
    cursor: pointer;
    transition: var(--shop-transition);
}

.clear-filters-btn:hover {
    background: var(--shop-sale);
    color: #fff;
}

/* ===== Products Area ===== */
.shop-products {
    flex: 1;
    min-width: 0;
}

/* ===== Toolbar ===== */
.shop-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--shop-bg);
    border-radius: var(--shop-radius);
    box-shadow: var(--shop-shadow);
    margin-bottom: 20px;
}

.toolbar-right .results-count {
    font-size: 14px;
    color: var(--shop-text-light);
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sort-select select {
    padding: 10px 35px 10px 15px;
    border: 1px solid var(--shop-border);
    border-radius: var(--shop-radius-sm);
    font-family: var(--shop-font);
    font-size: 14px;
    background: var(--shop-bg);
    cursor: pointer;
    appearance: none;
    background-image: 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='%23666' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
}

.sort-select select:focus {
    outline: none;
    border-color: var(--shop-primary);
}

/* ===== Active Filters ===== */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.active-filters:empty {
    display: none;
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--shop-secondary);
    border-radius: 20px;
    font-size: 13px;
    color: var(--shop-text);
}

.active-filter-tag .remove-filter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: var(--shop-text-muted);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: var(--shop-transition);
}

.active-filter-tag .remove-filter:hover {
    background: var(--shop-sale);
}

/* ===== Products Grid ===== */
.products-grid {
    display: grid;
    gap: 20px;
    transition: opacity 0.3s ease;
}

.products-grid.columns-3 {
    grid-template-columns: repeat(4, 1fr);
}

.products-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.products-grid.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ===== Product Card ===== */
.product-card {
    background: #fff;
    border-radius: var(--shop-radius);
    overflow: hidden;
    transition: var(--shop-transition);
    position: relative;
    border: solid 1px #f1f1f1;
}

.product-card.out-of-stock {
    opacity: 0.7;
}

/* Badges */
.sale-badge,
.stock-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
}

.sale-badge {
    background: var(--shop-sale);
    color: #fff;
}

.stock-badge {
    background: var(--shop-text-muted);
    color: #fff;
    right: auto;
    left: 12px;
}

/* Product Image */
.product-image {
    display: block;
    position: relative;
    padding-top: 100%;
    overflow: hidden;
    background: var(--shop-secondary);
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

/* Product Info */
.product-info {
    padding: 15px;
}

.product-category {
    display: inline-block;
    font-size: 13px;
    color: var(--shop-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    text-decoration: none;
}

.product-title {
    margin: 0 0 24px 0;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.4;
	min-height: 50px;
}

.product-title a {
    color: var(--shop-text);
    text-decoration: none;
    transition: var(--shop-transition);
}

.product-title a:hover {
    color: var(--shop-primary);
}

/* Price Row - Price and View Button on same line */
.product-price-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 10px;
}

.product-price {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 42px;
    justify-content: flex-end;
}

span.old-price {
    position: absolute;
    bottom: 40px;
}

.product-price .old-price {
    font-size: 14px;
    color: var(--shop-text-muted);
    text-decoration: line-through;
    text-decoration-color: var(--shop-text-muted);
    font-weight: 400;
}

.product-price .current-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--shop-text);
}

/* Only sale products have red price */
.product-price.on-sale .current-price {
    color: var(--shop-sale);
}

/* Cart Button */
.product-cart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--shop-secondary);
    border-radius: 8px;
    color: var(--shop-text-light);
    transition: var(--shop-transition);
    flex-shrink: 0;
}

.product-cart-btn:hover {
    background: var(--shop-primary);
    color: #fff;
}

.product-cart-btn svg {
    width: 18px;
    height: 18px;
}

/* ===== No Products Found ===== */
.no-products-found {
    text-align: center;
    padding: 60px 20px;
    color: var(--shop-text-muted);
}

.no-products-found svg {
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-products-found p {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--shop-text);
}

.no-products-found span {
    font-size: 14px;
}

/* ===== Skeleton Loading ===== */
.products-skeleton {
    display: grid;
    gap: 20px;
}

.products-skeleton.columns-3 {
    grid-template-columns: repeat(4, 1fr);
}

.products-skeleton.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.skeleton-card {
    background: var(--shop-bg);
    border-radius: var(--shop-radius);
    overflow: hidden;
}

.skeleton-image {
    padding-top: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.skeleton-content {
    padding: 15px;
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 10px;
}

.skeleton-line.short {
    width: 40%;
    height: 12px;
}

.skeleton-line.medium {
    width: 60%;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ===== Pagination ===== */
.pagination-container {
    margin-top: 30px;
}

.shop-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.page-btn {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: var(--shop-bg);
    border: 1px solid var(--shop-border);
    border-radius: var(--shop-radius-sm);
    font-family: var(--shop-font);
    font-size: 14px;
    color: var(--shop-text);
    cursor: pointer;
    transition: var(--shop-transition);
}

.page-btn:hover {
    background: var(--shop-secondary);
    border-color: var(--shop-primary);
    color: var(--shop-primary);
}

.page-btn.active {
    background: var(--shop-primary);
    border-color: var(--shop-primary);
    color: #fff;
}

.page-btn.prev,
.page-btn.next {
    padding: 8px;
}

.page-dots {
    color: var(--shop-text-muted);
    font-size: 14px;
}

/* ===== Mobile Overlay ===== */
.filters-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.filters-overlay.active {
    display: block;
    opacity: 1;
}

body.filters-open {
    overflow: hidden;
}

/* Close filters button (mobile only) */
.close-filters-btn {
    display: none;
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .products-grid.columns-4 {
        grid-template-columns: repeat(3, 1fr);
    }

    .products-skeleton.columns-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .sfp-shop-wrapper {
        padding: 15px;
        gap: 20px;
    }

    .shop-filters {
        width: 250px;
    }

    .products-grid.columns-3,
    .products-grid.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .products-skeleton.columns-3,
    .products-skeleton.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .mobile-filter-toggle {
        display: flex;
    }

    .shop-filters {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        max-height: 80vh;
        z-index: 999;
        border-radius: 20px 20px 0 0;
        overflow-y: auto;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }

    .shop-filters.active {
        transform: translateY(0);
    }

    .close-filters-btn {
        display: block;
        position: absolute;
        top: 15px;
        left: 20px;
        background: none;
        border: none;
        font-size: 30px;
        line-height: 1;
        cursor: pointer;
        color: #333;
        z-index: 1001;
        padding: 0;
    }

    .sfp-shop-wrapper {
        flex-direction: column;
    }

    .shop-toolbar {
        flex-direction: row;
        gap: 10px;
    }

    .toolbar-right {
        flex: 1;
    }

    .toolbar-left {
        flex-shrink: 0;
    }

    .products-grid.columns-3,
    .products-grid.columns-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .products-skeleton.columns-3,
    .products-skeleton.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
	span.old-price {
    bottom: 33px;
}
	.product-title {
	min-height: 42px;
	}
	.product-title {
        font-size: 15px;
    }
}

@media (max-width: 480px) {

    .products-grid.columns-3,
    .products-grid.columns-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .products-skeleton.columns-3,
    .products-skeleton.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-info {
        padding: 10px;
    }
	.site-main .page-content {
    padding: 20px 0 20px 0;
}

    .product-price .current-price {
        font-size: 14px;
    }

    .product-cart-btn {
        width: 32px;
        height: 32px;
    }

    .product-cart-btn svg {
        width: 16px;
        height: 16px;
    }
}