/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Light/Dark Mode Variables */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
}

.dark {
    --bg-primary: #0a0a1a;
    --bg-secondary: #0f0f23;
    --bg-card: #1a1a2e;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --border-color: #374151;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

.dark ::-webkit-scrollbar-track,
:root.dark ::-webkit-scrollbar-track {
    background: #1a1a2e;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.dark ::-webkit-scrollbar-thumb,
:root.dark ::-webkit-scrollbar-thumb {
    background: #6366f1;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8b5cf6;
}

/* Light Mode Overrides */
html:not(.dark) header {
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: #e5e7eb !important;
}

html:not(.dark) .bg-dark,
html:not(.dark) .bg-dark\/95,
html:not(.dark) .bg-dark\/50,
html:not(.dark) .bg-dark\/30 {
    background: #ffffff !important;
}

html:not(.dark) .bg-darker {
    background: #f8fafc !important;
}

html:not(.dark) .bg-card,
html:not(.dark) .bg-card\/50 {
    background: #ffffff !important;
    border-color: #e5e7eb !important;
}

html:not(.dark) .border-gray-800,
html:not(.dark) .border-gray-700 {
    border-color: #e5e7eb !important;
}

html:not(.dark) .text-gray-100,
html:not(.dark) .text-white {
    color: #1f2937 !important;
}

html:not(.dark) .text-gray-300,
html:not(.dark) .text-gray-400 {
    color: #6b7280 !important;
}

html:not(.dark) input,
html:not(.dark) .bg-card input {
    background: #f8fafc !important;
    border-color: #e5e7eb !important;
    color: #1f2937 !important;
}

html:not(.dark) footer {
    background: #ffffff !important;
    border-color: #e5e7eb !important;
}

html:not(.dark) table th,
html:not(.dark) table td {
    border-color: #e5e7eb !important;
}

html:not(.dark) table th[style*="background-color: #0F0F23"] {
    background-color: #f1f5f9 !important;
}

/* Product Card Styles */
.product-card {
    background: linear-gradient(145deg, #1a1a2e 0%, #16162a 100%);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    border-color: rgba(0, 217, 255, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 30px rgba(0, 217, 255, 0.1);
}

.product-card .image-wrapper {
    position: relative;
    padding-top: 60%;
    overflow: hidden;
}

.product-card .image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .image-wrapper img {
    transform: scale(1.1);
}

.product-card .discount-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 10;
}

.product-card .platform-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    padding: 0.5rem;
    border-radius: 0.5rem;
    z-index: 10;
}

.product-card .quick-add {
    position: absolute;
    bottom: -50px;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
    padding: 1rem;
    transition: bottom 0.3s ease;
}

.product-card:hover .quick-add {
    bottom: 0;
}

/* Category Link Active State */
.category-link.active {
    background: rgba(99, 102, 241, 0.2);
    color: #00d9ff;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #1a1a2e 25%, #2a2a3e 50%, #1a1a2e 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* List View Styles */
.list-view .product-card {
    display: flex;
    flex-direction: row;
}

.list-view .product-card .image-wrapper {
    width: 200px;
    padding-top: 0;
    height: 150px;
    flex-shrink: 0;
}

.list-view .product-card .product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Pulse Animation for Cart */
@keyframes pulse-ring {
    0% {
        transform: scale(0.33);
    }
    80%, 100% {
        opacity: 0;
    }
}

.cart-pulse {
    animation: pulse-ring 0.5s ease-out;
}

/* Toast Animation */
.toast-show {
    transform: translateY(0) !important;
    opacity: 1 !important;
}

/* Search Results Dropdown */
#searchResults .search-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s ease;
}

#searchResults .search-item:hover {
    background: rgba(99, 102, 241, 0.2);
}

#searchResults .search-item:last-child {
    border-bottom: none;
}

/* Modal Backdrop Animation */
#cartModal.show {
    display: flex !important;
}

/* Price Styles */
.old-price {
    text-decoration: line-through;
    color: #6b7280;
    font-size: 0.875rem;
}

.current-price {
    color: #00d9ff;
    font-size: 1.25rem;
    font-weight: bold;
}

/* Button Hover Effects */
.add-to-cart-btn {
    position: relative;
    overflow: hidden;
}

.add-to-cart-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.add-to-cart-btn:hover::before {
    left: 100%;
}

