/* Enhanced Catalog Styles */
/* Mobile-first responsive design with Material Design icons and Open Sans font */

/* Catalog Controls */
.catalog-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    align-items: center;
}

.search-container {
    position: relative;
    flex: 1;
    min-width: 280px;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    background: #fafafa;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-size: 20px;
}

.filters-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #fafafa;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filters-toggle:hover {
    border-color: #667eea;
    background: white;
}

.compare-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #667eea;
    color: white;
    border-radius: 12px;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.compare-button:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

/* View Toggle */
.view-toggle {
    display: none;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #fafafa;
    overflow: hidden;
}

.view-btn {
    padding: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:hover {
    background: rgba(102, 126, 234, 0.1);
}

.view-btn.active {
    background: #667eea;
    color: white;
}

.view-btn .material-icons {
    font-size: 18px;
    color: #6b7280;
}

.view-btn.active .material-icons {
    color: white;
}

@media (min-width: 1025px) {
    .view-toggle {
        display: flex;
    }
}

/* Filters Panel */
.filters-panel {
    max-height: 0;
    overflow: hidden;
    background: #f8fafc;
    border-radius: 12px;
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

.filters-panel.active {
    max-height: 400px;
    padding: 24px;
    border: 2px solid #e5e7eb;
}

.filters-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.filter-group h4 {
    margin: 0 0 12px 0;
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.filter-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    color: #6b7280;
    cursor: pointer;
}

.filter-group input[type="radio"],
.filter-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
}

/* Enhanced Catalog Tabs */
.catalog-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.catalog-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #fafafa;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: fit-content;
}

.catalog-tab:hover {
    border-color: #667eea;
    background: white;
    color: #374151;
}

.catalog-tab.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.catalog-tab .material-icons {
    font-size: 18px;
}

/* Category Headers */
.category-header {
    grid-column: 1 / -1;
    margin: 32px 0 24px 0;
}

.category-header h3 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-family: 'Open Sans', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    padding-bottom: 12px;
    border-bottom: 3px solid #667eea;
}

.category-header .material-icons {
    font-size: 28px;
    color: #667eea;
}

/* Enhanced Product Cards */
.catalog-grid.grid-view {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.catalog-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.catalog-grid.list-view .category-header {
    width: 100%;
}

.catalog-grid.list-view .product-card {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 16px 20px;
    min-height: 140px;
}

.catalog-grid.list-view .product-image {
    flex-shrink: 0;
    margin-bottom: 0;
    position: relative;
    width: 120px;
    height: 120px;
}

.catalog-grid.list-view .product-placeholder {
    width: 120px;
    height: 120px;
}

.catalog-grid.list-view .product-badge {
    position: absolute;
    top: 12px; /* align with .product-status in list view */
    right: 12px;
    z-index: 2;
}

.catalog-grid.list-view .product-content {
    flex: 1;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    min-width: 0;
}

.catalog-grid.list-view .product-main {
    flex: 2;
    min-width: 0;
}

.catalog-grid.list-view .product-header {
    margin-bottom: 12px;
}

.catalog-grid.list-view .product-header h3 {
    font-size: 18px;
    margin-bottom: 4px;
    line-height: 1.3;
}

.catalog-grid.list-view .product-subtitle {
    font-size: 13px;
    opacity: 0.8;
}

.catalog-grid.list-view .product-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.catalog-grid.list-view .spec-item {
    flex: 0 1 auto;
    min-width: 200px;
    font-size: 12px;
}

.catalog-grid.list-view .spec-icon {
    font-size: 14px;
}

.catalog-grid.list-view .product-pricing {
    flex-shrink: 0;
    width: 180px;
    margin-bottom: 0;
    text-align: right;
}

.catalog-grid.list-view .price-main {
    font-size: 20px;
    margin-bottom: 8px;
}

.catalog-grid.list-view .price-leasing,
.catalog-grid.list-view .delivery-time {
    font-size: 11px;
    margin-bottom: 4px;
}

.catalog-grid.list-view .product-actions {
    flex-shrink: 0;
    flex-direction: column;
    width: 100px;
    gap: 6px;
    align-items: stretch;
}

.catalog-grid.list-view .btn-primary {
    padding: 8px 12px;
    font-size: 12px;
    white-space: nowrap;
}

.catalog-grid.list-view .btn-secondary {
    padding: 6px;
    min-width: 36px;
    justify-content: center;
}

.product-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.product-card:hover {
    border-color: #667eea;
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.15);
}

