/* ============================================
   PRODUCTS OVERHAUL - COMMAND CONSOLE STYLE
   ============================================ */

.products-layout-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 40px;
    position: relative;
    z-index: 10;
    margin-top: 40px;
}

/* --- SIDEBAR: COMMAND CONSOLE --- */
.command-console-sidebar {
    position: sticky;
    top: 110px;
    height: fit-content;
    background: var(--glass-bg-dark);
    backdrop-filter: blur(25px) saturate(2);
    -webkit-backdrop-filter: blur(25px) saturate(2);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 30px;
    box-shadow: var(--elevation-4), 0 0 40px rgba(34, 211, 238, 0.05);
    overflow: hidden;
    transition: all 0.5s var(--ease-cinematic);
}

.command-console-sidebar:hover {
    border-color: var(--glass-border-hover);
    background: var(--glass-bg-medium);
    transform: translateY(-8px);
    box-shadow: var(--elevation-4), var(--glow-cyan);
}

.command-console-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
    opacity: 0.8;
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.console-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--accent-cyan);
    text-transform: uppercase;
    text-shadow: var(--glow-cyan);
    display: flex;
    align-items: center;
    gap: 12px;
}

.console-title i {
    font-size: 0.8rem;
}

/* --- FILTERS --- */
.filter-section {
    margin-bottom: 30px;
}

.filter-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
}

/* Tech Checkboxes */
.tech-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tech-checkbox {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
    text-decoration: none;
    color: var(--text-secondary);
}

.tech-checkbox:hover {
    background: rgba(34, 211, 238, 0.04);
    border-color: rgba(34, 211, 238, 0.1);
    transform: translateX(5px);
}

.tech-checkbox.active {
    background: var(--glass-bg-light);
    border-color: var(--accent-cyan);
    box-shadow: var(--elevation-2), var(--glow-cyan);
    color: #fff;
}

.checkbox-visual {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, opacity 0.2s, background-color 0.2s, border-color 0.2s;
}

.tech-checkbox.active .checkbox-visual {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

.checkbox-visual i {
    font-size: 10px;
    color: #000;
    opacity: 0;
    transform: scale(0);
    transition: transform 0.2s, opacity 0.2s, background-color 0.2s, border-color 0.2s;
}

.tech-checkbox.active .checkbox-visual i {
    opacity: 1;
    transform: scale(1);
}

/* Search Input */
.console-search {
    position: relative;
}

.console-search input {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 14px 14px 14px 45px;
    color: var(--text-primary);
    font-family: var(--font-body);
    transition: all 0.4s var(--ease-tech);
}

.console-search input:focus {
    outline: none;
    border-color: #22d3ee;
    box-shadow:
        0 0 0 3px rgba(34, 211, 238, 0.08),
        0 0 20px rgba(34, 211, 238, 0.1);
    background: rgba(6, 8, 20, 0.8);
}

.console-search i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.console-search input:focus+i {
    color: var(--accent-cyan);
}

/* --- GRID AREA --- */
.products-main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.results-count {
    font-family: var(--font-heading);
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.results-count span {
    color: #fff;
    font-weight: 700;
}

/* --- PRODUCT CARD REINVENTED --- */
.cyber-card {
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.6), rgba(6, 8, 20, 0.8));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(34, 211, 238, 0.05);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.cyber-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(34, 211, 238, 0.08);
    border-color: rgba(34, 211, 238, 0.15);
    z-index: 5;
}

.cyber-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    box-shadow: inset 0 1px 0 rgba(34, 211, 238, 0.06);
    pointer-events: none;
}

.cyber-card:hover::after {
    box-shadow: inset 0 1px 0 rgba(34, 211, 238, 0.12);
}

.card-image-wrapper {
    position: relative;
    padding-top: 60%;
    /* Aspect Ratio */
    overflow: hidden;
    background: #0f0f13;
}

.card-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.cyber-card:hover .card-image-wrapper img {
    transform: scale(1.1);
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(5, 5, 10, 0.9), transparent);
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.cyber-card:hover .card-overlay {
    opacity: 0.8;
}

.card-badges {
    position: absolute;
    top: 15px;
    left: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2;
}

.card-platform-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    z-index: 2;
    text-decoration: none;
    transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

.cyber-card:hover .card-platform-icon {
    background: var(--accent-cyan);
    color: #000;
    transform: rotate(360deg);
}

.card-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.card-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 5px;
    line-height: 1.4;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    margin-top: auto;
    /* Push to bottom if content is short */
    padding-top: 15px;
}

