/* مستر اير - Shop Page (تصميم العالمية) */

/* ============ Brand Description Bar ============ */
.brand-description-bar {
    background: #f0f7ff;
    padding: 1rem 0;
    margin-bottom: 0;
    border-bottom: 1px solid #e0ecf5;
}
.brand-description-text {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.8;
    margin: 0;
    text-align: right;
}

/* ============ Brand Cards Grid (Categories Mode) ============ */
.brand-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 0.5rem 0;
}
.brand-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 1.5rem 1rem 1rem;
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.3s;
    overflow: hidden;
}
.brand-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(0,119,200,0.1);
    transform: translateY(-2px);
}
.brand-card-img {
    width: 100%;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}
.brand-card-img img {
    max-width: 85%;
    max-height: 120px;
    object-fit: contain;
}
.brand-card-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    text-align: center;
}

/* ============ Shop Layouts ============ */

/* Categories layout (no filters) */
.shop-categories-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}
.shop-categories-layout .shop-sidebar {
    width: 260px;
    flex-shrink: 0;
    order: 2;
}
.shop-categories-layout .shop-categories-area {
    flex: 1;
    order: 1;
}

/* Products layout (with filters) */
.shop-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}
.shop-layout .shop-sidebar {
    width: 260px;
    flex-shrink: 0;
    order: 2;
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    scrollbar-width: thin;
}
.shop-layout .shop-products-area {
    flex: 1;
    order: 1;
    min-width: 0;
}

/* ============ Desktop Sidebar ============ */
.shop-sidebar {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 1.25rem;
}

/* ============ Shop Products Toolbar ============ */
.shop-products-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.shop-breadcrumb { margin: 0; }
.shop-breadcrumb .breadcrumb-list { margin: 0; padding: 0; }

.shop-toolbar-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Per Page */
.shop-perpage {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: #666;
}
.shop-perpage span {
    font-weight: 600;
    margin-left: 0.3rem;
}
.pp-opt {
    color: #999;
    text-decoration: none;
    font-weight: 600;
    padding: 0.15rem 0.3rem;
    font-size: 0.85rem;
    transition: color 0.2s;
}
.pp-opt:hover, .pp-opt.active {
    color: var(--primary);
}

/* Grid View Toggle */
.shop-grid-toggle {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.grid-opt {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #aaa;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.9rem;
}
.grid-opt:hover, .grid-opt.active {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(0,119,200,0.05);
}

/* Filter Button (visible on mobile) */
.shop-filter-btn {
    display: none;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    font-family: inherit;
    color: #333;
    transition: all 0.2s;
}
.shop-filter-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ============ NEW Filter System (sf- prefix) ============ */

/* --- Filter Sections --- */
.sf-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #f0f0f0;
}
.sf-section--last, .sf-section:last-of-type { border-bottom: none; }
.sf-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-dark, #082A4A);
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-align: right;
}
.sf-title i {
    font-size: 0.8rem;
    color: var(--primary);
    width: 20px;
    text-align: center;
}

/* --- Custom Checkboxes --- */
.sf-options { display: flex; flex-direction: column; gap: 0.35rem; }
.sf-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.88rem;
    color: #444;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    position: relative;
    user-select: none;
}
.sf-option:hover { background: #f0f7ff; }
.sf-option--active { background: #eaf4ff; }
.sf-option--disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Hide native checkbox */
.sf-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Custom check mark */
.sf-check-mark {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid #ccc;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
    background: #fff;
    order: 1;
}
.sf-check-mark::after {
    content: '';
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
    margin-top: -2px;
}
.sf-checkbox:checked + .sf-check-mark {
    background: var(--primary);
    border-color: var(--primary);
}
.sf-checkbox:checked + .sf-check-mark::after {
    transform: rotate(45deg) scale(1);
}
.sf-option:hover .sf-check-mark {
    border-color: var(--primary);
}

.sf-option-label {
    flex: 1;
    order: 0;
    line-height: 1.4;
}
.sf-option-count {
    color: #999;
    font-size: 0.78rem;
    order: 2;
    min-width: 28px;
    text-align: center;
}
.sf-option--disabled .sf-option-count { color: #ccc; }

/* --- Premium Price Slider --- */
.sf-price-wrap { text-align: right; }
.sf-price-slider {
    position: relative;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    margin: 1.5rem 0 1rem;
}
.sf-slider-track {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #00a3e0);
    border-radius: 3px;
    transition: left 0.05s, right 0.05s;
}
.sf-slider-thumb {
    position: absolute;
    width: 100%;
    height: 6px;
    top: 0;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    margin: 0;
    padding: 0;
}
.sf-slider-thumb::-webkit-slider-runnable-track {
    height: 6px;
    background: transparent;
}
.sf-slider-thumb::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,119,200,0.35);
    cursor: pointer;
    pointer-events: all;
    position: relative;
    z-index: 2;
    margin-top: -8px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.sf-slider-thumb:active::-webkit-slider-thumb,
.sf-slider--active .sf-slider-thumb::-webkit-slider-thumb {
    transform: scale(1.25);
    box-shadow: 0 3px 12px rgba(0,119,200,0.5);
}
.sf-slider-thumb::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,119,200,0.35);
    cursor: pointer;
    pointer-events: all;
}
.sf-slider-thumb::-moz-range-track {
    background: transparent;
    border: none;
    height: 6px;
}

