/**
 * ADF Product Filters - Stylesheet
 * Styles for the filtering sidebar and product grid
 */

/* ==========================================================================
   Fonts — Sohne (self-hosted, files in assets/fonts/)
   Buch = 400 (body), Kraftig = 500 (smaller titles), Halbfett = 600 (titles)
   ========================================================================== */
@font-face {
    font-family: 'Sohne';
    src: url('../fonts/soehne-web-buch.eot');
    src: url('../fonts/soehne-web-buch.eot?#iefix') format('embedded-opentype'),
         url('../fonts/soehne-web-buch.woff2') format('woff2'),
         url('../fonts/soehne-web-buch.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Sohne';
    src: url('../fonts/soehne-web-kraftig.eot');
    src: url('../fonts/soehne-web-kraftig.eot?#iefix') format('embedded-opentype'),
         url('../fonts/soehne-web-kraftig.woff2') format('woff2'),
         url('../fonts/soehne-web-kraftig.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Sohne';
    src: url('../fonts/soehne-web-halbfett.eot');
    src: url('../fonts/soehne-web-halbfett.eot?#iefix') format('embedded-opentype'),
         url('../fonts/soehne-web-halbfett.woff2') format('woff2'),
         url('../fonts/soehne-web-halbfett.woff') format('woff');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

/* ==========================================================================
   CSS Variables
   ========================================================================== */

:root {
    --adf-primary-color: #333333;
    --adf-secondary-color: #666666;
    --adf-border-color: #e5e5e5;
    --adf-background-color: #ffffff;
    --adf-hover-color: #f5f5f5;
    --adf-accent-color: #000000;
    --adf-text-color: #333333;
    --adf-text-light: #888888;
    --adf-font-family: 'Sohne', -apple-system, BlinkMacSystemFont, sans-serif;
    --adf-transition: all 0.2s ease;
    --adf-radius: 0;

    /* Typography — tweak these to match the main site */
    --adf-card-title-size: 15px;
    --adf-card-title-weight: 400;
    --adf-card-price-size: 14px;
    --adf-card-price-vat-size: 11px;
    --adf-filter-title-size: 12px;
    --adf-filter-title-weight: 500;
    --adf-filter-label-size: 13px;
}

/* ==========================================================================
   Filter Sidebar Styles
   ========================================================================== */

.adf-filters-wrapper {
    width: 100%;
    max-width: 250px;
    font-family: var(--adf-font-family);
}

.adf-filters-form {
    padding: 0;
    margin: 0;
}

/* Filter Group */
.adf-filter-group {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--adf-border-color);
}

.adf-filter-group:last-of-type {
    border-bottom: none;
}

/* Filter section heading — Sohne Kraftig */
.adf-filter-title {
    font-size: var(--adf-filter-title-size);
    font-weight: var(--adf-filter-title-weight);
    color: var(--adf-text-color);
    margin: 0 0 15px 0;
    padding: 0;
}

/* Filter Options List */
.adf-filter-options {
    list-style: none;
    margin: 0;
    padding: 0;
}

.adf-filter-option {
    margin-bottom: 10px;
}

.adf-filter-option:last-child {
    margin-bottom: 0;
}

.adf-filter-option label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: var(--adf-filter-label-size);
    color: var(--adf-text-color);
    transition: var(--adf-transition);
}

.adf-filter-option label:hover {
    color: var(--adf-accent-color);
}

/* Custom Radio Button */
.adf-filter-input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.adf-filter-checkbox {
    position: relative;
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 1px solid var(--adf-secondary-color);
    border-radius: 2px;
    margin-right: 10px;
    flex-shrink: 0;
    transition: var(--adf-transition);
}

.adf-filter-checkbox::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 4px;
    width: 4px;
    height: 8px;
    border: solid var(--adf-accent-color);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: var(--adf-transition);
}

.adf-filter-input:checked + .adf-filter-checkbox {
    border-color: var(--adf-accent-color);
}

.adf-filter-input:checked + .adf-filter-checkbox::after {
    transform: rotate(45deg) scale(1);
}

.adf-filter-option label:hover .adf-filter-checkbox {
    border-color: var(--adf-accent-color);
}

/* Filter Label and Count */
.adf-filter-label {
    flex: 1;
}

.adf-filter-count {
    color: var(--adf-text-light);
    font-size: 13px;
    margin-left: 5px;
}

/* Clear Filters Button */
.adf-clear-filters {
    display: inline-block;
    background: none !important;
    border: none !important;
    padding: 0;
    margin-top: 20px;
    font-size: 13px;
    color: #1a1a1a !important;
    text-decoration: underline;
    cursor: pointer;
    transition: var(--adf-transition);
    font-family: var(--adf-font-family);
}

.adf-clear-filters:hover {
    color: #4a4a4a !important;
}

/* ==========================================================================
   Products Grid Styles
   ========================================================================== */

.adf-products-wrapper {
    position: relative;
    font-family: var(--adf-font-family);
}

/* Products Header */
.adf-products-header {
    margin-bottom: 30px;
}

.adf-results-count {
    font-size: 14px;
    color: var(--adf-text-light);
    margin: 0 0 5px 0;
}

.adf-products-subtitle {
    font-size: 14px;
    color: var(--adf-text-light);
    margin: 0;
}

/* Loading Overlay */
.adf-products-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.adf-spinner {
    width: 40px;
    height: 40px;
    border: 2px solid var(--adf-border-color);
    border-top-color: var(--adf-accent-color);
    border-radius: 50%;
    animation: adf-spin 0.8s linear infinite;
}

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

