/* ========================================
   PRODUCTS PAGE STYLES
   Navigation, categories, filters,
   product grid/cards, catalog modal
   ======================================== */

/* === PRODUCTS PAGE HEADER — QSC distinctive === */
.products-page-header {
    background: linear-gradient(160deg, var(--white) 0%, var(--primary-50) 40%, var(--primary-100) 100%);
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-subtle);
}
.products-header-inner {
    display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
}
.products-header-text { flex: 1; }
.products-page-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}
.products-page-subtitle {
    font-size: 0.9375rem;
    color: var(--gray-500);
}
.products-header-stats {
    display: flex; gap: 1.25rem; align-items: center;
}
.ph-stat {
    text-align: center; padding: 0.5rem 0.75rem;
    background: var(--white); border: 1px solid var(--primary-100);
    border-radius: var(--radius-lg);
}
.ph-stat-num {
    display: block; font-size: 1.1rem; font-weight: 800; color: var(--primary-dark);
}
.ph-stat-lbl {
    display: block; font-size: 0.6rem; color: var(--gray-500);
    text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500;
}
@media (max-width: 767px) {
    .products-page-header { padding: 1.25rem 0; }
    .products-header-inner { flex-direction: column; text-align: center; gap: 0.75rem; }
    .products-page-title { font-size: 1.375rem; }
    .products-page-subtitle { font-size: 0.8125rem; }
    .products-header-stats { gap: 0.75rem; }
    .ph-stat { padding: 0.375rem 0.5rem; }
    .ph-stat-num { font-size: 0.9rem; }
}

/* === NAVIGATION === */
.nav { background: var(--white); border-bottom: 1px solid var(--border-subtle); padding: var(--space-3) 0; }
.nav-content { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.nav-links { display: flex; list-style: none; gap: var(--space-1); flex-wrap: wrap; }
.nav-link {
    padding: var(--space-2) var(--space-3); color: var(--gray-600);
    text-decoration: none; font-size: var(--font-size-sm); font-weight: 500;
    border-radius: var(--radius-md); transition: all var(--transition-fast);
    min-height: 44px; display: flex; align-items: center;
}
.nav-link:hover, .nav-link.active { color: var(--primary); background: var(--primary-50); }

/* === SEARCH (Products page context) === */
.search-container { position: relative; flex-shrink: 0; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: var(--font-size-sm); }
.search-input {
    width: 220px; padding: var(--space-2) var(--space-3) var(--space-2) 36px;
    border: 1px solid var(--gray-200); border-radius: var(--radius-md);
    font-size: var(--font-size-sm); outline: none; transition: all var(--transition-fast);
}
.search-input:focus { border-color: var(--primary); width: 280px; }
.search-dropdown {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--white); border: 1px solid var(--gray-200);
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    z-index: 100; max-height: 400px; overflow-y: auto; margin-top: 4px;
}
.search-result-item {
    display: flex; align-items: center; padding: var(--space-3);
    border-bottom: 1px solid var(--gray-100); cursor: pointer;
    transition: background var(--transition-fast);
}
.search-result-item:hover { background: var(--primary-50); }
.search-result-info { flex: 1; }
.search-result-name { font-weight: 600; font-size: var(--font-size-sm); color: var(--gray-900); }
.search-result-details { font-size: var(--font-size-xs); color: var(--gray-500); }
.search-result-price { font-weight: 600; color: var(--primary); font-size: var(--font-size-sm); }

/* === CATEGORIES === */
.categories { padding: var(--space-4) 0; background: var(--white); border-bottom: 1px solid var(--border-subtle); }
.category-grid { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: center; }
.category-btn {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-4); background: var(--gray-50);
    border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
    cursor: pointer; font-size: var(--font-size-sm); font-weight: 500;
    color: var(--gray-700); transition: all var(--transition-fast);
    min-height: 44px;
}
.category-btn:hover { border-color: var(--primary); color: var(--primary); }
.category-btn.active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.category-icon { font-size: var(--font-size-base); }

