/* products.css - Product Grid, Catalog, and Detail Page 1:1 Parity */

:root {
    --primary-navy: #1b2d3c;
    --accent-red: #d92128;
    --products-text-dark: #1a1a1b;
    --products-text-gray: #4a4a4a;
    --products-bg-light: #f9f9f9;
    --products-border-light: #e6e6e6;
}

/* Catalog Layout */
.catalog-hero-full {
    width: 100%;
    position: relative;
}

.catalog-hero-img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.hero-content-wrapper {
    position: relative;
    padding-top: 40px;
    padding-bottom: 20px;
}

.katalog-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    padding: 20px clamp(10px, 3vw, 40px) 60px;
    background-color: #fff;
    align-items: start;
    width: 100%;
}

@media (max-width: 991px) {
    .katalog-layout {
        flex-direction: column;
        padding: 20px 20px 60px;
    }
}

.sidebar {
    flex: 0 0 240px;
    max-width: 100%;
    position: relative;
    z-index: 10;
}

@media (max-width: 991px) {
    .sidebar {
        flex: 1 1 auto;
        width: 100%;
        margin-bottom: 40px;
    }
}

.katalog-main {
    flex: 1 1 600px; /* Base of 600 ensures wrap when narrow, grows on desktop */
    min-width: 0;
}

@media (max-width: 991px) {
    .katalog-main {
        flex: 1 1 auto;
        width: 100%;
    }
}

.sidebar-section h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--products-text-dark);
    text-transform: none;
}

.sidebar-divider {
    height: 1px;
    background: var(--products-border-light);
    margin: 25px 0;
}

.search-bar-sidebar {
    position: relative;
    margin-bottom: 10px;
}

.search-bar-sidebar input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--products-border-light);
    font-size: 0.9rem;
    outline: none;
}

.search-bar-sidebar i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--products-text-gray);
}

.category-list {
    list-style: none;
    padding: 0;
}

.category-list li {
    margin-bottom: 10px;
}

.cat-link {
    text-decoration: none;
    color: var(--products-text-dark);
    font-size: 0.95rem;
    font-weight: 400;
    transition: all 0.2s;
    display: inline-block;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
}

.cat-link:hover,
.cat-link.active {
    font-weight: 700;
    border-bottom: 2px solid var(--products-text-dark);
}

/* Filter Styling */
.filter-group {
    margin-bottom: 25px;
    border-bottom: 1px solid var(--products-border-light);
    padding-bottom: 15px;
}



.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 5px 0;
    color: var(--products-text-dark);
}

.filter-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 10px;
}

.filter-content.hidden {
    display: none;
}

.filter-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--products-text-gray);
    cursor: pointer;
    transition: color 0.2s;
}

.filter-list-item:hover {
    color: var(--products-text-dark);
}

.filter-list-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Dual-Handle Price Range Slider */
.price-range-wrapper {
    position: relative;
    height: 30px;
    margin: 20px 0 10px;
}

.price-range-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--products-border-light);
    border-radius: 2px;
    transform: translateY(-50%);
}

.price-range-fill {
    position: absolute;
    top: 0;
    height: 100%;
    background: var(--primary-navy);
    border-radius: 2px;
}

.price-range-input {
    position: absolute;
    width: 100%;
    height: 4px;
    background: none;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
    top: 50%;
    transform: translateY(-50%);
    outline: none;
}

.price-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-navy);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    transition: background 0.2s;
}

.price-range-input::-webkit-slider-thumb:hover {
    background: var(--accent-red);
}

.price-range-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-navy);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.price-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--products-text-gray);
    font-weight: 500;
    margin-top: 5px;
}

/* Reset Filters Button */
.filter-reset-btn {
    display: block;
    width: 100%;
    padding: 9px;
    margin-top: 20px;
    border: 1px solid var(--products-border-light);
    background: #fff;
    color: var(--products-text-dark);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    text-align: center;
    transition: background 0.2s;
}

.filter-reset-btn:hover {
    background: #f1f5f9;
}


/* Fixed: removed duplicate block here */

/* Product Grid - Reliable columns without clamp to prevent overlaps */
.product-grid {
    display: grid;
    /* Use auto-fill with a tight min-width to maximize tiles */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 30px 20px;
    width: 100%;
}

.product-card {
    position: relative;
    text-decoration: none;
    color: var(--products-text-dark);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.badge-angebot {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--primary-navy);
    color: #fff;
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 2;
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 15px;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

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

.product-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.product-title {
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.4;
    margin: 0;
}

.product-price-line {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    margin-top: auto;
}

.price-original,
.detail-price-original {
    color: #1a1a1b;
    text-decoration: line-through;
    font-size: 0.9rem;
}

.price-offer,
.detail-price-offer {
    font-weight: 700;
    color: var(--accent-red);
}

.price-normal {
    font-weight: 700;
    color: var(--products-text-dark);
}

.detail-price-offer {
    font-size: 1.5rem;
}

/* Catalog Hero and Header */
.catalog-hero-img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    margin-bottom: 40px;
}

