﻿/* ============================================================
   Products Page Styles - Mobile First
   ============================================================ */

/* ====== Page Header ====== */
.products-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 32px 0;
    margin-bottom: 0;
}

    .products-header h1 {
        font-size: 1.6rem;
        font-weight: 900;
        margin: 0 0 8px;
        display: flex;
        align-items: center;
        gap: 12px;
    }

        .products-header h1 i {
            color: #fbbf24;
        }

    .products-header p {
        font-size: 0.9rem;
        opacity: 0.95;
        margin: 0;
    }

/* ====== Search Bar ====== */
.products-search-wrapper {
    background: white;
    padding: 16px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    position: sticky;
    top: 60px;
    z-index: 100;
}

.products-search-form {
    display: flex;
    gap: 10px;
}

.search-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 0 14px;
    transition: all 0.2s;
    min-height: 48px;
    position: relative;
}

    .search-input-wrapper:focus-within {
        border-color: #10b981;
        background: white;
        box-shadow: 0 0 0 4px rgba(16,185,129,0.1);
    }

    .search-input-wrapper > i {
        color: #9ca3af;
        margin-left: 8px;
    }

    .search-input-wrapper input {
        flex: 1;
        border: none;
        outline: none;
        background: transparent;
        padding: 12px 0;
        font-family: inherit;
        font-size: 0.95rem;
        color: #1f2937;
    }

    .search-input-wrapper .clear-search {
        color: #9ca3af;
        padding: 6px;
        text-decoration: none;
        transition: color 0.2s;
    }

        .search-input-wrapper .clear-search:hover {
            color: #dc2626;
        }

.btn-search {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 0 24px;
    border-radius: 12px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 6px;
}

    .btn-search:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(16,185,129,0.35);
    }

/* ====== Products Layout ====== */
.products-page {
    padding: 0;
    background: #f9fafb;
    min-height: 100vh;
}

.products-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    padding: 24px 0;
}

/* ====== Filter Sidebar ====== */
.filter-sidebar {
    background: white;
    border-radius: 16px;
    padding: 0;
    height: fit-content;
    position: sticky;
    top: 130px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

    .filter-sidebar::-webkit-scrollbar {
        width: 4px;
    }

    .filter-sidebar::-webkit-scrollbar-thumb {
        background: #d1d5db;
        border-radius: 2px;
    }

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    border-radius: 16px 16px 0 0;
}

    .filter-header h3 {
        font-size: 1rem;
        font-weight: 800;
        color: #1f2937;
        margin: 0;
        display: flex;
        align-items: center;
        gap: 8px;
    }

        .filter-header h3 i {
            color: #10b981;
        }

.filter-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-clear-all {
    color: #dc2626;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

    .btn-clear-all:hover {
        color: #991b1b;
    }

.btn-close-sidebar {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #6b7280;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}

/* Filter Groups */
.filter-group {
    padding: 14px 20px;
    border-bottom: 1px solid #f3f4f6;
}

    .filter-group:last-of-type {
        border-bottom: none;
    }

.filter-group-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 800;
    color: #1f2937;
    font-size: 0.9rem;
    padding: 4px 0;
    user-select: none;
}

    .filter-group-title:hover {
        color: #10b981;
    }

    .filter-group-title i {
        color: #9ca3af;
        font-size: 0.75rem;
        transition: transform 0.2s;
    }

.filter-group-content {
    margin-top: 12px;
}

/* Filter Options */
.filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    cursor: pointer;
    font-size: 0.85rem;
    color: #4b5563;
    transition: color 0.2s;
}

    .filter-option:hover {
        color: #10b981;
    }

    .filter-option input[type="checkbox"] {
        width: 16px;
        height: 16px;
        accent-color: #10b981;
        cursor: pointer;
    }

        .filter-option input[type="checkbox"]:checked ~ span {
            color: #10b981;
            font-weight: 700;
        }

    .filter-option .filter-count {
        margin-right: auto;
        font-size: 0.7rem;
        background: #f3f4f6;
        color: #6b7280;
        padding: 2px 8px;
        border-radius: 10px;
        font-weight: 600;
    }

    .filter-option.filter-switch {
        padding: 10px 0;
        border-top: 1px solid #f3f4f6;
        border-bottom: 1px solid #f3f4f6;
        margin: 8px 0;
    }