/* === FILTERS === */
.filters { padding: var(--space-3) 0; background: var(--surface-sunken); border-bottom: 1px solid var(--border-subtle); overflow-x: hidden; }
.filters-content { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3); }
.filters-left { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.filter-group { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.filter-btn {
    padding: var(--space-1) var(--space-3); background: var(--white);
    border: 1px solid var(--gray-200); border-radius: var(--radius-md);
    cursor: pointer; font-size: var(--font-size-xs); font-weight: 500;
    color: var(--gray-600); transition: all var(--transition-fast);
    min-height: 40px; display: inline-flex; align-items: center;
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.sort-select {
    padding: var(--space-1) var(--space-3); border: 1px solid var(--gray-200);
    border-radius: var(--radius-md); font-size: var(--font-size-xs); color: var(--gray-700);
    background: var(--white); cursor: pointer; outline: none;
    min-height: 40px;
}
.product-count { font-size: var(--font-size-sm); color: var(--gray-500); }

/* === PRODUCTS GRID === */
.products-section { padding: var(--space-6) 0; }
.products-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4); margin-bottom: var(--space-6);
}

/* === PRODUCT CARD === */
.product-card {
    background: var(--white); border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg); overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    opacity: 0; transform: translateY(10px);
    min-height: 280px;
}
.product-card.fade-in { opacity: 1; transform: translateY(0); }
.product-card:hover {
    transform: translateY(-6px);
    border-color: var(--primary);
    box-shadow: 0 12px 32px rgba(30, 64, 175, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Product image */
.product-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f8fafb;
}
.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.product-card:hover .product-image img { transform: scale(1.05); }
@media (max-width: 767px) {
    .product-image { aspect-ratio: 3 / 2; }
}

/* Product header */
.product-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: var(--space-3) var(--space-4); background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
    overflow: hidden; position: relative;
}
.product-header img { transition: transform 0.4s ease; }
.product-card:hover .product-header img { transform: scale(1.05); }
.product-code { font-family: monospace; font-size: var(--font-size-xs); font-weight: 600; color: var(--primary); }

/* Badges */
.product-badges { display: flex; gap: var(--space-1); }
.product-badge {
    padding: 2px 8px; border-radius: 100px; font-size: 0.65rem;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
}
.badge-tested { background: var(--primary-50); color: var(--primary); }
.badge-popular { background: #fef3c7; color: #92400e; position: relative; }
.badge-new { background: #ede9fe; color: #6d28d9; }
.badge-best-value { background: #eff6ff; color: #f59e0b; }

@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.3); }
    50% { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0); }
}
.badge-popular { animation: badgePulse 2.5s ease-in-out infinite; }

/* Product body */
.product-body { padding: var(--space-4); }
.product-name { font-size: var(--font-size-base); font-weight: 600; color: var(--gray-900); margin-bottom: var(--space-2); }
.product-spec { font-size: var(--font-size-xs); color: var(--gray-500); margin-bottom: var(--space-3); line-height: 1.5; }
.spec-highlight { color: var(--primary); font-weight: 600; }

/* Product pricing */
.product-pricing {
    margin-bottom: var(--space-3); background: var(--gray-50);
    border: 1px solid var(--gray-100); border-radius: var(--radius-md);
    padding: var(--space-3);
}
.price-display { display: flex; justify-content: space-between; align-items: baseline; }
.price-label { font-size: var(--font-size-xs); color: var(--gray-500); }
.price-value { font-size: 1.5rem; font-weight: 800; color: var(--gray-900); letter-spacing: -0.02em; }
.price-value .price-currency { font-size: 1rem; font-weight: 700; color: var(--gray-600); }
.bulk-pricing { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px dashed var(--gray-200); }
.bulk-tier {
    font-size: var(--font-size-xs); color: var(--primary-dark); background: var(--primary-50);
    padding: 3px 10px; border-radius: var(--radius-sm); display: inline-flex;
    align-items: center; gap: 4px; font-weight: 600;
}
.bulk-tier::before { content: ''; display: inline-block; width: 4px; height: 4px; background: var(--primary); border-radius: 50%; }
.price-save {
    font-size: 0.6875rem; color: var(--success-green); font-weight: 600;
    display: block; margin-top: 2px;
}

/* Raw material tier selector (product cards) */
.raw-tier-selector { width: 100%; }
.raw-tier-select {
    width: 100%; padding: 8px 12px; font-size: 0.8125rem; font-weight: 600;
    border: 2px solid var(--primary); border-radius: var(--radius-md);
    background: var(--primary-50); color: var(--primary-dark);
    cursor: pointer; outline: none; appearance: auto;
    transition: all 0.2s ease;
}
.raw-tier-select:hover { background: #dbeafe; border-color: var(--primary-dark); }
.raw-tier-select:focus { box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.15); }