.adf-products-loading p {
    margin-top: 15px;
    font-size: 14px;
    color: var(--adf-secondary-color);
}

/* Products Grid */
.adf-products-grid {
    display: grid;
    gap: 30px;
    transition: opacity 0.2s ease;
}

.adf-products-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.adf-products-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.adf-products-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.adf-products-grid.is-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Product Card */
.adf-product-card {
    display: flex;
    flex-direction: column;
}

.adf-product-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.adf-product-link:hover {
    text-decoration: none;
}

.adf-product-image-wrapper {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background-color: #f8f8f8;
    margin-bottom: 15px;
}

.adf-product-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Default hover effect (scale) for cards without hover image */
.adf-product-card:not(.has-hover-image):hover .adf-product-image-wrapper img {
    transform: scale(1.05);
}

/* Hover image swap effect */
.adf-product-card.has-hover-image .adf-image-primary {
    opacity: 1;
}

.adf-product-card.has-hover-image .adf-image-hover {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
}

.adf-product-card.has-hover-image:hover .adf-image-primary {
    opacity: 0;
}

.adf-product-card.has-hover-image:hover .adf-image-hover {
    opacity: 1;
}

.adf-product-info {
    text-align: left;
}

/* Product card title — Sohne Buch (reduced per client feedback) */
.adf-product-title {
    font-size: var(--adf-card-title-size);
    font-weight: var(--adf-card-title-weight);
    color: var(--adf-text-color);
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.adf-product-price {
    font-size: 15px;
    color: var(--adf-text-color);
    margin: 0 0 10px 0;
}

.adf-price-from {
    font-size: 15px;
}

.adf-price-amount {
    font-size: var(--adf-card-price-size);
    font-weight: 400;
}

.adf-price-vat {
    font-size: var(--adf-card-price-vat-size);
    font-style: italic;
}

.adf-product-price del {
    color: var(--adf-text-light);
    margin-left: 8px;
}

/* View Product Link */
.adf-view-product-link {
    display: inline-block;
    font-size: 13px;
    color: var(--adf-secondary-color);
    text-decoration: underline !important;
    transition: var(--adf-transition);
    margin-top: auto;
}

.adf-view-product-link:hover {
    color: var(--adf-accent-color);
}

/* No Products Message */
.adf-no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--adf-secondary-color);
    font-size: 16px;
}

/* Error Message */
.adf-error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #c00;
    font-size: 14px;
    background: #fff5f5;
    border-radius: 4px;
}

/* Pagination / View All */
.adf-products-pagination {
    text-align: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--adf-border-color);
}

.adf-view-all-products {
    display: inline-block;
    font-size: 14px;
    color: var(--adf-secondary-color);
    text-decoration: underline;
    transition: var(--adf-transition);
}

.adf-view-all-products:hover {
    color: var(--adf-accent-color);
}

/* ==========================================================================
   Shop Page Layout (Elementor Integration)
   ========================================================================== */

/* Use these classes when building the layout in Elementor */
.adf-shop-layout {
    display: flex;
    gap: 60px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

.adf-shop-sidebar {
    flex: 0 0 250px;
    min-width: 250px;
}

.adf-shop-content {
    flex: 1;
    min-width: 0;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

@media (max-width: 1024px) {
    .adf-products-grid.columns-3,
    .adf-products-grid.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .adf-shop-layout {
        gap: 40px;
    }

    .adf-shop-sidebar {
        flex: 0 0 200px;
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .adf-shop-layout {
        flex-direction: column;
        gap: 30px;
    }

    .adf-shop-sidebar {
        flex: none;
        min-width: 100%;
        width: 100%;
    }

    .adf-filters-wrapper {
        max-width: 100%;
    }

    /* Horizontal filters on mobile */
    .adf-filter-group {
        display: inline-block;
        margin-right: 30px;
        margin-bottom: 20px;
        padding-bottom: 0;
        border-bottom: none;
    }

    .adf-products-grid.columns-2,
    .adf-products-grid.columns-3,
    .adf-products-grid.columns-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .adf-product-title {
        font-size: 13px;
    }

    .adf-product-price {
        font-size: 13px;
    }
}

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

    .adf-filter-group {
        display: block;
        margin-right: 0;
        border-bottom: 1px solid var(--adf-border-color);
        padding-bottom: 20px;
    }
}

/* ==========================================================================
   Mobile Filter Toggle (Optional Enhancement)
   ========================================================================== */

.adf-filter-toggle {
    display: none;
    width: 100%;
    padding: 15px 20px;
    background: var(--adf-background-color);
    border: 1px solid var(--adf-border-color);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    margin-bottom: 20px;
}

.adf-filter-toggle::after {
    content: '+';
    float: right;
    font-weight: 300;
    font-size: 18px;
}

.adf-filter-toggle.is-active::after {
    content: '-';
}

@media (max-width: 768px) {
    .adf-filter-toggle {
        display: block;
    }

    .adf-filters-form {
        display: none;
    }

    .adf-filters-form.is-open {
        display: block;
    }
}

/* ==========================================================================
   Elementor Overrides
   ========================================================================== */

/* Ensure our styles take precedence when used with Elementor */
.elementor .adf-products-grid {
    display: grid;
}

.elementor .adf-product-card {
    margin: 0;
}

.elementor .adf-filter-option label {
    margin: 0;
}