/* Price Range */
.price-range-inputs {
    display: flex;
    gap: 8px;
    align-items: center;
}

    .price-range-inputs input {
        flex: 1;
        padding: 8px 10px;
        border: 2px solid #e5e7eb;
        border-radius: 8px;
        font-family: inherit;
        font-size: 0.85rem;
        min-height: 38px;
    }

        .price-range-inputs input:focus {
            border-color: #10b981;
            outline: none;
        }

    .price-range-inputs span {
        color: #9ca3af;
        font-weight: 700;
    }

/* Filter Actions */
.filter-actions {
    padding: 16px 20px;
    border-top: 1px solid #f3f4f6;
    background: white;
    position: sticky;
    bottom: 0;
    border-radius: 0 0 16px 16px;
}

/* ====== Products Main ====== */
.products-main {
    min-width: 0;
}

/* Toolbar */
.products-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-filter-toggle {
    display: none;
    background: #10b981;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    align-items: center;
    gap: 6px;
    position: relative;
}

    .btn-filter-toggle .badge-count {
        position: absolute;
        top: -6px;
        left: -6px;
        background: #dc2626;
        color: white;
        font-size: 0.65rem;
        min-width: 20px;
        height: 20px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 5px;
        border: 2px solid white;
    }

.results-count {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 600;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sort-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

    .sort-wrapper label {
        color: #6b7280;
        font-size: 0.85rem;
    }

.sort-select {
    padding: 6px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    background: white;
}

    .sort-select:focus {
        border-color: #10b981;
        outline: none;
    }

.view-toggle {
    display: flex;
    gap: 4px;
    background: #f3f4f6;
    border-radius: 10px;
    padding: 4px;
}

.view-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.85rem;
}

    .view-btn:hover {
        background: white;
        color: #10b981;
    }

    .view-btn.active {
        background: white;
        color: #10b981;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

/* Active Filters */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
    align-items: center;
}

.active-filters-label {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0fdf4;
    color: #059669;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid #d1fae5;
}

    .filter-chip:hover {
        background: #059669;
        color: white;
        border-color: #059669;
    }

    .filter-chip i {
        font-size: 0.7rem;
    }

.filter-chip-clear {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fee2e2;
}

    .filter-chip-clear:hover {
        background: #dc2626;
        color: white;
        border-color: #dc2626;
    }

/* ====== Products Grid ====== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.product-card-public {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    border: 2px solid transparent;
}

    .product-card-public:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 28px rgba(0,0,0,0.1);
        border-color: #10b981;
        color: inherit;
    }

.product-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 70%;
    background: #f9fafb;
    overflow: hidden;
}

    .product-image-wrapper img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: contain;
        padding: 16px;
        transition: transform 0.3s;
    }

.product-card-public:hover .product-image-wrapper img {
    transform: scale(1.05);
}

.product-image-wrapper > i {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: #d1d5db;
}

.out-of-stock-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #dc2626;
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 800;
    z-index: 2;
}

.product-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.product-brand {
    font-size: 0.65rem;
    font-weight: 800;
    color: #10b981;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

.product-model {
    font-size: 0.7rem;
    color: #9ca3af;
}

.product-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

    .product-specs .spec {
        background: #f0fdf4;
        color: #059669;
        padding: 3px 8px;
        border-radius: 6px;
        font-size: 0.65rem;
        font-weight: 700;
        display: inline-flex;
        align-items: center;
        gap: 3px;
    }

.product-footer {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.product-price {
    display: flex;
    align-items: baseline;
    gap: 3px;
}

.price-value {
    font-size: 1rem;
    font-weight: 800;
    color: #059669;
}

.price-unit {
    font-size: 0.7rem;
    color: #6b7280;
}

.price-contact {
    font-size: 0.8rem;
    font-weight: 700;
    color: #d97706;
}

.btn-view-details {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f0fdf4;
    color: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.product-card-public:hover .btn-view-details {
    background: #10b981;
    color: white;
}

/* ====== List View ====== */
.products-grid.list-view {
    grid-template-columns: 1fr;
    gap: 10px;
}

    .products-grid.list-view .product-card-public {
        flex-direction: row;
    }

    .products-grid.list-view .product-image-wrapper {
        width: 140px;
        padding-top: 0;
        height: auto;
        min-height: 140px;
        flex-shrink: 0;
    }

        .products-grid.list-view .product-image-wrapper img {
            position: static;
            width: 100%;
            height: 100%;
        }

    .products-grid.list-view .product-info {
        padding: 16px;
    }

    .products-grid.list-view .product-name {
        font-size: 1.1rem;
        -webkit-line-clamp: 1;
        min-height: auto;
    }