/* Platform Icons */
.platform-steam { color: #1b2838; }
.platform-epic { color: #2f2f2f; }
.platform-ubisoft { color: #0070ff; }
.platform-origin { color: #f56c2d; }

/* Responsive Adjustments */
@media (max-width: 640px) {
    .product-card .quick-add {
        bottom: 0;
    }
}

/* Mobile Header Fixes */
@media (max-width: 768px) {
    /* Top bar controls */
    .top-bar-controls {
        gap: 8px;
    }

    /* Mobile menu container */
    .mobile-menu-container {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .mobile-menu-container::-webkit-scrollbar {
        display: none;
    }

    /* Mobile menu nav */
    .mobile-menu-nav {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        padding: 0 4px;
        min-width: max-content;
    }

    /* Mobile menu items */
    .mobile-menu-item {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 6px 10px;
        font-size: 13px;
    }

    /* GB Table filters - mobile */
    .gb-filter-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    .gb-filter-row > * {
        width: 100%;
    }

    .gb-game-logos {
        justify-content: center;
        margin-bottom: 8px;
    }

    .gb-game-logos img {
        width: 80px !important;
        height: 32px !important;
    }

    .gb-filters-group {
        flex-direction: column;
        gap: 8px;
    }

    .gb-filters-group select,
    .gb-filters-group .multi-select-dropdown {
        width: 100%;
    }

    .gb-auto-refresh {
        justify-content: center;
        margin-top: 4px;
    }

    /* Multi-select dropdown mobile */
    .multi-select-dropdown {
        width: 100%;
        min-width: unset;
    }

    .multi-select-btn {
        width: 100%;
        justify-content: space-between;
    }

    .multi-select-text {
        max-width: unset;
        flex: 1;
        text-align: left;
    }

    .multi-select-menu {
        min-width: 100%;
        left: 0;
        right: 0;
    }

    /* Table header on mobile */
    .gb-table-title {
        font-size: 16px !important;
        flex-wrap: wrap;
    }

    .gb-table-title i {
        margin-right: 8px !important;
    }

    /* Footer grid mobile */
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 24px;
    }

    /* Blog grid mobile */
    .blog-grid-home {
        grid-template-columns: 1fr !important;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    /* Header logo smaller */
    .site-logo {
        font-size: 16px !important;
    }

    /* Theme toggle smaller */
    #themeToggle {
        width: 48px !important;
        height: 22px !important;
    }

    #toggleKnob {
        width: 18px !important;
        height: 18px !important;
    }

    /* Language button smaller */
    #langToggle {
        padding: 2px 6px !important;
    }

    #langToggle .lang-text {
        font-size: 10px !important;
    }

    /* GB table font sizes */
    .gb-table-title {
        font-size: 14px !important;
    }

    /* Mobile menu smaller text */
    .mobile-menu-item {
        font-size: 12px;
        padding: 5px 8px;
    }

    /* Hero slider height */
    #heroSlider .h-\[180px\] {
        height: 120px !important;
    }
}

/* Cart Item Styles */
.cart-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 0.5rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Multi-Select Dropdown */
.multi-select-dropdown {
    position: relative;
    min-width: 160px;
}

.multi-select-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 6px 12px;
    background: #0f0f23;
    border: 1px solid #374151;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.multi-select-btn:hover {
    border-color: #eab308;
}

.multi-select-dropdown.open .multi-select-btn {
    border-color: #eab308;
}

.multi-select-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.multi-select-dropdown.open .multi-select-arrow {
    transform: rotate(180deg);
}

.multi-select-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.multi-select-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #1a1a2e;
    border: 1px solid #374151;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 100;
    display: none;
    min-width: 200px;
}

.multi-select-dropdown.open .multi-select-menu {
    display: block;
}

.multi-select-search {
    padding: 8px;
    border-bottom: 1px solid #374151;
}

.multi-select-search-input {
    width: 100%;
    padding: 6px 10px;
    background: #0f0f23;
    border: 1px solid #374151;
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
    outline: none;
}

.multi-select-search-input:focus {
    border-color: #eab308;
}

.multi-select-search-input::placeholder {
    color: #6b7280;
}

.multi-select-options {
    max-height: 200px;
    overflow-y: auto;
    padding: 4px 0;
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 13px;
    color: #d1d5db;
}

.multi-select-option:hover {
    background: rgba(234, 179, 8, 0.1);
}

.multi-select-option.selected {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.multi-select-option input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #eab308;
    cursor: pointer;
}

.multi-select-actions {
    display: flex;
    gap: 8px;
    padding: 8px;
    border-top: 1px solid #374151;
}

.multi-select-action-btn {
    flex: 1;
    padding: 5px 8px;
    background: #374151;
    border: none;
    border-radius: 4px;
    color: #9ca3af;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.multi-select-action-btn:hover {
    background: #4b5563;
    color: #fff;
}
