/* Products Catalog Styles */

/* FOUC Prevention */
.hero-particles span {
    opacity: 0;
    animation-play-state: paused;
}
.catalog-ready .hero-particles span {
    opacity: 1;
    animation-play-state: running;
}

/* Hero Section */
.catalog-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 60%, #312e81 100%);
    padding: 95px 0 16px;
    position: relative;
    overflow: visible;
}

.hero-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.hero-particles span {
    position: absolute;
    width: 6px;
    height: 6px;
    background: rgba(129, 140, 248, 0.4);
    border-radius: 50%;
    animation: floatUp 8s infinite ease-in-out;
}

.hero-particles span:nth-child(1) { left: 10%; animation-delay: 0s; }
.hero-particles span:nth-child(2) { left: 30%; animation-delay: 1.5s; width: 4px; height: 4px; }
.hero-particles span:nth-child(3) { left: 50%; animation-delay: 3s; }
.hero-particles span:nth-child(4) { left: 70%; animation-delay: 4.5s; width: 5px; height: 5px; }
.hero-particles span:nth-child(5) { left: 90%; animation-delay: 6s; width: 4px; height: 4px; }

@keyframes floatUp {
    0% { bottom: -10px; opacity: 0; transform: translateY(0); }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { bottom: 100%; opacity: 0; transform: translateY(-20px); }
}

.hero-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 0 10px;
    flex-wrap: nowrap;
}

.hero-left, .hero-right { flex: 0 0 auto; }
.hero-left { text-align: right; }
.hero-right { text-align: left; }

.hero-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(139,92,246,0.25));
    border: 1px solid rgba(129, 140, 248, 0.4);
    color: #c4b5fd;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    animation: pulse 2s infinite;
    height: 36px;
    line-height: 1;
    margin: 0 !important;
    vertical-align: middle;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(129, 140, 248, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(129, 140, 248, 0); }
}