.katalog-header-text h1 {
    font-size: clamp(2.5rem, 8vw, 3.8rem);
    font-weight: 800;
    margin-bottom: 15px;
    line-height: 1.1;
    color: #1a202c;
}

.katalog-header-text p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--products-text-gray);
    margin-bottom: 30px;
}

.katalog-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-top: 1px solid var(--products-border-light);
    border-bottom: 1px solid var(--products-border-light);
    margin-bottom: 30px;
}

.results-count-text {
    font-size: 0.9rem;
}

.sort-group select {
    border: 1px solid var(--products-border-light);
    padding: 5px 10px;
    font-size: 0.9rem;
    outline: none;
}

/* --- Product Detail Page --- */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #1B293E;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 25px;
    padding: 8px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
}

.btn-back:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    transform: translateX(-2px);
}

.product-detail-container {
    padding-top: 20px;
}

.detail-layout {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(30px, 5vw, 60px);
    align-items: start;
}

@media (max-width: 900px) {
    .detail-layout {
        flex-direction: column;
    }
}

.detail-sidebar {
    flex: 1 1 400px;
    min-width: 300px;
}

@media (max-width: 900px) {
    .detail-sidebar {
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
    }
}

.detail-gallery {
    flex: 1 1 500px;
    min-width: 300px;
    position: relative;
}

@media (max-width: 900px) {
    .detail-gallery {
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
    }
}

/* Gallery / Carousel */
.detail-gallery {
    position: relative;
}

.carousel-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1.2;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-main-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
}

.dot.active {
    background: var(--products-text-dark);
}

.breadcrumb {
    font-size: 0.85rem;
    margin-bottom: 20px;
    color: var(--products-text-gray);
}

.breadcrumb a {
    text-decoration: none;
    color: inherit;
}

.detail-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.2;
}

.detail-sku {
    font-size: 0.85rem;
    color: var(--products-text-gray);
    margin-bottom: 25px;
}

.price-container {
    margin-bottom: 30px;
}

.detail-price-original {
    color: #1a1a1b;
    text-decoration: line-through;
    font-size: 1.1rem;
    display: block;
    margin-bottom: 5px;
}

.detail-price-offer {
    font-size: 1.8rem;
    font-weight: 700;
}

/* Variants */
.selector-group {
    margin-bottom: 25px;
}

.selector-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.variant-dropdown {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--products-border-light);
    font-size: 0.95rem;
    outline: none;
}

/* Detail Tabs */
.detail-tabs {
    margin-top: 60px;
    border-top: 1px solid var(--products-border-light);
}

.tab-headers {
    display: flex;
    gap: 30px;
    border-bottom: 1px solid var(--products-border-light);
}

.tab-btn {
    padding: 20px 0;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    color: var(--products-text-gray);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: var(--products-text-dark);
    border-bottom: 2px solid var(--products-text-dark);
}

.tab-content {
    padding: 30px 0;
    line-height: 1.8;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Buttons */
.btn-primary {
    background: var(--primary-navy);
    color: #fff;
    border: none;
    padding: 15px 30px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
    width: 100%;
    margin-top: 20px;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: #fff;
    color: var(--products-text-dark);
    border: 1px solid var(--products-border-light);
    padding: 15px 30px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 0;
    grid-column: 1 / -1;
}

.loading-spinner i {
    font-size: 2.5rem;
    color: var(--primary-navy);
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* Product Detail Simplified Layout */
.detail-info-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--products-border-light);
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 25px;
    color: var(--products-text-dark);
}

.description-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--products-text-gray);
    margin-bottom: 40px;
}

/* Pagination */
.pagination-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(4px, 1.5vw, 8px);
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--products-border-light);
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: clamp(32px, 8vw, 40px);
    height: clamp(32px, 8vw, 40px);
    padding: 0 clamp(6px, 1.5vw, 10px);
    border: 1px solid var(--products-border-light);
    background: #fff;
    color: var(--products-text-dark);
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: var(--products-text-dark);
}

.pagination-btn.active {
    background: var(--primary-navy);
    color: #fff;
    border-color: var(--primary-navy);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 0.9rem;
    color: var(--products-text-gray);
    margin: 0 15px;
}

/* --- Admin Image Drop Zone --- */
#image-drop-zone {
    border: 2px dashed #cbd5e1;
    background: #f8fafc;
    transition: all 0.2s ease;
}

#image-drop-zone:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

#image-drop-zone.dragover {
    border-color: #2563eb;
    background: #dbeafe;
    transform: scale(1.01);
}