/* Product actions */
.product-actions { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--gray-100); display: flex; flex-direction: column; gap: var(--space-2); }
.quantity-selector { display: flex; align-items: center; gap: var(--space-2); }
.qty-btn {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
    cursor: pointer; font-size: var(--font-size-xs); color: var(--gray-700);
    transition: all var(--transition-fast);
}
.qty-btn:hover { background: var(--gray-100); border-color: var(--gray-300); }
.qty-input {
    width: 50px; height: 32px; text-align: center; border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm); font-size: var(--font-size-sm); outline: none;
}
.qty-input:focus { border-color: var(--primary); }

/* Add to cart button */
.add-to-cart-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-4); background: var(--primary);
    color: var(--white); border: none; border-radius: var(--radius-md);
    cursor: pointer; font-size: var(--font-size-sm); font-weight: 500;
    transition: all 0.2s ease; position: relative; overflow: hidden;
    min-height: 44px;
}
.add-to-cart-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}
.add-to-cart-btn:active { transform: translateY(0); box-shadow: none; }

/* Test report link */
.view-test-report-btn {
    display: flex; align-items: center; justify-content: center; gap: var(--space-2);
    padding: var(--space-2); background: var(--primary-50); color: var(--primary-dark);
    border: 1px solid var(--primary-100); border-radius: var(--radius-md);
    text-decoration: none; font-size: var(--font-size-xs); font-weight: 500;
    transition: all var(--transition-fast);
    min-height: 44px;
}
.view-test-report-btn:hover { background: var(--primary-100); }
.view-product-btn {
    display: flex; align-items: center; justify-content: center; gap: var(--space-2);
    padding: var(--space-2); background: #0f172a; color: #fff;
    border: none; border-radius: var(--radius-md);
    text-decoration: none; font-size: var(--font-size-xs); font-weight: 600;
    transition: all var(--transition-fast);
    min-height: 44px;
}
.view-product-btn:hover { background: #0c1222; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(30,58,95,0.25); }
.janoshik-link {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 14px; background: linear-gradient(135deg, #eff6ff, #dbeafe); color: #1e40af;
    text-decoration: none; font-weight: 600; font-size: 0.8rem;
    border: 1.5px solid #93c5fd; border-radius: 8px;
    transition: all 0.15s ease; width: 100%; box-sizing: border-box; text-align: center;
}
.janoshik-link:hover { background: linear-gradient(135deg, #dbeafe, #93c5fd); border-color: #93c5fd; color: #1e3a8a; transform: translateY(-1px); box-shadow: 0 2px 6px rgba(30,64,175,0.15); }
button.janoshik-link { cursor: pointer; font-family: inherit; }

/* COA column in catalog */
.cat-coa-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #1e40af;
    border: 1px solid #93c5fd;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}
.cat-coa-btn:hover { background: linear-gradient(135deg, #dbeafe, #93c5fd); border-color: #93c5fd; color: #1e3a8a; }

/* Loading / spinner */
.loading { text-align: center; padding: var(--space-8); color: var(--gray-500); }
.loading-spinner {
    width: 40px; height: 40px; border: 3px solid var(--gray-200);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 0 auto var(--space-4);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === FULL CATALOG MODAL === */
.catalog-modal .modal-content { max-width: 1100px; max-height: 95vh; }
.catalog-header {
    padding: 1.25rem 1.5rem; background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 2;
}
.catalog-toolbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.catalog-search {
    flex: 1; min-width: 200px; padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid var(--gray-200); border-radius: var(--radius-md);
    font-size: 0.8125rem; outline: none; background: var(--white);
}
.catalog-search:focus { border-color: var(--primary); }
.catalog-search-wrap { position: relative; flex: 1; min-width: 200px; }
.catalog-search-wrap i {
    position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
    color: var(--gray-400); font-size: 0.75rem;
}
.catalog-tabs { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.catalog-tab {
    padding: 0.375rem 0.875rem; border: 1px solid var(--gray-200);
    border-radius: 100px; font-size: 0.6875rem; font-weight: 600;
    color: var(--gray-600); background: var(--white); cursor: pointer;
    transition: all 0.15s ease; text-transform: uppercase; letter-spacing: 0.04em;
}
.catalog-tab:hover { border-color: var(--primary); color: var(--primary); }
.catalog-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.catalog-count { font-size: 0.6875rem; color: var(--gray-400); font-weight: 500; white-space: nowrap; }
.catalog-body { padding: 0; }
.catalog-category { border-bottom: 1px solid var(--gray-200); }
.catalog-category:last-child { border-bottom: none; }
.catalog-cat-header {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.875rem 1.5rem; background: var(--primary-50);
    border-bottom: 1px solid var(--primary-100);
    position: sticky; top: 0; z-index: 1;
}
.catalog-cat-icon {
    width: 28px; height: 28px; border-radius: var(--radius-md);
    background: var(--primary); color: #fff; display: flex;
    align-items: center; justify-content: center; font-size: 0.75rem;
}
.catalog-cat-name { font-size: 0.875rem; font-weight: 700; color: var(--primary-darker); }
.catalog-cat-count {
    font-size: 0.6875rem; color: var(--primary-dark);
    background: var(--white); padding: 0.125rem 0.5rem;
    border-radius: 100px; border: 1px solid var(--primary-100);
}
.catalog-subcat {
    padding: 0.5rem 1.5rem 0.25rem;
    font-size: 0.6875rem; font-weight: 600; color: var(--gray-500);
    text-transform: uppercase; letter-spacing: 0.06em;
    background: var(--gray-50); border-bottom: 1px solid var(--gray-100);
}
.catalog-table { width: 100%; border-collapse: collapse; }
.catalog-table th {
    padding: 0.5rem 1rem; font-size: 0.625rem; font-weight: 700;
    color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.06em;
    text-align: left; background: var(--gray-50); border-bottom: 1px solid var(--gray-100);
    position: sticky; top: 0;
}
.catalog-table th:last-child { text-align: right; }
.catalog-table td {
    padding: 0.5rem 1rem; font-size: 0.8125rem; color: var(--gray-700);
    border-bottom: 1px solid var(--gray-50); vertical-align: middle;
}
.catalog-table tr:hover td { background: #fafafa; }
.catalog-table .cat-code {
    font-family: monospace; font-size: 0.75rem; font-weight: 600;
    color: var(--primary); white-space: nowrap;
}
.catalog-table .cat-name { font-weight: 500; color: var(--gray-900); }
.catalog-table .cat-spec { font-size: 0.75rem; color: var(--gray-500); }
.catalog-table .cat-price {
    text-align: right; font-weight: 700; font-size: 0.875rem;
    color: var(--gray-900); white-space: nowrap;
}


/* ==========================================
   PRODUCTS PAGE — RESPONSIVE
   ========================================== */

/* --- 640px breakpoint --- */
@media (max-width: 640px) {
    .products-grid { grid-template-columns: 1fr; }
    .nav-links { gap: 0; }
    .nav-link { padding: var(--space-1) var(--space-2); font-size: var(--font-size-xs); }
    .search-input { width: 160px; }
    .search-input:focus { width: 200px; }
}

/* --- 767px breakpoint --- */
@media (max-width: 767px) {
    /* Mobile typography for product elements */
    .product-spec,
    .product-code,
    .bulk-tier,
    .price-label,
    .price-save,
    .product-badge,
    .filter-btn,
    .sort-select,
    .catalog-count,
    .catalog-tab {
        font-size: 0.8125rem;
    }
    .product-name {
        font-size: 1.0625rem;
        font-weight: 700;
        line-height: 1.4;
    }
    .product-body {
        padding: var(--space-4) var(--space-4) var(--space-3);
    }

    /* Touch targets */
    .nav-link {
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    .category-btn {
        padding: 0.625rem 1rem;
        min-height: 44px;
        font-size: 0.875rem;
    }
    .filter-btn {
        padding: 0.5rem 0.875rem;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
    }
    .sort-select {
        min-height: 44px;
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    .add-to-cart-btn {
        padding: 0.75rem 1rem;
        min-height: 48px;
        font-size: 0.9375rem;
        font-weight: 600;
    }
    .qty-btn {
        width: 44px;
        height: 44px;
        font-size: 0.875rem;
    }
    .qty-input {
        width: 56px;
        height: 44px;
        font-size: 1rem;
    }
    .view-test-report-btn {
        padding: 0.625rem;
        min-height: 44px;
        font-size: 0.8125rem;
    }
    .catalog-tab {
        padding: 0.5rem 1rem;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
    }

    /* Nav row responsive */
    .nav {
        padding: var(--space-2) 0;
    }
    .nav-content {
        flex-direction: column;
        gap: var(--space-2);
    }
    .nav-links {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
        padding-bottom: 2px;
    }
    .nav-links::-webkit-scrollbar { display: none; }
    .search-container { width: 100%; }
    .search-input { width: 100%; }
    .search-input:focus { width: 100%; }

    /* Product grid: 2-col on tablets */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    .product-header { min-height: 48px; }
    .product-header img {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 3;
        object-fit: cover;
    }
    .product-card { font-size: 0.875rem; }
    .product-actions { padding: var(--space-3); }
    .quantity-selector { flex-wrap: wrap; gap: var(--space-2); }
    .product-card:hover { transform: translateY(-2px); }

    /* Categories & filters: horizontal scroll */
    .category-grid {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        justify-content: flex-start;
        padding-bottom: 4px;
        gap: var(--space-2);
        -webkit-mask-image: linear-gradient(to right, transparent 0, black 8px, black calc(100% - 24px), transparent 100%);
        mask-image: linear-gradient(to right, transparent 0, black 8px, black calc(100% - 24px), transparent 100%);
    }
    .category-grid::-webkit-scrollbar { display: none; }
    .category-btn { flex-shrink: 0; white-space: nowrap; }

    .filters-content {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-2);
    }
    .filters-left {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
        gap: var(--space-2);
    }
    .filters-left::-webkit-scrollbar { display: none; }
    .filter-group { flex-wrap: nowrap; flex-shrink: 0; }
    .filter-btn { flex-shrink: 0; white-space: nowrap; }

    /* Catalog tabs scroll */
    .catalog-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: var(--space-2);
    }
    .catalog-tabs::-webkit-scrollbar { display: none; }
    .catalog-tab { flex-shrink: 0; white-space: nowrap; }

    /* Catalog modal full-width */
    .catalog-modal .modal-content {
        max-width: 100%;
        max-height: 95vh;
    }

    /* Sticky category tabs on mobile */
    .categories {
        position: sticky;
        top: 0;
        z-index: 100;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    }

    /* Sections overflow */
    .products-section,
    .categories,
    .filters {
        overflow-x: hidden;
        overflow-y: visible;
    }

    /* Improve text contrast */
    .product-spec { color: var(--gray-600); }

    /* Visibility: larger icons */
    .product-header i { font-size: 1.125em; }
    .category-icon { font-size: 1.125em; }

    /* Bolder key text */
    .price-value { font-weight: 800; }

    /* Mobile search dropdown */
    .mobile-search-input {
        min-height: 48px;
        font-size: 1rem;
    }

    /* Performance: disable hover effects on mobile */
    .product-card { will-change: auto; }
    .product-card:hover .product-header img { transform: none; }
    .badge-popular { animation: none; }
}

/* --- 479px breakpoint --- */
@media (max-width: 479px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 0.875rem;
    }
    .product-header { padding: var(--space-3) var(--space-4); }
    .product-body { padding: var(--space-4); }
    .product-name { font-size: 1.0625rem; }
    .product-pricing { padding: var(--space-3); }
    .price-value { font-size: 1.375rem; }
    .search-input { width: 100%; min-height: 44px; }
    .search-input:focus { width: 100%; }
    .sort-select { width: 100%; min-height: 44px; }
}

/* --- Small phones (< 360px) --- */
@media (max-width: 359px) {
    .product-name { font-size: 0.9375rem; }
    .price-value { font-size: 1.25rem; }
    .product-header { padding: var(--space-2) var(--space-3); }
    .product-body { padding: var(--space-3); }
    .product-actions { padding: var(--space-2); }
    .add-to-cart-btn { min-height: 40px; padding: 0.5rem 0.75rem; font-size: 0.8125rem; }
    .qty-btn { width: 40px; height: 40px; }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    .badge-popular { animation: none; }
    .product-card:hover { transform: none; }
    .add-to-cart-btn:hover { transform: none; }
}

/* --- Search dropdown positioning on mobile --- */
@media (max-width: 767px) {
    .search-dropdown {
        position: fixed;
        left: 0;
        right: 0;
        top: 120px; /* Fallback; overridden by JS for exact positioning */
        margin: 0;
        border-radius: 0 0 8px 8px;
        max-height: 50vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        z-index: 10000;
        box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    }

    /* Catalog table scrollable on mobile */
    .catalog-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .catalog-table { min-width: 500px; }
    .catalog-cat-header { padding: 0.75rem 1rem; }
    .catalog-cat-name { font-size: 0.8125rem; }
    .catalog-table td { padding: 0.5rem 0.75rem; font-size: 0.8125rem; }
    .catalog-table th { padding: 0.5rem 0.75rem; }
    .view-product-btn { width: 100%; }
    .add-to-cart-btn { width: 100%; }
}

/* --- Extra small phones product grid --- */
@media (max-width: 359px) {
    .products-grid { gap: 0.75rem; }
    .product-card { min-height: auto; }
    .category-btn { padding: 0.5rem 0.75rem; font-size: 0.75rem; min-height: 40px; }
    .filter-btn { padding: 0.375rem 0.625rem; font-size: 0.75rem; min-height: 36px; }
}

/* ========== PEN UPGRADE TOGGLE ========== */
.pen-upgrade-toggle {
    padding: 0 var(--space-4);
    margin-top: -4px;
    margin-bottom: 2px;
}
.pen-upgrade-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border: 1.5px solid #ddd6fe;
    border-radius: 10px;
    transition: all 0.2s ease;
    user-select: none;
}
.pen-upgrade-label:hover {
    border-color: #a78bfa;
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
}
.pen-toggle-track {
    position: relative;
    width: 36px;
    height: 20px;
    background: #cbd5e1;
    border-radius: 10px;
    flex-shrink: 0;
    transition: background 0.2s ease;
}
.pen-toggle-track.active {
    background: #7c3aed;
}
.pen-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.pen-toggle-track.active .pen-toggle-thumb {
    transform: translateX(16px);
}
.pen-upgrade-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.pen-upgrade-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #5b21b6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pen-upgrade-title i {
    margin-right: 3px;
    font-size: 0.7rem;
}
.pen-upgrade-price {
    font-size: 0.7rem;
    color: #7c3aed;
    font-weight: 600;
}

.pen-learn-more {
    color: #7c3aed;
    text-decoration: underline;
    font-weight: 700;
    cursor: pointer;
}
.pen-learn-more:hover { color: #5b21b6; }
.spray-learn-more {
    color: #0284c7;
    text-decoration: underline;
    font-weight: 700;
    cursor: pointer;
}
.spray-learn-more:hover { color: #0369a1; }

/* Nasal spray variant styling */
.spray-label {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-color: #bae6fd;
}
.spray-label:hover {
    border-color: #38bdf8;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
}
.spray-track.active { background: #0284c7; }
.spray-title { color: #0369a1; }
.spray-price { color: #0284c7; }

/* Pen info overlay popup */
.pen-info-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    padding: 20px;
}
.pen-info-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
.pen-info-popup {
    background: #fff;
    border-radius: 16px;
    padding: 28px 24px 24px;
    max-width: 360px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}
.pen-info-overlay.visible .pen-info-popup {
    transform: scale(1);
}
.pen-info-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.pen-info-close:hover { color: #475569; }
.pen-info-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}
.pen-info-icon i {
    font-size: 1.2rem;
    color: #7c3aed;
}
.pen-info-heading {
    font-size: 1.15rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 6px;
}
.pen-info-desc {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0 0 14px;
    line-height: 1.4;
}
.pen-info-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.pen-info-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.85rem;
    color: #334155;
    line-height: 1.3;
}
.pen-info-list li i {
    color: #7c3aed;
    font-size: 0.8rem;
    margin-top: 2px;
    flex-shrink: 0;
}
.pen-info-footer {
    font-size: 0.78rem;
    color: #7c3aed;
    font-weight: 600;
    background: #f5f3ff;
    padding: 10px 12px;
    border-radius: 8px;
    text-align: center;
}

@media (max-width: 480px) {
    .pen-upgrade-toggle { padding: 0 var(--space-3); }
    .pen-upgrade-label { padding: 6px 10px; gap: 8px; }
    .pen-upgrade-title { font-size: 0.72rem; }
    .pen-upgrade-price { font-size: 0.65rem; }
    .pen-toggle-track { width: 32px; height: 18px; }
    .pen-toggle-thumb { width: 14px; height: 14px; }
    .pen-toggle-track.active .pen-toggle-thumb { transform: translateX(14px); }
    .pen-info-popup { padding: 24px 18px 20px; }
}

/* ========== BUNDLE CARDS ========== */
.bundle-card {
    position: relative;
    border: 2px solid #f59e0b;
    background: linear-gradient(180deg, #fffbeb 0%, #fff 30%);
    overflow: visible;
}
.bundle-card:hover {
    border-color: #d97706;
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.2);
}
.bundle-tier-badge {
    position: absolute;
    top: -1px;
    right: -1px;
    padding: 5px 14px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    border-radius: 0 var(--radius-lg) 0 var(--radius-md);
    z-index: 2;
}
.bundle-tier-badge.bundle-standard {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}
.bundle-tier-badge.bundle-premium {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    color: #fff;
}
.bundle-savings-badge {
    position: absolute;
    top: -1px;
    left: -1px;
    padding: 5px 12px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    border-radius: var(--radius-lg) 0 var(--radius-md) 0;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    z-index: 2;
}
.bundle-body {
    padding: 32px var(--space-4) var(--space-3);
}
.bundle-name {
    margin-bottom: 6px;
    font-size: 1.05rem;
    line-height: 1.3;
}
.bundle-desc {
    font-size: 0.75rem;
    color: var(--gray-500);
    line-height: 1.5;
    margin: 0 0 14px;
}
.bundle-section {
    margin-bottom: 10px;
}
.bundle-section-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 5px 10px;
    border-radius: 6px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.bundle-section-pen {
    background: rgba(124, 58, 237, 0.08);
    color: #7c3aed;
}
.bundle-section-oral {
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
}
.bundle-section-inj {
    background: rgba(220, 38, 38, 0.08);
    color: #dc2626;
}
.bundle-section-supply {
    background: rgba(107, 114, 128, 0.08);
    color: #6b7280;
}
.bundle-items-list {
    list-style: none;
    padding: 0;
    margin: 0 0 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.bundle-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 4px;
}
.bundle-item-pen {
    border-left: 3px solid #7c3aed;
    background: rgba(124, 58, 237, 0.03);
}
.bundle-item-oral {
    border-left: 3px solid #2563eb;
    background: rgba(37, 99, 235, 0.03);
}
.bundle-item-inj {
    border-left: 3px solid #dc2626;
    background: rgba(220, 38, 38, 0.03);
}
.bundle-item-supply {
    border-left: 3px solid #9ca3af;
    background: rgba(107, 114, 128, 0.03);
}
.bundle-item-name {
    font-weight: 600;
    color: var(--gray-700);
    flex-shrink: 0;
}
.bundle-item-spec {
    color: var(--gray-400);
    flex: 1;
    text-align: right;
    font-size: 0.68rem;
}
.bundle-pen-note {
    font-size: 0.68rem;
    color: #7c3aed;
    padding: 6px 10px;
    background: rgba(124, 58, 237, 0.05);
    border-radius: 6px;
    margin-bottom: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}
.bundle-inj-note {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.05);
}
.bundle-pricing {
    text-align: center;
    padding: 12px 0 4px;
    border-top: 2px solid #f3f4f6;
}
.bundle-retail {
    font-size: 0.78rem;
    color: var(--gray-400);
    margin-bottom: 2px;
}
.bundle-retail-price {
    text-decoration: line-through;
    font-weight: 600;
}
.bundle-final {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 2px;
}
.bundle-you-save {
    font-size: 0.75rem;
    font-weight: 700;
    color: #10b981;
    margin-bottom: 4px;
}
.bundle-add-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    font-weight: 700 !important;
}
.bundle-add-btn:hover {
    background: linear-gradient(135deg, #d97706, #b45309) !important;
}

@media (max-width: 480px) {
    .bundle-item-spec { display: none; }
    .bundle-item { font-size: 0.7rem; }
    .bundle-final { font-size: 1.2rem; }
    .bundle-desc { font-size: 0.7rem; }
    .bundle-body { padding: 28px 12px 10px; }
}

/* ========== BUNDLE CATEGORY CARDS ========== */
.bundle-cat-card {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.25s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.bundle-cat-card:hover {
    border-color: var(--gray-300);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}
.bcc-save {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 4px;
    z-index: 2;
}
.bcc-header {
    padding: 20px 20px 12px;
    text-align: center;
}
.bcc-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 1.2rem;
    color: #fff;
}
.bcc-name {
    font-size: 1rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 6px;
}
.bcc-desc {
    font-size: 0.75rem;
    color: var(--gray-500);
    line-height: 1.5;
    margin: 0;
}
.bcc-body {
    padding: 0 20px 14px;
    flex: 1;
}
.bcc-price-range {
    text-align: center;
    margin-bottom: 10px;
}
.bcc-from, .bcc-to {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
}
.bcc-sep {
    margin: 0 6px;
    color: var(--gray-300);
    font-weight: 300;
}
.bcc-tiers {
    display: flex;
    justify-content: center;
    gap: 8px;
}
.bcc-tier {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 100px;
    letter-spacing: 0.02em;
}
.bcc-tier-std {
    background: #fef3c7;
    color: #d97706;
}
.bcc-tier-pro {
    background: #ede9fe;
    color: #7c3aed;
}
.bcc-cta {
    padding: 12px 20px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
}
.bcc-cta i {
    transition: transform 0.2s;
}
.bundle-cat-card:hover .bcc-cta i {
    transform: translateX(4px);
}

/* ========== BUNDLE OVERLAY ========== */
.bundle-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 20px;
}
.bundle-overlay.visible {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}
.bo-content {
    background: var(--white);
    border-radius: 16px;
    max-width: 860px;
    width: 100%;
    margin: 40px auto;
    position: relative;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    animation: boSlideUp 0.3s ease;
}
@keyframes boSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.bo-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 10;
    background: var(--white);
    border: 1px solid var(--gray-200);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--gray-500);
    transition: all 0.2s;
}
.bo-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}
.bo-header {
    padding: 24px 28px;
    text-align: center;
    border-radius: 16px 16px 0 0;
}
.bo-header-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 1.3rem;
    color: #fff;
}
.bo-header-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 6px;
}
.bo-header-desc {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin: 0;
}
.bo-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 0 20px 24px;
}
.bo-card {
    position: relative;
    border-radius: 12px;
    border: 2px solid var(--gray-200);
    padding: 28px 16px 16px;
    display: flex;
    flex-direction: column;
}
.bo-card-std {
    border-color: #f59e0b;
    background: linear-gradient(180deg, #fffbeb 0%, #fff 15%);
}
.bo-card-pro {
    border-color: #7c3aed;
    background: linear-gradient(180deg, #f5f3ff 0%, #fff 15%);
}
.bo-tier-badge {
    position: absolute;
    top: -1px;
    left: -1px;
    padding: 4px 12px;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    border-radius: 12px 0 8px 0;
}
.bo-tier-std {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}
.bo-tier-pro {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    color: #fff;
}
.bo-recommend {
    position: absolute;
    top: -1px;
    right: -1px;
    padding: 4px 10px;
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    border-radius: 0 12px 0 8px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}
.bo-save-pill {
    text-align: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: #10b981;
    margin-bottom: 8px;
}
.bo-desc {
    font-size: 0.72rem;
    color: var(--gray-500);
    line-height: 1.5;
    margin: 0 0 12px;
}
.bo-section { margin-bottom: 8px; }
.bo-section-hdr {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 8px;
    border-radius: 5px;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.bo-section-pen { background: rgba(124,58,237,0.08); color: #7c3aed; }
.bo-section-inj { background: rgba(220,38,38,0.08); color: #dc2626; }
.bo-section-oral { background: rgba(37,99,235,0.08); color: #2563eb; }
.bo-section-supply { background: rgba(107,114,128,0.08); color: #6b7280; }
.bo-items { list-style: none; padding: 0; margin: 0 0 4px; }
.bo-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 3px;
}
.bo-item-pen { border-left: 2px solid #7c3aed; background: rgba(124,58,237,0.03); }
.bo-item-inj { border-left: 2px solid #dc2626; background: rgba(220,38,38,0.03); }
.bo-item-oral { border-left: 2px solid #2563eb; background: rgba(37,99,235,0.03); }
.bo-item-supply { border-left: 2px solid #9ca3af; background: rgba(107,114,128,0.03); }
.bo-item-name { font-weight: 600; color: var(--gray-700); flex-shrink: 0; }
.bo-item-spec { color: var(--gray-400); flex: 1; text-align: right; font-size: 0.65rem; }
.bo-note {
    font-size: 0.62rem;
    padding: 5px 8px;
    border-radius: 5px;
    font-weight: 500;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.bo-note-pen { color: #7c3aed; background: rgba(124,58,237,0.05); }
.bo-note-inj { color: #dc2626; background: rgba(220,38,38,0.05); }
.bo-pricing {
    text-align: center;
    padding: 12px 0 8px;
    border-top: 1px solid var(--gray-100);
    margin-top: auto;
}
.bo-retail {
    font-size: 0.72rem;
    color: var(--gray-400);
    margin-bottom: 2px;
}
.bo-retail s { font-weight: 600; }
.bo-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 2px;
}
.bo-savings {
    font-size: 0.7rem;
    font-weight: 700;
    color: #10b981;
    margin-bottom: 8px;
}
.bo-add-btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    color: #fff;
}
.bo-add-std {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}
.bo-add-std:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
}
.bo-add-pro {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
}
.bo-add-pro:hover {
    background: linear-gradient(135deg, #5b21b6, #4c1d95);
}

@media (max-width: 640px) {
    .bo-options { grid-template-columns: 1fr; }
    .bo-content { margin: 10px auto; }
    .bo-header { padding: 18px 16px; }
    .bo-header-title { font-size: 1.15rem; }
    .bo-card { padding: 24px 12px 12px; }
    .bo-item-spec { display: none; }
}
