/* ==========================================================================
   Public Products Page Styles
   ========================================================================== */

/* 1. Hero Banner */
.products-hero {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-surface, #0f172a);
    color: #ffffff;
    text-align: center;
    position: relative;
    margin-bottom: 2.5rem;
}

.hero-content {
    width: 100%;
    max-width: 1300px;
    padding: 0 1.5rem;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
}

.hero-subtitle {
    font-size: 1.15rem;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

.hero-breadcrumbs {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1.25rem;
    border-radius: 30px;
    backdrop-filter: blur(4px);
}

.hero-breadcrumbs a {
    color: #ffffff;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.hero-breadcrumbs a:hover {
    opacity: 1;
}

.hero-breadcrumbs .separator {
    opacity: 0.5;
}

.hero-breadcrumbs .current {
    color: var(--accent-primary, #818cf8);
}

/* 2. Main Layout Container */
.products-container {
    max-width: 1300px;
    margin: 3.5rem auto 0 auto;
    padding: 0 1.5rem 5rem 1.5rem;
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
}

/* 3. Left Sidebar */
.products-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    box-sizing: border-box;
}

.sidebar-header-mobile {
    display: none;
}

.sidebar-widget {
    background: var(--sidebar-bg-custom, var(--bg-surface, #ffffff));
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}

.widget-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--bg-hover);
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cat-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.cat-link:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.cat-link.active {
    background: var(--accent-primary);
    color: #ffffff;
}

.cat-count {
    background: var(--bg-hover);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.cat-link.active .cat-count {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* 4. Right Content */
.products-main {
    flex: 1;
    min-width: 0;
}

.products-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

#showing-results-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.product-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
}

#product-search-input {
    width: 250px;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    background: var(--bg-surface);
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

#product-search-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.mobile-filter-btn {
    display: none;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    align-items: center;
    gap: 0.5rem;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: var(--bg-surface, #ffffff);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-primary);
}

.product-card-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
}

.product-image-wrap {
    position: relative;
    height: 200px;
    background: var(--bg-hover);
    overflow: hidden;
}

.product-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .product-image-wrap img {
    transform: scale(1.08);
}

.product-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.product-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: var(--accent-primary);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    z-index: 2;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.product-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.product-card:hover .product-overlay {
    opacity: 1;
}

.view-btn {
    background: #ffffff;
    color: #0f172a;
    padding: 0.6rem 1.25rem;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.9rem;
    transform: translateY(15px);
    transition: all 0.3s ease;
}

.product-card:hover .view-btn {
    transform: translateY(0);
}

.product-info {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-cat-label {
    font-size: 0.75rem;
    color: var(--accent-primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.product-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.product-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
    flex: 1;
}

.product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
}

/* Empty State */
.no-products-msg {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-surface);
    border: 1px dashed var(--border-color);
    border-radius: 16px;
}

.empty-icon {
    font-size: 3rem;
    color: var(--text-muted);
    opacity: 0.5;
    margin-bottom: 1rem;
}

.no-products-msg h3 {
    font-size: 1.25rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.no-products-msg p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Pagination */
.product-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.page-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-surface, #ffffff);
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.page-btn.active {
    background: var(--accent-primary);
    color: #ffffff;
    border-color: var(--accent-primary);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 6. Responsive Breakpoints */
.sidebar-backdrop {
    display: none;
}

@media (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 868px) {
    .products-container {
        position: relative;
    }
    
    .mobile-filter-btn {
        display: flex;
    }

    .products-sidebar {
        position: fixed;
        top: 0;
        left: -320px;
        width: 300px;
        height: 100vh;
        height: 100dvh;
        z-index: 10000;
        background: var(--bg-surface, #ffffff);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        padding: 0;
        box-shadow: 4px 0 25px rgba(0,0,0,0.1);
        box-sizing: border-box;
    }

    .products-sidebar.show {
        left: 0;
    }

    .sidebar-widget {
        border: none;
        padding: 1.5rem;
        box-shadow: none;
        background: transparent;
    }

    .desktop-title {
        display: none;
    }

    .sidebar-header-mobile {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar-header-mobile h3 {
        font-size: 1.15rem;
        font-weight: 700;
        color: var(--text-main);
        margin: 0;
    }

    .close-sidebar-btn {
        background: var(--bg-hover);
        border: none;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-main);
        font-size: 1.1rem;
        cursor: pointer;
        transition: all 0.2s;
    }

    .close-sidebar-btn:hover {
        background: var(--accent-primary);
        color: white;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 9999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        backdrop-filter: blur(3px);
    }

    .sidebar-backdrop.show {
        opacity: 1;
        visibility: visible;
        display: block;
    }
}

@media (max-width: 640px) {
    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .toolbar-left {
        display: none;
    }
    
    .products-toolbar {
        justify-content: flex-end;
    }
    
    .products-hero {
        padding: 2.5rem 0;
    }
    
    .hero-title {
        font-size: 2.25rem;
    }

    .product-info {
        padding: 0.75rem;
    }

    .product-title {
        font-size: 0.95rem;
        margin-bottom: 0.25rem;
    }

    .product-desc {
        display: none; /* Hide description on mobile to save space */
    }

    .product-image-wrap {
        height: 140px; /* Shorter image for mobile */
    }
}