/* ====== Empty State ====== */
.empty-state {
    background: white;
    border-radius: 20px;
    padding: 60px 30px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

    .empty-state i {
        font-size: 3rem;
        color: #d1d5db;
        margin-bottom: 16px;
        display: block;
    }

    .empty-state h4 {
        font-size: 1.2rem;
        font-weight: 800;
        color: #1f2937;
        margin-bottom: 8px;
    }

    .empty-state p {
        color: #6b7280;
        margin-bottom: 20px;
    }

/* ====== Pagination ====== */
.products-pagination {
    margin-top: 24px;
}

    .products-pagination .pagination .page-link {
        border: none;
        color: #4b5563;
        border-radius: 10px;
        margin: 0 3px;
        padding: 8px 14px;
        font-weight: 700;
        transition: all 0.2s;
    }

        .products-pagination .pagination .page-link:hover {
            background: #f0fdf4;
            color: #10b981;
        }

    .products-pagination .pagination .page-item.active .page-link {
        background: linear-gradient(135deg, #10b981 0%, #059669 100%);
        color: white;
        box-shadow: 0 4px 12px rgba(16,185,129,0.3);
    }

/* ====== Filter Overlay (Mobile) ====== */
.filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (min-width: 576px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .products-header h1 {
        font-size: 2rem;
    }

    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
}

@media (min-width: 992px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ====== Mobile Layout ====== */
@media (max-width: 991px) {
    .products-layout {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 16px;
    }

    .filter-sidebar {
        position: fixed;
        top: 0;
        right: -100%;
        bottom: 0;
        width: 320px;
        max-width: 90vw;
        z-index: 1050;
        transition: right 0.3s ease;
        border-radius: 0;
        max-height: 100vh;
        top: 0;
    }

        .filter-sidebar.open {
            right: 0;
        }

    .filter-overlay.active {
        display: block;
    }

    .btn-filter-toggle {
        display: inline-flex;
    }

    .products-search-wrapper {
        top: 60px;
    }
}

@media (max-width: 575px) {
    .products-header {
        padding: 20px 0;
    }

        .products-header h1 {
            font-size: 1.2rem;
        }

        .products-header p {
            font-size: 0.8rem;
        }

    .products-search-form {
        flex-direction: column;
    }

    .btn-search {
        width: 100%;
        justify-content: center;
        min-height: 44px;
    }

    .products-toolbar {
        padding: 10px 12px;
    }

    .results-count {
        font-size: 0.75rem;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

        .products-grid.list-view .product-card-public {
            flex-direction: column;
        }

        .products-grid.list-view .product-image-wrapper {
            width: 100%;
            min-height: 180px;
        }

            .products-grid.list-view .product-image-wrapper img {
                position: absolute;
            }
}