.product-image {
    display: flex;
    align-items: flex-start;
    position: relative;
    width: 100%;
    height: 200px;
    background: #ffffff; /* solid white background for image area */
    border: 1px solid #e5e7eb; /* thin border around image field */
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}

/* Any plain <img> injected into .product-image should auto-fit the frame */
.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* keep aspect ratio, no cropping */
    object-position: center;
    display: block;
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.product-card:hover .product-img {
    transform: scale(1.05);
}

.product-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: none; /* avoid double border, outer frame already has a border */
    position: relative;
    overflow: hidden;
}

.product-placeholder::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.3) 50%, transparent 70%);
    transform: rotate(45deg);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.placeholder-icon {
    font-size: 48px;
    color: #667eea;
    z-index: 1;
    position: relative;
}

.product-status {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    font-family: 'Open Sans', sans-serif;
    font-size: 12px;
    font-weight: 600;
    position: absolute; /* ensure it sits over the image, not as a separate column */
    top: 12px;
    left: 12px;
    z-index: 2;
}

.product-status.in-stock {
    background: #22c55e; /* solid green */
    color: #ffffff; /* white text for contrast */
}

.product-status.pre-order {
    background: #fef3c7; /* Yellow background */
    color: #dc2626; /* Red text */
}

.product-status .material-icons {
    font-size: 16px;
}

/* Product Badges */
.product-badge {
    position: absolute;
    top: 12px; /* align with .product-status top */
    right: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    font-family: 'Open Sans', sans-serif;
    font-size: 12px;
    font-weight: 700;
    z-index: 2;
}

.product-badge.featured {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
}

