/**
 * Product Selection - Clean Sidebar Layout
 * Modern, clean design with left sidebar filters
 */

/* ====== Base Layout ====== */
.product-selection-page.sidebar-layout {
    background: linear-gradient(180deg, #f8fafc 0%, #f0f4ff 50%, #faf5ff 100%);
    min-height: 100vh;
    padding-top: 80px;
}

.selection-container {
    display: flex;
    max-width: 1440px;
    margin: 0 auto;
    gap: 0;
}

/* ====== Left Sidebar ====== */
.selection-sidebar {
    width: 280px;
    min-width: 280px;
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
    border-right: 1px solid #e5e7eb;
    padding: 0;
    position: sticky;
    top: 80px;
    height: calc(100vh - 80px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
    box-shadow: 2px 0 20px rgba(0,0,0,0.03);
}

.selection-sidebar::-webkit-scrollbar {
    width: 5px;
}

.selection-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.selection-sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #d1d5db 0%, #9ca3af 100%);
    border-radius: 10px;
}

.selection-sidebar::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.sidebar-close {
    display: none;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e9ecef;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-header h3 i {
    color: #6c757d;
}

.btn-clear-all {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-clear-all:hover {
    background: #f8f9fa;
    color: #dc3545;
}

/* Filter Section */
.filter-section {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f3f4;
}

.filter-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.filter-title-row .filter-title {
    margin-bottom: 0;
}

.filter-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    margin: 0 0 16px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Color View Toggle Button */
.color-view-toggle {
    width: 28px;
    height: 28px;
    border: 1px solid #dee2e6;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    transition: all 0.2s;
}

.color-view-toggle:hover {
    border-color: #667eea;
    color: #667eea;
}

.color-view-toggle.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: #fff;
}

/* Color Text Options */
.color-text-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.color-text-item {
    font-size: 0.9rem;
}

.color-text-item input[type="radio"] {
    position: absolute;
    opacity: 0;
}

/* Color Options */
.color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid #fff;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 0 1px #dee2e6;
    position: relative;
}

.color-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 2px #667eea;
}

.color-btn.active {
    box-shadow: 0 0 0 3px #764ba2;
    transform: scale(1.1);
}

.color-btn.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Size Options */
.size-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.size-btn {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    background: #fff;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s;
}

.size-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.size-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: #fff;
}

/* Checkbox Options */
.checkbox-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #495057;
    position: relative;
    padding-left: 28px;
}

.checkbox-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkbox-item .checkmark {
    position: absolute;
    left: 0;
    width: 18px;
    height: 18px;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.2s;
}

.checkbox-item:hover .checkmark {
    border-color: #667eea;
}

.checkbox-item input:checked ~ .checkmark {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

.checkbox-item input:checked ~ .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ====== Main Content ====== */
.selection-main {
    flex: 1;
    padding: 24px 32px;
    min-width: 0;
}

/* Top Bar */
.selection-topbar {
    margin-bottom: 24px;
}

.selection-breadcrumb {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 16px;
}

.selection-breadcrumb a {
    color: #6c757d;
    text-decoration: none;
}

.selection-breadcrumb a:hover {
    color: #667eea;
}

.selection-breadcrumb span {
    margin: 0 8px;
}

.selection-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

/* Active Filters Inline */
.active-filters-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.clear-filters-link {
    color: #6c757d;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.clear-filters-link:hover {
    color: #dc3545;
}

.active-filters-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #e9ecef;
    color: #495057;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tag:hover {
    background: #dee2e6;
}

.filter-tag .remove-tag {
    font-size: 0.7rem;
    opacity: 0.7;
}

.filter-tag:hover .remove-tag {
    opacity: 1;
}

/* Top Bar Right */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.products-count-inline {
    font-size: 0.9rem;
    color: #6c757d;
}

.products-count-inline strong {
    color: #212529;
    font-weight: 600;
}

/* Search Box */
.search-box-inline {
    position: relative;
    width: 260px;
}

.search-box-inline i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.search-box-inline input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;
}

.search-box-inline input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.search-box-inline:focus-within i {
    color: #667eea;
}

.search-box-inline input::placeholder {
    color: #9ca3af;
}

/* Mobile Filter Button */
.mobile-filter-btn {
    display: none;
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 20px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.mobile-filter-btn:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.mobile-filter-btn i {
    margin-right: 8px;
}

/* ====== Products Grid ====== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* Product Card - Modern Style */
.product-card {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    position: relative;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 50px rgba(102, 126, 234, 0.2), 0 10px 25px rgba(0,0,0,0.08);
}

.product-card:hover::before {
    opacity: 1;
}

.product-image-wrapper {
    position: relative;
    padding-top: 100%;
    overflow: hidden;
    background: #f8f9fa;
    cursor: pointer;
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.4s ease;
}

.product-card:hover .product-image {
    transform: scale(1.08);
}

/* Product Badges */
.product-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 2;
}

