/* ===========================================
   PRODUCTS PAGE - Minimal Modern Design
   =========================================== */

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 24px;
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title i {
    color: var(--primary-blue);
    font-size: 28px;
}

.page-description {
    color: var(--text-secondary);
    margin: 0;
    font-size: 16px;
}

/* Header Stats */
.header-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    min-width: 180px;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card i {
    font-size: 32px;
    color: var(--primary-blue);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Filter Bar Container */
.filter-bar-container {
    position: sticky;
    top: var(--header-height);
    z-index: 100;
    background: var(--background);
    padding: 16px 0;
    margin-bottom: 24px;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color-light);
    box-shadow: var(--shadow-sm);
}

.filter-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color-light);
    margin: 0 4px;
}

/* Search */
.filter-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    color: var(--text-secondary);
    min-width: 200px;
}

.filter-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    width: 100%;
    color: var(--text-primary);
}

.filter-search input::placeholder {
    color: var(--text-tertiary);
}

/* Filter Pills */
.filter-pills {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    flex-wrap: wrap;
    overflow: visible;
}

.filter-dropdown {
    position: relative;
}

.filter-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-pill:hover {
    background: var(--background);
    color: var(--text-primary);
}

.filter-pill.active {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-blue);
    border-color: rgba(var(--primary-rgb), 0.2);
}

.filter-pill i {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.filter-dropdown.open .filter-pill i {
    transform: rotate(180deg);
}

/* Custom Dropdown Menu */
.dropdown-menu-custom {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border-color-light);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 240px;
    z-index: 1000;
    display: none;
    animation: dropdownFadeIn 0.2s ease;
    padding: 8px;
}

.filter-dropdown.open .dropdown-menu-custom {
    display: block !important;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-search {
    padding: 8px;
    border-bottom: 1px solid var(--border-color-light);
    margin-bottom: 8px;
}

.dropdown-search input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border-color-light);
    border-radius: 4px;
    font-size: 13px;
    outline: none;
}

.dropdown-search input:focus {
    border-color: var(--primary-blue);
}

.dropdown-options {
    max-height: 240px;
    overflow-y: auto;
}

.dropdown-no-results {
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.dropdown-option {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dropdown-option:hover {
    background: var(--background);
}

.dropdown-option.selected {
    background: rgba(var(--primary-rgb), 0.05);
    color: var(--primary-blue);
    font-weight: 600;
}

.dropdown-option.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 10px;
}

/* Wide Dropdown for "More" */
.dropdown-menu-wide {
    min-width: 600px;
    padding: 16px;
}

.dropdown-row {
    display: flex;
    gap: 24px;
}

.dropdown-col {
    flex: 1;
}

.dropdown-col h6 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color-light);
}

/* Right Actions */
.filter-actions-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-reset-filters,
.btn-export {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-reset-filters:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.btn-export:hover {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.view-toggles {
    display: flex;
    background: var(--background);
    padding: 2px;
    border-radius: 6px;
}

.view-toggle {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.view-toggle.active {
    background: var(--surface);
    color: var(--primary-blue);
    box-shadow: var(--shadow-sm);
}

/* Active Filters Row */
.active-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding: 0 4px;
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--surface);
    border: 1px solid var(--border-color-light);
    border-radius: 16px;
    font-size: 12px;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.active-filter-tag span {
    color: var(--text-secondary);
}

.active-filter-tag i {
    cursor: pointer;
    color: var(--text-tertiary);
    font-size: 10px;
    padding: 2px;
}

.active-filter-tag i:hover {
    color: #dc3545;
}



/* Loading Container */
.loading-container {
    text-align: center;
    padding: 80px 20px;
}

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

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.product-card {
    background: var(--surface);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
}

.product-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
    border-color: var(--primary-blue);
}

.product-image {
    width: 100%;
    height: 240px;
    object-fit: cover;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-image i {
    font-size: 64px;
    color: var(--text-tertiary);
}

.product-info {
    padding: 20px;
}

.product-code {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 8px;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.product-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.product-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.product-meta-item i {
    color: var(--primary-blue);
    width: 16px;
    text-align: center;
}

.product-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 12px;
}

.product-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.product-badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--background);
    color: var(--text-secondary);
    font-weight: 500;
}