.product-badge.premium {
    background: linear-gradient(135deg, #ffd700, #ffb347);
    color: #8b4513;
}

.product-badge.popular {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

/* Product Content */
.product-header {
    margin-bottom: 16px;
}

.product-header h3 {
    margin: 0 0 8px 0;
    font-family: 'Open Sans', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.3;
}

.product-subtitle {
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.4;
    /* Always reserve 2 lines under the title, and clamp overflow to 2 lines */
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(1.4em * 2);
}

.product-specs {
    margin-bottom: 20px;
}

.spec-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
    padding: 8px 0;
}

.spec-icon {
    font-size: 18px;
    color: #667eea;
    margin-top: 2px;
    flex-shrink: 0;
}

.spec-value {
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    color: #374151;
    line-height: 1.4;
}

/* Ensure the 4th spec parameter always takes exactly two lines */
.product-specs .spec-item:nth-child(4) .spec-value {
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(1.4em * 2);
}

/* Product Pricing */
.product-pricing {
    margin-bottom: 20px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
}

.price-main {
    font-family: 'Open Sans', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
}

.price-leasing,
.delivery-time {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 4px;
}

.price-leasing .material-icons,
.delivery-time .material-icons {
    font-size: 16px;
    color: #667eea;
}

/* Product Actions */
.product-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-primary {
    flex: 1;
    padding: 12px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

.btn-secondary {
    padding: 12px;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    border-color: #667eea;
    background: white;
}

.btn-secondary.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.btn-secondary .material-icons {
    font-size: 18px;
    color: #6b7280;
}

.btn-secondary.active .material-icons {
    color: white;
}

.btn-video {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    border-color: #ff6b6b;
    color: white;
}

.btn-video:hover {
    background: linear-gradient(135deg, #ee5a24, #d63031);
    border-color: #ee5a24;
    transform: translateY(-2px);
}

.btn-video .material-icons {
    color: white;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .catalog-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-container {
        min-width: auto;
    }
    
    .filters-toggle,
    .compare-button {
        justify-content: center;
    }
    
    .view-toggle {
        display: none !important;
    }
    
    .filters-content {
        grid-template-columns: 1fr;
    }
    
    .catalog-tabs {
        justify-content: flex-start;
        padding-bottom: 8px;
    }
    
    .catalog-tab span:not(.material-icons) {
        display: none;
    }
    
    .catalog-tab {
        padding: 12px;
        min-width: 48px;
        justify-content: center;
    }
    
    .catalog-grid.grid-view,
    .catalog-grid.list-view {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    
    .catalog-grid.list-view .product-card {
        flex-direction: column;
        gap: 16px;
        padding: 20px;
        min-height: auto;
    }
    
    .catalog-grid.list-view .product-content {
        flex-direction: column;
        gap: 16px;
    }
    
    .catalog-grid.list-view .product-main {
        flex: none;
    }
    
    .catalog-grid.list-view .product-pricing {
        width: 100%;
        text-align: left;
    }
    
    .catalog-grid.list-view .product-actions {
        flex-direction: row;
        width: 100%;
    }
    
    .catalog-grid.list-view .spec-item {
        min-width: auto;
        flex: 1 1 100%;
    }
    
    .product-card {
        padding: 20px;
    }
    
    .category-header h3 {
        font-size: 20px;
    }
    
    .product-header h3 {
        font-size: 16px;
    }
    
    .price-main {
        font-size: 20px;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .btn-secondary {
        flex-direction: row;
        justify-content: center;
        gap: 8px;
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .product-card {
        padding: 16px;
    }
    
    .product-placeholder {
        width: 100px;
        height: 100px;
    }
    
    .placeholder-icon {
        font-size: 36px;
    }
    
    .catalog-grid.list-view .product-placeholder {
        width: 80px;
        height: 80px;
    }

    /* Keep image frame same size as placeholder on small screens */
    .catalog-grid.list-view .product-image {
        width: 80px;
        height: 80px;
    }
    
    .catalog-grid.list-view .product-header h3 {
        font-size: 16px;
    }
    
    .catalog-grid.list-view .btn-primary {
        font-size: 14px;
        padding: 12px 16px;
    }
    
    .spec-item {
        flex-direction: column;
        gap: 4px;
    }
    
    .spec-icon {
        align-self: flex-start;
    }
}

/* Tablet Responsive */
@media (min-width: 769px) and (max-width: 1024px) {
    .catalog-grid.grid-view {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filters-content {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .product-placeholder {
        width: 120px;
        height: 120px;
    }
    
    .placeholder-icon {
        font-size: 42px;
    }
}

/* Desktop Enhancements */
@media (min-width: 1025px) {
    .catalog-controls {
        justify-content: space-between;
    }
    
    .search-container {
        max-width: 400px;
    }
    
    .filters-content {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .catalog-grid.grid-view {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Product Configuration Styles */
.product-config {
    margin-bottom: 20px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
}

.config-group {
    margin-bottom: 16px;
}

.config-group:last-child {
    margin-bottom: 0;
}

.config-label {
    display: block;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.config-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.3s ease;
}

.config-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.config-select:hover {
    border-color: #667eea;
}

/* Mobile responsive for config */
@media (max-width: 768px) {
    .product-config {
        padding: 12px;
    }
    
    .config-label {
        font-size: 13px;
    }
    
    .config-select {
        font-size: 13px;
        padding: 8px 10px;
    }
}

/* Animation for smooth transitions */
.product-card,
.catalog-tab,
.filters-panel {
    will-change: transform;
}

/* Focus states for accessibility */
.search-input:focus,
.catalog-tab:focus,
.btn-primary:focus,
.btn-secondary:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Loading states */
.product-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

.product-card.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}