.product-badges .product-badge {
    position: relative;
    top: auto;
    left: auto;
}

.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.product-badge.new {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
}

.product-badge.hot {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    animation: pulse-badge 2s ease-in-out infinite;
}

.product-badge.promo {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Quick View Button */
.product-quick-view {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    color: #212529;
    border: none;
    padding: 10px 24px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.78rem;
    cursor: pointer;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    white-space: nowrap;
}

.product-card:hover .product-quick-view {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.product-quick-view:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.product-quick-view i {
    margin-right: 6px;
}

/* Product Info */
.product-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    background: linear-gradient(to bottom, #fff, #fafbfc);
}

.product-category {
    font-size: 0.7rem;
    color: #667eea;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.product-category::before {
    content: '';
    width: 6px;
    height: 6px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
}

.product-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 12px;
    line-height: 1.5;
    min-height: 44px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-shrink: 0;
    transition: color 0.2s;
}

.product-card:hover .product-title {
    color: #667eea;
}

/* Product Specs Tags */
.product-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.spec-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 500;
    transition: all 0.2s;
}

.spec-tag i {
    font-size: 0.65rem;
    opacity: 0.8;
}

.spec-color {
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.spec-size {
    background: linear-gradient(135deg, #fef3f2 0%, #fef0ef 100%);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.product-actions {
    display: flex;
    margin-top: auto;
}

.btn-inquiry {
    flex: 1;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #fff !important;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.3);
}

.btn-inquiry:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%) !important;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn-inquiry:active {
    transform: translateY(0);
}

.btn-inquiry i {
    font-size: 1.1rem;
}

/* ====== Loading & States ====== */
.products-loading {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e9ecef;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.no-results {
    text-align: center;
    padding: 80px 20px;
    color: #6c757d;
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-results h3 {
    font-size: 1.25rem;
    color: #495057;
    margin-bottom: 8px;
}

/* Load More */
.load-more-wrapper {
    text-align: center;
    margin-top: 48px;
    padding-bottom: 40px;
}

.btn-load-more {
    padding: 16px 48px;
    background: #fff;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.15);
}

.btn-load-more:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: transparent;
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.btn-load-more:active {
    transform: translateY(-1px);
}

/* ====== Mobile Overlay ====== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* ====== Quick View Modal ====== */
.product-quick-view-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
}

.product-quick-view-modal.active {
    display: block;
}

.quick-view-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}

.quick-view-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 12px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.quick-view-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: #f8f9fa;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s;
}

.quick-view-close:hover {
    background: #e9ecef;
}

.quick-view-body {
    padding: 24px;
}

/* ====== Responsive ====== */
@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .product-selection-page.sidebar-layout {
        padding-top: 60px;
    }
    
    .selection-sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 300px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        padding-top: 0;
    }
    
    .selection-sidebar.active {
        left: 0;
    }
    
    .sidebar-close {
        display: flex;
        position: absolute;
        top: 16px;
        right: 16px;
        width: 32px;
        height: 32px;
        background: #f8f9fa;
        border: none;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 11;
    }
    
    .mobile-filter-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .selection-main {
        padding: 20px 16px;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .topbar-right {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        width: 100%;
    }
    
    .search-box-inline {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .product-card {
        border-radius: 12px;
    }
    
    .product-info {
        padding: 10px;
    }
    
    .product-category {
        font-size: 0.6rem;
        margin-bottom: 4px;
    }
    
    .product-category::before {
        width: 4px;
        height: 4px;
    }
    
    .product-title {
        font-size: 0.8rem;
        min-height: 36px;
        margin-bottom: 8px;
    }
    
    .product-specs {
        gap: 4px;
        margin-bottom: 8px;
    }
    
    .spec-tag {
        padding: 3px 8px;
        font-size: 0.65rem;
    }
    
    .spec-tag i {
        display: none;
    }
    
    .btn-inquiry {
        padding: 10px 12px;
        font-size: 0.72rem;
        border-radius: 8px;
    }
    
    .btn-inquiry i {
        font-size: 0.9rem;
    }
    
    .selection-breadcrumb {
        font-size: 0.8rem;
    }
    
    .product-quick-view {
        padding: 8px 16px;
        font-size: 0.7rem;
    }
    
    .product-badge {
        padding: 4px 10px;
        font-size: 0.6rem;
    }
}
