/* static/css/product_list.css — Catalog Redesign v2 */
/* Glassmorphism filter + 70% width + floating cart island */

/* ============================
   CATALOG WRAPPER (70% centered)
   ============================ */
.catalog-wrapper {
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 0 120px 0; /* bottom padding for cart island */
    min-height: 70vh;
}

/* Fix scrolling bug if inherited from global CSS */
html, body {
    height: auto !important;
    overflow-y: auto !important;
}

/* ============================
   PAGE HEADER
   ============================ */
.catalog-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 1px solid #e8e8e8;
    padding-bottom: 20px;
}
.catalog-title {
    font-family: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: #1A1A24;
    margin: 0 0 4px 0;
}
.catalog-subtitle {
    font-size: 13px;
    color: #8E8E93;
    margin: 0;
    font-weight: 600;
}
.badge-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(17, 198, 174, 0.1);
    color: #11C6AE;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 800;
    padding: 8px 16px;
    border-radius: 30px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============================
   GLASSMORPHISM FILTER PANEL
   ============================ */
.glass-filter-panel {
    position: relative;
    z-index: 100;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 22px 24px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    align-items: end;
}
.filter-group.clothing-filter {
    display: none;
}
.filter-group.clothing-filter.visible {
    display: flex;
}
/* Color Palette Popup */
.color-picker-container {
    position: relative;
    width: 100%;
    z-index: 100;
}
.color-palette-popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 16px;
    padding: 16px;
    z-index: 9999;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    width: max-content;
    max-width: 250px;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}
.color-palette-popup.active {
    display: grid;
}
.color-swatch-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.05);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    padding: 0;
    background-clip: padding-box;
    position: relative;
}
.color-swatch-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.color-swatch-btn.selected {
    border-color: #11C6AE;
    box-shadow: 0 0 0 2px #fff inset;
}
/* Color readout */
.color-readout {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #1A1A24;
    color: #fff;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.color-swatch-btn:hover .color-readout {
    opacity: 1;
}
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    position: relative;
}
.filter-label {
    font-size: 10px;
    font-weight: 800;
    color: #8E8E93;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.filter-select,
.filter-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(232, 232, 232, 0.8);
    border-radius: 12px;
    padding: 10px 12px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 600;
    font-size: 13px;
    color: #1A1A24;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}
.filter-select:focus,
.filter-input:focus {
    border-color: #11C6AE;
    box-shadow: 0 0 0 3px rgba(17, 198, 174, 0.1);
}
.filter-actions {
    display: flex;
    gap: 8px;
    align-items: end;
}
.btn-filter-apply {
    flex: 1;
    background: #11C6AE;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 11px 14px;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    text-align: center;
    font-family: 'Plus Jakarta Sans', sans-serif;
    white-space: nowrap;
}
.btn-filter-apply:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}
.btn-filter-reset {
    background: rgba(242, 242, 247, 0.8);
    color: #1A1A24;
    border: none;
    border-radius: 12px;
    padding: 11px 14px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    text-align: center;
    font-family: 'Plus Jakarta Sans', sans-serif;
    white-space: nowrap;
}
.btn-filter-reset:hover {
    background: #E5E5EA;
}

/* ============================
   AUTOCOMPLETE DROPDOWN
   ============================ */
.autocomplete-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    margin-top: 4px;
}
.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    font-size: 13px;
    font-weight: 600;
    color: #1A1A24;
    transition: background 0.15s;
}
.autocomplete-item:last-child {
    border-bottom: none;
}
.autocomplete-item:hover {
    background: #f5f5f5;
}

/* ============================
   ACTIVE FILTERS BAR
   ============================ */
.active-filters-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(17, 198, 174, 0.1);
    color: #11C6AE;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.active-filter-tag .tag-label {
    opacity: 0.7;
}

/* ============================
   COMPACT PRODUCT GRID
   ============================ */
.product-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    margin-bottom: 40px;
}

/* Product Card */
.catalog-product-card {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 24px;
    padding: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    box-sizing: border-box;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}
.catalog-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
    border-color: rgba(0,0,0,0.1);
}

/* Product Image */
.product-img-wrapper {
    width: 100%;
    aspect-ratio: 4/5;
    border-radius: 16px;
    overflow: hidden;
    background: #fafafa;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0,0,0,0.04);
}
.product-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
    pointer-events: none;
    user-select: none;
}
.catalog-product-card:hover .product-img-wrapper img {
    transform: scale(1.04);
}

/* Card Body */
.product-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.product-brand-badge {
    font-size: 9px;
    background: #11C6AE;
    color: white;
    padding: 3px 7px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    align-self: flex-start;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}