/* Tooltips */
.sf-slider-tooltip {
    position: absolute;
    top: -36px;
    transform: translateX(-50%);
    background: var(--primary-dark, #082A4A);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 5;
}
.sf-slider-tooltip::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 4px 4px 0;
    border-style: solid;
    border-color: var(--primary-dark, #082A4A) transparent transparent;
}
.sf-slider-tooltip.active { opacity: 1; }

/* Price display */
.sf-price-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: #555;
    margin-bottom: 0.75rem;
    direction: rtl;
}
.sf-price-display strong {
    color: var(--primary-dark, #082A4A);
    font-weight: 700;
}

/* Apply button */
.sf-apply-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.55rem 1rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}
.sf-apply-btn:hover { background: var(--primary-hover, #005FA3); }
.sf-apply-btn:active { transform: scale(0.97); }

/* Clear filters */
.sf-clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.55rem 1rem;
    background: #fff;
    color: var(--danger, #E53935);
    border: 1px solid #eee;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 1rem;
}
.sf-clear-btn:hover { background: #fff5f5; border-color: var(--danger); }

/* --- Active Filters Bar --- */
.sf-active-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 0;
    margin-bottom: 0.75rem;
}
.sf-active-count {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary-dark);
    white-space: nowrap;
}
.sf-active-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    flex: 1;
}
.sf-active-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    background: #eaf4ff;
    color: var(--primary-dark);
    border: 1px solid #d0e5f7;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
}
.sf-active-tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.7rem;
    padding: 0;
    border-radius: 50%;
    transition: all 0.15s;
}
.sf-active-tag-remove:hover {
    background: var(--primary);
    color: #fff;
}
.sf-active-clear {
    font-size: 0.78rem;
    color: var(--danger);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
    transition: opacity 0.2s;
}
.sf-active-clear:hover { opacity: 0.7; }

/* --- Empty State Premium --- */
.sf-empty-state {
    text-align: center;
    padding: 3.5rem 1.5rem;
    background: #fff;
    border-radius: 12px;
    border: 1px dashed #d0e5f7;
}
.sf-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.25rem;
    background: #f0f7ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: sf-empty-bounce 2s ease-in-out infinite;
}
.sf-empty-icon i {
    font-size: 2rem;
    color: var(--primary);
}
@keyframes sf-empty-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.sf-empty-state h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 0.5rem;
}
.sf-empty-state p {
    font-size: 0.9rem;
    color: #777;
    margin: 0 0 1.25rem;
}
.sf-empty-state .sf-clear-btn {
    display: inline-flex;
    width: auto;
    margin-top: 0;
}

