/* Explore/Search Screen Styles */

/* ==================== BODY & HTML ==================== */
/* Normal page scroll, only sidebar is fixed height */
.explore-page-body {
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* ==================== HEADER ADJUSTMENTS ==================== */
/* Ensure header is visible and works properly on explore page */
.explore-page-body .header {
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* ==================== CONTAINER ==================== */
.explore-container {
    display: flex;
    align-items: flex-start;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 16px;
    gap: 24px;
    box-sizing: border-box;
    min-height: calc(100vh - 120px);
}

/* ==================== SIDEBAR - Modern E-commerce Style ==================== */
.explore-sidebar {
    width: 280px;
    min-width: 280px;
    max-height: calc(100vh - 160px);
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e8e8e8;
    position: sticky;
    top: 140px; /* Below header */
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e8e8e8;
    background: #ffffff;
    flex-shrink: 0;
    border-radius: 16px 16px 0 0;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    color: #333333;
    margin: 0;
    letter-spacing: -0.3px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 20px;
    min-height: 0;
    max-height: 100%;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.3s ease;
}

.sidebar-content:hover {
    scrollbar-color: #bdbdbd #f5f5f5;
}

/* Scrollbar - Hidden by default, shown on hover */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
    margin: 8px 0;
    transition: background 0.3s ease;
}

.sidebar-content:hover::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
    min-height: 30px;
    transition: background 0.3s ease;
}

.sidebar-content:hover::-webkit-scrollbar-thumb {
    background: #bdbdbd;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #9e9e9e;
}

.sidebar-content::-webkit-scrollbar-thumb:active {
    background: #757575;
}

/* Loading State */
.sidebar-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 12px;
    color: var(--secondary-text);
    font-size: 14px;
}

.sidebar-loading .loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Category Items - Modern Style */
.category-filter-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 6px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    border: 1px solid transparent;
}

.category-filter-item:hover {
    background: rgba(108, 99, 255, 0.08);
    border-color: rgba(108, 99, 255, 0.2);
    transform: translateX(2px);
}

.category-filter-item.active {
    background: rgba(108, 99, 255, 0.12);
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(108, 99, 255, 0.2);
}

.category-filter-item.active .category-filter-name {
    color: var(--accent);
    font-weight: 600;
}

.category-filter-item.active .category-filter-icon {
    box-shadow: 0 2px 8px rgba(108, 99, 255, 0.3);
}

.category-filter-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 10px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: none;
    transition: all 0.2s ease;
}

.category-filter-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-filter-name {
    font-size: 14px;
    font-weight: 500;
    color: #333333;
    flex: 1;
    transition: all 0.2s ease;
}

/* ==================== MAIN CONTENT ==================== */
.explore-main {
    flex: 1;
    min-width: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Top Bar - Modern E-commerce Style */
.explore-top-bar {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 20px;
    border: 1px solid #e8e8e8;
}

.explore-results-info {
    font-size: 15px;
    color: #666666;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.explore-results-info strong {
    color: #333333;
    font-weight: 700;
    font-size: 16px;
}

.explore-view-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    flex: 1;
    justify-content: flex-end;
}

.top-filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--background-color);
    border-radius: 8px;
    border: 1px solid #e8e8e8;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.top-filter-group:hover {
    border-color: var(--accent);
    background: rgba(108, 99, 255, 0.05);
}

.top-filter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-text);
    white-space: nowrap;
}

.price-inputs-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.price-input-inline {
    width: 90px;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: border-color 0.2s ease;
    outline: none;
    height: 40px;
    box-sizing: border-box;
}

.price-input-inline:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.price-separator {
    color: var(--secondary-text);
    font-weight: 500;
}

.discount-filter-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--background-color);
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    height: 40px;
    box-sizing: border-box;
}

.discount-filter-inline:hover {
    border-color: var(--accent);
    background: rgba(108, 99, 255, 0.05);
}

.discount-filter-inline input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
}

.sort-select-container {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.sort-select-container select {
    appearance: none;
    padding: 10px 40px 10px 16px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    background: white;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    min-width: 180px;
    height: 40px;
    box-sizing: border-box;
}

.sort-select-container select:hover {
    border-color: var(--accent);
    background: rgba(108, 99, 255, 0.02);
}

.sort-select-container select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.sort-select-container i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--secondary-text);
    font-size: 12px;
}

/* Products Grid - Same as index.html */
.explore-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

/* ==================== PRODUCT CARD - INHERIT FROM STYLE.CSS ==================== */
/* Product cards inside explore-products-grid should use same styles as index.html */
/* These styles ensure consistency between index.html and explore.html */

/* Force visibility of all product card elements */
.explore-products-grid .product-rating {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    margin-bottom: 8px !important;
    min-height: 18px !important;
}

.explore-products-grid .product-rating .stars {
    display: flex !important;
    align-items: center !important;
    gap: 1px !important;
}

.explore-products-grid .product-rating .stars i {
    font-size: 13px !important;
    color: #FFC107 !important;
}

.explore-products-grid .product-rating .rating-score {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--primary-text) !important;
    margin-left: 2px !important;
}

.explore-products-grid .product-rating .rating-count {
    font-size: 10.5px !important;
    font-weight: 500 !important;
    color: var(--light-gray) !important;
}

.explore-products-grid .product-spacer {
    flex: 1 !important;
    min-height: 1px !important;
}

.explore-products-grid .product-price-section {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-end !important;
    margin-top: auto !important;
}

.explore-products-grid .free-shipping-badge {
    display: block !important;
    background: rgba(108, 99, 255, 0.1) !important;
    border: 0.5px solid rgba(108, 99, 255, 0.3) !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    color: var(--accent) !important;
    white-space: nowrap !important;
    text-align: center !important;
    line-height: 1.5 !important;
}

/* Empty State */
.explore-empty {
    text-align: center;
    padding: 60px 20px;
}

.explore-empty i {
    font-size: 64px;
    color: var(--light-gray);
    margin-bottom: 16px;
}

.explore-empty h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-text);
    margin-bottom: 8px;
}

.explore-empty p {
    font-size: 14px;
    color: var(--secondary-text);
}

/* Loading */
.explore-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 20px;
}

.explore-loading .loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--background-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.explore-loading p {
    margin-top: 16px;
    font-size: 14px;
    color: var(--secondary-text);
}

/* Load More - Modern Style */
.load-more-container {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 20px;
}

.load-more-btn {
    padding: 14px 36px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(108, 99, 255, 0.3);
}

.load-more-btn:hover {
    background: #5a51e6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 99, 255, 0.4);
}

.load-more-btn:active {
    transform: translateY(0);
}

.load-more-btn:disabled {
    background: var(--light-gray);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* ==================== MOBILE ==================== */
@media (max-width: 1200px) {
    .explore-products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (max-width: 992px) {
    .explore-container {
        max-width: 100%;
        padding: 16px;
        gap: 0;
    }

    .explore-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.12);
    }

    .explore-sidebar.active {
        left: 0;
    }

    .explore-main {
        width: 100%;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .mobile-filter-btn {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        background: var(--accent);
        color: white;
        border: none;
        border-radius: 50%;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 900;
    }

}

@media (max-width: 768px) {
    .explore-container {
        padding: 0 12px;
    }

    .explore-main {
        padding: 12px;
    }

    .explore-top-bar {
        flex-direction: column;
        align-items: stretch;
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