.meta-item {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.price-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.price-display {
    display: flex;
    flex-direction: column;
}

.price-value {
    font-family: 'Outfit', var(--font-heading);
    font-weight: 900;
    font-size: 1.3rem;
    background: linear-gradient(135deg, #22d3ee, #2b50bc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.2));
}

.old-price {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.btn-card-action {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease, color 0.3s ease;
    text-decoration: none;
}

.cyber-card:hover .btn-card-action {
    background: linear-gradient(135deg, #22d3ee, #2b50bc);
    color: #fff;
    box-shadow: 0 4px 15px rgba(34, 211, 238, 0.25);
    transform: scale(1.05);
}

.out-of-stock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.stock-tag {
    padding: 8px 20px;
    background: var(--accent-red);
    color: #fff;
    font-weight: 800;
    text-transform: uppercase;
    font-family: var(--font-heading);
    letter-spacing: 2px;
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
    transform: rotate(-5deg);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease backwards;
}

/* --- RTL SUPPORT --- */
[dir="rtl"] .products-layout-grid {
    /* In RTL, the first column (Sidebar) starts from the right. 
       So we keep 320px 1fr to have Sidebar (Right) and Main (Left) */
    grid-template-columns: 320px 1fr;
}

@media (max-width: 1024px) {
    [dir="rtl"] .products-layout-grid {
        grid-template-columns: 1fr;
    }
}

[dir="rtl"] .console-title {
    flex-direction: row-reverse;
}

[dir="rtl"] .console-search i {
    left: auto;
    right: 16px;
}

[dir="rtl"] .console-search input {
    padding: 14px 45px 14px 14px;
    text-align: right;
}

[dir="rtl"] .filter-label {
    flex-direction: row-reverse;
}

[dir="rtl"] .tech-checkbox {
    flex-direction: row-reverse;
    text-align: right;
}

[dir="rtl"] .tech-checkbox:hover {
    transform: translateX(-5px);
}

[dir="rtl"] .tech-checkbox span {
    margin-right: 0;
    margin-left: auto;
    /* Push text to right in flex-reverse */
}

/* Fix for card badges in RTL */
[dir="rtl"] .card-platform-icon {
    left: 15px;
    right: auto;
}

[dir="rtl"] .card-badges {
    left: auto;
    /* Remove LTR positioning */
    right: 15px;
    align-items: flex-end;
    /* Align badges to the right edge */
}

[dir="rtl"] .meta-item {
    flex-direction: row-reverse;
}

/* ═══ MOBILE RESPONSIVE ═══ */
@media (max-width: 768px) {
    .command-console-sidebar {
        padding: 20px;
        border-radius: 18px;
    }

    .products-main-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        margin-bottom: 20px;
    }

    .cyber-card {
        border-radius: 16px;
    }

    .cyber-card:hover {
        transform: none;
    }

    .card-content {
        padding: 14px;
    }

    .card-title {
        font-size: 0.95rem;
        line-height: 1.3;
    }

    .card-meta {
        gap: 10px;
        margin-bottom: 14px;
        padding-top: 10px;
    }

    .meta-item {
        font-size: 0.72rem;
    }

    .price-section {
        margin-top: 10px;
        padding-top: 10px;
    }

    .price-value {
        font-size: 1.1rem;
    }

    .btn-card-action {
        width: 42px;
        height: 42px;
        border-radius: 10px;
    }

    .card-badges {
        top: 10px;
        left: 10px;
    }

    .card-platform-icon {
        top: 10px;
        right: 10px;
        width: 30px;
        height: 30px;
    }

    /* .filter-tag removed from here as it's now global below */
}

/* --- UTILITY COMPONENTS --- */
.nexus-input, .nexus-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    transition: all 0.3s var(--ease-tech);
    outline: none;
}

.nexus-input:focus, .nexus-select:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(34, 211, 238, 0.15);
    background: var(--glass-bg-dark);
}

.hero-tagline {
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 4px;
    font-size: 0.75rem;
    margin-top: 16px;
    color: var(--text-secondary);
}

.category-nav {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.cat-btn-premium {
    padding: 10px 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.4s var(--ease-cinematic);
    letter-spacing: 1px;
}

.cat-btn-premium:hover, .cat-btn-premium.active {
    background: var(--glass-bg-medium);
    border-color: var(--accent-cyan);
    color: #fff;
    transform: translateY(-3px);
    box-shadow: var(--elevation-2), var(--glow-cyan);
}

.cat-btn-premium.active {
    background: var(--accent-cyan);
    color: var(--bg-primary);
}

/* --- CONSOLE ACTIONS --- */
.console-actions {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 12px;
    padding-top: 20px;
    margin-top: 10px;
    border-top: 1px solid var(--glass-border);
}

/* --- RESULTS HEADER --- */
.results-header-premium {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    margin-bottom: 30px;
    background: var(--glass-bg-light);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    box-shadow: var(--elevation-2);
}

.results-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.results-count {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.count-value {
    color: var(--accent-cyan);
    font-weight: 900;
    text-shadow: var(--glow-cyan);
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sort-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.sort-select {
    width: auto !important;
    padding: 6px 30px 6px 12px !important;
    font-size: 0.8rem !important;
    border-radius: 10px !important;
}

/* --- EMPTY STATE --- */
.empty-state-premium {
    text-align: center;
    padding: 80px 40px;
    border-radius: 32px;
    background: var(--glass-bg-light);
    border: 2px dashed var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.empty-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 12px;
    text-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.empty-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 400px;
    margin: 0 auto 32px;
    line-height: 1.6;
}

/* --- FILTER TAGS & LINKS --- */
.active-filters-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
    align-items: center;
}

.filter-tag {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--glass-bg-medium);
    border: 1px solid var(--glass-border-hover);
    border-radius: 40px;
    color: var(--accent-cyan);
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.3s ease;
}

.filter-tag:hover {
    background: var(--accent-cyan);
    color: var(--bg-primary);
    transform: translateY(-2px);
}

.filter-tag i {
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0.7;
}

.clear-all-link {
    font-size: 0.75rem;
    color: var(--accent-pink);
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-decoration: none;
    margin-left: 15px;
    transition: all 0.3s ease;
}

.clear-all-link:hover {
    color: #fff;
    text-shadow: 0 0 10px var(--accent-pink);
}

/* RTL Adjustments */
[dir="rtl"] .console-actions {
    grid-template-columns: 1fr 1.5fr;
}

[dir="rtl"] .clear-all-link {
    margin-left: 0;
    margin-right: 15px;
}