/* --- Loading Skeleton --- */
.sf-loading { pointer-events: none; }
.sf-skeleton-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eee;
}
.sf-skeleton-img {
    width: 100%;
    padding-top: 100%;
    background: #f0f0f0;
}
.sf-skeleton-body { padding: 0.75rem; }
.sf-skeleton-line {
    height: 12px;
    border-radius: 4px;
    background: #f0f0f0;
    margin-bottom: 0.6rem;
}
.sf-skeleton-line--title { width: 85%; }
.sf-skeleton-line--short { width: 50%; }
.sf-skeleton-line--price { width: 60%; height: 16px; }
.sf-skeleton-line--btn { width: 100%; height: 32px; margin-bottom: 0; border-radius: 6px; }
.sf-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 400% 100%;
    animation: sf-shimmer 1.5s ease-in-out infinite;
}
@keyframes sf-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Mobile Filter Button (Enhanced) --- */
.shop-filter-btn {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    font-family: inherit;
    color: #fff;
    transition: all 0.2s;
    position: relative;
}
.shop-filter-btn:hover { background: var(--primary-hover, #005FA3); }
.shop-filter-btn .sf-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    background: var(--accent, #FF8A00);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 9px;
    padding: 0 4px;
}

/* ============ Product Grid ============ */
.shop-grid { gap: 1rem; }

/* Grid view columns */
.shop-grid.grid-5 { grid-template-columns: repeat(5, 1fr) !important; }
.shop-grid.grid-4 { grid-template-columns: repeat(4, 1fr) !important; }
.shop-grid.grid-3 { grid-template-columns: repeat(3, 1fr) !important; }
.shop-grid.grid-2 { grid-template-columns: repeat(2, 1fr) !important; }

/* ============ Pagination ============ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    transition: all 0.2s;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination span.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ============ Empty State (Legacy compat) ============ */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #999;
}
.empty-state i { font-size: 3rem; margin-bottom: 1rem; color: #ddd; }
.empty-state h3 { margin-bottom: 0.5rem; color: #666; }

/* ============ Mobile Filter Drawer (Enhanced) ============ */
.shop-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    backdrop-filter: blur(2px);
}
.shop-drawer-overlay.active { display: block; }

.shop-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 320px;
    height: 100vh;
    height: 100dvh;
    background: #fff;
    z-index: 1001;
    box-shadow: -5px 0 30px rgba(0,0,0,0.2);
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.shop-drawer.active { right: 0; }

.shop-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eee;
    background: linear-gradient(135deg, var(--primary-dark, #082A4A), var(--primary));
    color: #fff;
    flex-shrink: 0;
}
.shop-drawer-title {
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.shop-drawer-close {
    background: rgba(255,255,255,0.15);
    border: none;
    font-size: 1rem;
    color: #fff;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.shop-drawer-close:hover { background: rgba(255,255,255,0.25); }

.shop-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Drawer Footer (mobile only) */
.shop-drawer-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid #eee;
    background: #fafbfc;
    flex-shrink: 0;
}
.shop-drawer-footer .sf-drawer-apply {
    flex: 1;
    padding: 0.65rem 1rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: background 0.2s;
}
.shop-drawer-footer .sf-drawer-apply:hover { background: var(--primary-hover, #005FA3); }
.shop-drawer-footer .sf-drawer-clear {
    padding: 0.65rem 1rem;
    background: #fff;
    color: var(--danger, #E53935);
    border: 1px solid #eee;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.shop-drawer-footer .sf-drawer-clear:hover { background: #fff5f5; border-color: var(--danger); }

/* ============ Desktop Responsive ============ */
@media (min-width: 769px) {
    .shop-filter-btn { display: none !important; }
    .shop-drawer-overlay, .shop-drawer { display: none !important; }
}

/* ============ Mobile Responsive ============ */
@media (max-width: 768px) {
    /* Hide desktop sidebar */
    .shop-sidebar { display: none !important; }
    .shop-filter-btn { display: flex !important; }
    
    /* Show mobile drawer */
    .shop-drawer { display: flex; width: 88vw; max-width: 360px; }
    .shop-drawer-overlay { display: none; }
    .shop-drawer-overlay.active { display: block; }

    /* Categories grid */
    .shop-categories-area { width: 100%; }
    .brand-cards-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; width: 100%; }
    .brand-card { padding: 1rem 0.75rem 0.75rem; }
    .brand-card-img { height: 90px; }
    .brand-card-img img { max-height: 75px; }
    .brand-card-name { font-size: 0.85rem; }

    /* Products grid */
    .shop-grid.grid-4,
    .shop-grid.grid-5,
    .shop-grid.grid-3 { grid-template-columns: repeat(2, 1fr) !important; }

    /* Layout */
    .shop-layout,
    .shop-categories-layout { flex-direction: column; align-items: stretch; }

    /* Toolbar */
    .shop-products-toolbar { flex-direction: column; align-items: flex-start; }
    .shop-toolbar-controls { width: 100%; justify-content: space-between; }
    .shop-perpage { display: none; }
    .grid-opt:nth-child(1), .grid-opt:nth-child(2) { display: none; }

    /* Active filters bar mobile */
    .sf-active-bar { padding: 0.5rem 0; }
    .sf-active-count { font-size: 0.82rem; width: 100%; }
}

@media (max-width: 480px) {
    .brand-cards-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .brand-card { padding: 0.75rem 0.5rem 0.5rem; }
    .brand-card-img { height: 70px; }
    .brand-card-img img { max-height: 60px; }
    .brand-card-name { font-size: 0.8rem; }
    .shop-drawer { width: 92vw; }
}