.product-sku {
    font-size: 10px;
    color: #8E8E93;
    font-weight: 700;
    margin-bottom: 4px;
}
.product-title {
    font-size: 13px;
    font-weight: 700;
    color: #1A1A24;
    line-height: 1.35;
    margin-bottom: 4px;
    height: 36px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Color Swatches */
.product-colors {
    display: flex;
    gap: 3px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.color-swatch-mini {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.1);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}
.more-colors-badge {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #F1F5F9;
    font-size: 7px;
    font-weight: 800;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
}

/* Category Pill */
.category-pill {
    width: 100%;
    background: #f1f5f9;
    text-align: center;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 10px;
    margin-top: auto;
    white-space: normal;
    line-height: 1.3;
}

/* Card Footer (Prices + Cart) */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-top: 1px solid #f0f0f0;
    padding-top: 10px;
}
.price-single {
    font-size: 13px;
    font-weight: 800;
    color: #1A1A24;
}
.price-multi {
    font-size: 11px;
    font-weight: 700;
    color: #10b981;
}
.cart-btn {
    background: #11C6AE;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
}
.cart-btn:hover {
    transform: scale(1.1);
    opacity: 0.9;
}

/* ============================
   EMPTY STATE
   ============================ */
.empty-state {
    grid-column: 1 / -1;
    background: #fff;
    border-radius: 20px;
    padding: 60px 20px;
    text-align: center;
    border: 1px dashed #e8e8e8;
}
.empty-state h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20px;
    font-weight: 800;
    color: #8E8E93;
    margin-bottom: 8px;
}
.empty-state p {
    color: #8E8E93;
    font-size: 14px;
}

/* ============================
   PAGINATION
   ============================ */
.pagination-wrapper {
    margin: 30px 0 20px 0;
    display: flex;
    justify-content: center;
    gap: 8px;
}
.page-btn {
    background: #fff;
    border: 1px solid #e8e8e8;
    color: #1A1A24;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.2s;
}
.page-btn:hover:not(.disabled):not(.active) {
    background: #F2F2F7;
    border-color: #c5c5c5;
}
.page-btn.active {
    background: #1A1A24;
    border-color: #1A1A24;
    color: #fff;
}
.page-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ============================
   FLOATING CART ISLAND (BOTTOM)
   ============================ */
.cart-island {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    width: 70%;
    max-width: 1400px;
    background: rgba(26, 26, 36, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    z-index: 1000;
    box-shadow: 0px 10px 40px rgba(0, 0, 0, 0.3);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s;
    opacity: 0;
    pointer-events: none;
}
.cart-island.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: all;
}

.cart-island-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.cart-icon-wrapper {
    width: 44px;
    height: 44px;
    background: #11C6AE;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cart-count-text {
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

/* Mini items row inside cart island */
.cart-island-items {
    display: flex;
    gap: 8px;
    flex: 1;
    overflow-x: auto;
    padding: 4px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.cart-island-items::-webkit-scrollbar {
    display: none;
}
.cart-mini-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 6px 12px 6px 6px;
    flex-shrink: 0;
    max-width: 200px;
}
.cart-mini-img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
    background: rgba(255,255,255,0.1);
    flex-shrink: 0;
}
.cart-mini-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.cart-mini-title {
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}
.cart-mini-qty {
    color: rgba(255,255,255,0.5);
    font-size: 10px;
    font-weight: 600;
}

.cart-island-right {
    flex-shrink: 0;
}
.cart-island-btn {
    background: #1A1A24;
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 24px;
    border-radius: 30px;
    text-decoration: none;
    transition: background 0.2s;
}
.cart-island-btn:hover {
    background: #333;
    color: #fff;
}

/* Lazy Load Indicator */
.lazy-load-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
    width: 100%;
}
.loader-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top: 4px solid #1A1A24;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================
   STICKY ACTION BAR (QUICK ADD)
   ============================ */
.sticky-action-bar {
    position: fixed;
    bottom: 120px;
    left: 50%;
    width: 70%;
    max-width: 1400px;
    background: rgba(26, 26, 36, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2000;
    box-shadow: 0px 10px 40px rgba(0, 0, 0, 0.25);
    transform: translateX(-50%) translateY(150px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s;
    opacity: 0;
    pointer-events: none;
}
.sticky-action-bar.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: all;
}
@media (max-width: 900px) {
    .sticky-action-bar {
        left: 50%;
        width: 90%;
        bottom: 80px; /* Above cart island if any */
        flex-direction: column;
        gap: 15px;
    }
    .sticky-action-bar.visible {
        transform: translateX(-50%) translateY(0);
    }
}


/* Cart add animation */
@keyframes cartPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}
.cart-btn.added {
    animation: cartPulse 0.3s ease;
    background: #10b981;
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 1200px) {
    .catalog-wrapper {
        width: 85%;
    }
    .cart-island,
    .sticky-action-bar {
        width: 90%;
    }
}
@media (max-width: 768px) {
    .catalog-wrapper {
        width: 95%;
        padding: 15px 0 120px 0;
    }
    .catalog-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .filter-grid {
        grid-template-columns: 1fr 1fr;
    }
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
    .cart-island {
        width: 95%;
        flex-direction: column;
        gap: 12px;
        padding: 14px 16px;
    }
    .sticky-action-bar {
        width: 95%;
    }
    .cart-island-items {
        width: 100%;
    }
}
