/* Inventario Page Styles */

body {
    background-color: #f8fafc;
}

.inventory-page-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    padding-top: 40px;
    padding-bottom: 60px;
}

/* ==================== SIDEBAR ==================== */
.inventory-sidebar {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    height: fit-content;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.filter-header h3 {
    font-size: 1.2rem;
    color: var(--primary-blue);
    font-weight: 700;
}

.btn-text {
    background: none;
    border: none;
    color: #64748b;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: underline;
}

.filter-section {
    margin-bottom: 20px;
}

.filter-section h4 {
    font-size: 0.95rem;
    color: #334155;
    margin-bottom: 10px;
    font-weight: 600;
}

.active-category-badge {
    background: var(--primary-cyan);
    color: white;
    padding: 6px 12px;
    /* reduced size */
    border-radius: 6px;
    display: inline-block;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Filter Groups */
.filter-group {
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.filter-group:last-child {
    border-bottom: none;
}

.filter-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 12px;
}

.filter-group h4 {
    font-size: 1rem;
    color: var(--primary-blue);
    font-weight: 700;
    margin: 0;
}

.toggle-icon {
    font-size: 0.9rem;
    color: var(--gray-500);
    transition: transform 0.3s ease;
}

.filter-group.collapsed .toggle-icon {
    transform: rotate(180deg);
}

.filter-group.collapsed .filter-group-options {
    display: none;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #475569;
    transition: color 0.2s;
}

.filter-option:hover {
    color: var(--primary-blue);
}

.filter-option input[type="checkbox"] {
    accent-color: var(--primary-blue);
    width: 16px;
    height: 16px;
}

/* ==================== MAIN CONTENT ==================== */
.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.inventory-header h1 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--primary-blue);
    font-size: 2rem;
    font-weight: 800;
}

.sort-controls span {
    color: #64748b;
    font-weight: 500;
}

/* ==================== GRID ==================== */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* ==================== PRODUCT CARD ==================== */
.product-card-inventory {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Make cards same height */
    position: relative;
}

.product-card-inventory:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(29, 39, 124, 0.1);
    border-color: var(--primary-cyan);
}

.prod-inv-image {
    padding: 20px;
    height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
}

.prod-inv-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.prod-inv-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    /* Allow content to push footer down */
}

.prod-inv-meta {
    display: flex;
    flex-wrap: wrap;
    /* allow badges to wrap if long */
    gap: 6px;
    margin-bottom: 8px;
}

.badg-lab,
.badg-pres {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.badg-lab {
    background: #eff6ff;
    color: #1e40af;
}

.badg-pres {
    background: #f0fdf4;
    color: #166534;
}

.prod-inv-name {
    font-size: 1rem;
    color: var(--primary-blue);
    margin-bottom: 6px;
    line-height: 1.4;
    flex-grow: 1;
    /* Pushes action button to bottom */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.prod-inv-desc {
    font-size: 0.85rem;
    color: #cbd5e1;
    /* very light, or hide? */
    color: #64748b;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.prod-inv-actions {
    margin-top: auto;
    /* Force to bottom */
}

.add-to-cart-btn {
    width: 100%;
    padding: 10px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.add-to-cart-btn:hover {
    background: #151b54;
}

/* Quantity controls override shared logic */
.quantity-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 4px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    color: var(--primary-blue);
}

.qty {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-dark);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
    .inventory-page-container {
        grid-template-columns: 1fr;
    }

    .inventory-sidebar {
        display: none;
        /* Hidden by default */
        margin-bottom: 20px;
    }

    .inventory-sidebar.show-mobile {
        display: block;
        animation: fadeIn 0.3s ease;
    }

    .mobile-filter-toggle-btn {
        display: flex !important;
        /* Force show */
        width: 100%;
        padding: 12px;
        background: white;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        color: var(--primary-blue);
        font-weight: 700;
        align-items: center;
        justify-content: center;
        gap: 10px;
        margin-bottom: 20px;
        cursor: pointer;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    }
}

.mobile-filter-toggle-btn {
    display: none;
    /* Hidden on desktop */
}

/* ==================== SEARCH PREVIEW DROPDOWN ==================== */
.header-search {
    position: relative !important;
    /* Ensure dropdown is relative to this */
}

.search-preview-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

.preview-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}

.preview-item:last-child {
    border-bottom: none;
}

.preview-item:hover {
    background: #f8fafc;
}

.preview-img {
    width: 30px;
    /* Smaller icon */
    height: 30px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 2px;
}

.preview-name {
    font-size: 0.85rem;
    /* Smaller text */
    font-weight: 600;
    color: var(--primary-blue);
    margin: 0 0 1px;
    line-height: 1.1;
}

.preview-details {
    font-size: 0.7rem;
    color: #64748b;
    margin: 0;
}

.preview-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.preview-info {
    flex-grow: 1;
}

.preview-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-blue);
    margin: 0 0 2px;
    line-height: 1.2;
}

.preview-details {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0;
}