.hero-title {
    font-size: 1.6rem;
    display: inline-flex;
    align-items: center;
    margin: 0 !important;
    min-height: 36px;
    line-height: 1.2;
    vertical-align: middle;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.hero-title span {
    background: linear-gradient(90deg, #818cf8, #c084fc, #f472b6);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}

.hero-tagline {
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Toolbar */
.catalog-toolbar-section {
    background: #d8d8d8ff;
    border-bottom: 2px solid #e5e7eb;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s;
}

.catalog-toolbar-section.is-fixed {
    position: fixed;
    top: var(--header-height, 64px);
    left: 0;
    right: 0;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.toolbar-placeholder { display: none; }
.toolbar-placeholder.show { display: block; }

.toolbar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    flex-wrap: wrap;
}

.toolbar-search {
    flex: 1;
    position: relative;
    min-width: 0;
}

.search-form {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-form:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.search-form i { color: #94a3b8; }

.search-form input {
    flex: 1;
    border: none;
    background: none;
    padding: 10px 12px;
    font-size: 0.9rem;
    outline: none;
    min-width: 0;
}

.search-loader {
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top-color: #6366f1;
    border-radius: 50%;
    display: none;
}

.search-loader.loading { display: block; animation: spin 0.6s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    max-height: 360px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
}

.search-dropdown.show { display: block; }

.search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

.search-item:hover, .search-item.active { background: #f8fafc; }
.search-item img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.search-item-placeholder { width: 40px; height: 40px; border-radius: 8px; background: #f1f5f9; display: flex; align-items: center; justify-content: center; color: #cbd5e1; }
.search-item-info { flex: 1; min-width: 0; }
.search-item-name { font-weight: 600; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item-meta { font-size: 0.75rem; color: #64748b; }
.search-item-price { font-weight: 700; font-size: 0.9rem; }
.search-view-all { display: block; padding: 12px; text-align: center; background: #f8fafc; color: #6366f1; font-weight: 600; text-decoration: none; border-radius: 0 0 12px 12px; }
.search-empty { padding: 30px; text-align: center; color: #94a3b8; }
.search-empty i { font-size: 2rem; color: #e2e8f0; display: block; margin-bottom: 8px; }

/* Toolbar Buttons */
.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.toolbar-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }

.filter-btn .filter-badge {
    background: #6366f1;
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: 4px;
}

.toolbar-select {
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
}

.toolbar-select:focus { outline: none; border-color: #6366f1; }

.view-toggle-btn {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    font-size: 1.1rem;
}

.view-toggle-btn:hover { 
    transform: translateY(-2px) scale(1.05); 
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.view-toggle-btn i { transition: transform 0.25s; }

/* Mobile Toolbar */
.mobile-grid-btn {
    width: 44px;
    height: 44px;
    background: #6366f1;
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
}

.mobile-filter-btn {
    position: relative;
    width: 44px; 
    height: 44px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.mobile-sort-select {
    height: 44px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding-left: 12px;
}

/* Active Filters */
.active-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    flex-wrap: wrap;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #eff6ff;
    color: #3b82f6;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.filter-tag a { color: #3b82f6; }
.clear-all { color: #ef4444; font-size: 0.8rem; font-weight: 600; text-decoration: none; margin-left: auto; }

/* Products Grid */
.catalog-products {
    background: #f8fafc;
    padding: 24px 0 40px;
    min-height: 60vh;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

/* Product Card */
.product-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover { transform: translateY(-5px); box-shadow: 0 12px 30px rgba(0,0,0,0.1); }
.product-link { display: block; text-decoration: none; }

.product-image {
    position: relative;
    height: 180px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    overflow: hidden;
}

.product-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s; }
.product-card:hover .product-image img { transform: scale(1.05); }
.placeholder-img { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #cbd5e1; font-size: 2.5rem; }

.badge { position: absolute; top: 10px; left: 10px; padding: 4px 10px; border-radius: 6px; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; }
.badge.featured { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #fff; }
.badge.oos { background: #ef4444; color: #fff; top: auto; bottom: 10px; }

.product-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15,23,42,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s;
}

.product-card:hover .product-overlay { opacity: 1; }

.quick-view {
    width: 44px;
    height: 44px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1e293b;
    font-size: 1rem;
    transform: scale(0.8);
    transition: transform 0.25s;
}

.product-card:hover .quick-view { transform: scale(1); }

.product-info { padding: 14px; }
.product-cat { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #6366f1; display: block; margin-bottom: 6px; }
.product-info h3 { font-size: 0.9rem; font-weight: 700; color: #1e293b; margin: 0 0 10px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-bottom { display: flex; justify-content: space-between; align-items: center; }
.product-price { font-size: 1rem; font-weight: 800; color: #1e293b; }
.product-arrow { width: 30px; height: 30px; background: #f1f5f9; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #64748b; transition: all 0.25s; }
.product-card:hover .product-arrow { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; transform: rotate(-45deg); }

/* Empty State */
.empty-state { grid-column: 1 / -1; text-align: center; padding: 60px 20px; background: #fff; border-radius: 16px; }
.empty-state i { font-size: 3rem; color: #e2e8f0; margin-bottom: 16px; }
.empty-state h4 { color: #1e293b; margin-bottom: 8px; }
.empty-state p { color: #64748b; margin-bottom: 20px; }
.reset-btn { display: inline-block; padding: 10px 24px; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; border-radius: 50px; font-weight: 600; text-decoration: none; }

/* Pagination */
.pagination-bar { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 30px; }
.page-btn, .page-num { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 10px; text-decoration: none; color: #64748b; font-weight: 600; transition: all 0.2s; }
.page-btn:hover, .page-num:hover { background: #e2e8f0; }
.page-num.active { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; }
.page-nums { display: flex; gap: 4px; }

/* Filter Modal */
.filter-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.filter-modal-overlay.show { opacity: 1; visibility: visible; }

.filter-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 420px;
    max-height: 85vh;
    background: #fff;
    border-radius: 20px;
    z-index: 1101;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.filter-modal.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }

.filter-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.filter-modal-header h5 { margin: 0; font-weight: 700; color: #1e293b; }
.close-modal { background: none; border: none; font-size: 1.2rem; color: #64748b; cursor: pointer; padding: 4px; }

.filter-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.filter-section { margin-bottom: 24px; }
.filter-section:last-child { margin-bottom: 0; }
.filter-section h6 { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #64748b; margin-bottom: 12px; }

.filter-options { display: flex; flex-direction: column; gap: 8px; }

.filter-radio {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 14px;
    border-radius: 10px;
    transition: background 0.2s;
}

.filter-radio:hover { background: #f8fafc; }
.filter-radio input { accent-color: #6366f1; width: 16px; height: 16px; }
.filter-radio span { flex: 1; font-size: 0.9rem; color: #334155; }
.filter-radio em { font-size: 0.8rem; color: #94a3b8; font-style: normal; }

.filter-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 14px;
    border-radius: 10px;
    background: #f8fafc;
}

.filter-check input { accent-color: #6366f1; width: 18px; height: 18px; }
.filter-check span { font-size: 0.9rem; color: #334155; }

.price-inputs { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.price-field { flex: 1; display: flex; align-items: center; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; }
.price-field span { color: #64748b; margin-right: 6px; }
.price-field input { border: none; background: none; width: 100%; font-size: 0.9rem; outline: none; }
.price-sep { color: #94a3b8; }
.price-hint { font-size: 0.75rem; color: #94a3b8; text-align: center; }

.filter-modal-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #f1f5f9;
}

.btn-reset { flex: 1; padding: 12px; background: #f1f5f9; color: #64748b; border-radius: 10px; font-weight: 600; text-decoration: none; text-align: center; }
.btn-apply { flex: 2; padding: 12px; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; border: none; border-radius: 10px; font-weight: 600; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; }
.btn-apply:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(99,102,241,0.4); }

/* Responsive */
@media (max-width: 1200px) { .products-grid { grid-template-columns: repeat(3, 1fr); } }

@media (max-width: 768px) {
    .catalog-hero { padding-top: 100px; padding-bottom: 24px; }
    .hero-row { flex-direction: column; gap: 8px; }
    .hero-title { font-size: 1.5rem; line-height: 1.1; }
    .hero-badge { font-size: 0.7rem; padding: 4px 10px; height: 24px; }
    .hero-tagline { font-size: 0.75rem; opacity: 0.8; }
    .hero-left, .hero-center, .hero-right { text-align: center; width: 100%; display: flex; justify-content: center; }
    .catalog-toolbar-section.is-fixed { top: var(--header-height-mobile, 60px); }
    .products-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .toolbar-row { flex-wrap: wrap; }
    .toolbar-search { flex: 1 1 100%; order: -1; }
}

@media (max-width: 480px) { .products-grid { grid-template-columns: 1fr; } }