/* Products Table */
.products-table-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color-light);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 32px;
}

.products-table-container table {
    margin: 0;
}

.products-table-container thead {
    background: var(--background);
}

.products-table-container thead th {
    font-weight: 600;
    color: var(--text-primary);
    padding: 16px;
    border-bottom: 2px solid var(--border-color);
}

.products-table-container tbody td {
    padding: 16px;
    vertical-align: middle;
    color: var(--text-secondary);
}

.products-table-container tbody tr {
    border-bottom: 1px solid var(--border-color-light);
    transition: background-color 0.2s ease;
}

.products-table-container tbody tr:hover {
    background: var(--background);
}

.product-image-small {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius);
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius);
}

.product-image-small i {
    font-size: 24px;
    color: var(--text-tertiary);
}

.table-product-code {
    font-weight: 600;
    color: var(--primary-blue);
}

.table-product-name {
    color: var(--text-primary);
    font-weight: 500;
}

/* Pagination */
.pagination-container {
    margin: 32px 0;
}

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

.empty-state i {
    font-size: 80px;
    color: var(--text-tertiary);
    margin-bottom: 24px;
}

.empty-state h3 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

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

/* Product Detail Modal */
.product-detail-header {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.product-detail-image {
    width: 200px;
    height: 200px;
    flex-shrink: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-detail-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-detail-image i {
    font-size: 64px;
    color: var(--text-tertiary);
}

.product-detail-info {
    flex: 1;
}

.product-detail-code {
    font-size: 14px;
    color: var(--primary-blue);
    font-weight: 600;
    margin-bottom: 8px;
}

.product-detail-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.product-detail-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 16px;
}

.product-detail-section {
    margin-bottom: 24px;
}

.product-detail-section h6 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
}

/* Export Progress Modal */
.progress {
    height: 8px;
    background: var(--background);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    background: var(--primary-blue);
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .header-stats {
        width: 100%;
        gap: 12px;
    }

    .stat-card {
        flex: 1 1 160px;
        min-width: 0;
        width: 100%;
    }

    .filter-bar-container {
        position: static;
        padding: 8px 0 16px;
        top: auto;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        background: transparent;
        padding: 0;
        border: none;
        box-shadow: none;
    }

    .filter-divider {
        display: none;
    }

    .filter-search {
        width: 100%;
        padding: 10px 12px;
        background: var(--surface);
        border-radius: 12px;
        border: 1px solid var(--border-color-light);
    }

    .filter-pills {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .filter-dropdown {
        width: 100%;
    }

    .filter-pill {
        width: 100%;
        justify-content: space-between;
        background: var(--background);
        border: 1px solid var(--border-color-light);
        border-radius: 10px;
        padding: 12px 14px;
    }

    .filter-actions-right {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
        flex-wrap: wrap;
    }

    .view-toggles {
        width: 100%;
        justify-content: space-between;
        background: transparent;
        padding: 0;
    }

    .btn-reset-filters,
    .btn-export {
        width: 42px;
        height: 42px;
        border: 1px solid var(--border-color);
        background: var(--surface);
    }

    .active-filters-row {
        padding: 8px 0 0;
        margin-top: 8px;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .product-card {
        border-radius: var(--radius);
    }

    .product-image {
        height: 210px;
    }

    .product-detail-header {
        flex-direction: column;
    }

    .product-detail-image {
        width: 100%;
        height: 260px;
    }

    .products-table-container {
        overflow-x: auto;
    }

    .products-table-container table {
        min-width: 680px;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 24px;
    }

    .header-stats {
        flex-direction: column;
    }

    .stat-value {
        font-size: 22px;
    }

    .stat-card {
        padding: 16px;
        width: 100%;
    }

    .filter-actions-right {
        gap: 8px;
    }

    .product-image {
        height: 190px;
    }
}
