/* ========================================================
   FIRELAX - Modern Product Card (Visual Geometric Style)
   Implementation of the "Color Header & Angled Divider" design
   ======================================================== */

.product-card {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
    overflow: visible;
    height: 100%;
    border: 1px solid #f0f0f0;
    padding: 12px; /* Shared inner gutter so header/body/footer align */
    container-type: inline-size;
    min-width: 200px;
}

/* =========================================
   Container Queries – proportionale Skalierung
   (wirkt wie SVG: Card-Inhalte passen sich
   der Kartenbreite an, nicht dem Viewport)
   ========================================= */

@container (max-width: 280px) {
    .card-visual-header {
        height: 170px;
    }
    .product-title {
        font-size: 0.95rem;
        height: 2.47em;
    }
    .current-price {
        font-size: 1.25rem;
    }
    .category-tag {
        font-size: 0.62rem;
        padding: 4px 9px;
    }
    .product-property-badge {
        font-size: 0.72rem;
        padding: 3px 6px;
    }
    .btn-add-to-cart-block {
        font-size: 0.78rem;
        padding: 10px 8px;
    }
}

@container (max-width: 240px) {
    .card-visual-header {
        height: 150px;
    }
    .product-title {
        font-size: 0.85rem;
        height: 2.21em;
    }
    .current-price {
        font-size: 1.1rem;
    }
    .card-footer-row {
        flex-direction: column;
        gap: 6px;
    }
    .qty-selector-mock {
        width: 100%;
    }
    .rating-stars {
        font-size: 0.7rem;
    }
    .price-vat-hint {
        font-size: 0.65rem;
    }
    .product-base-price-hint {
        font-size: 0.65rem;
    }
}

.product-card__stretched-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.product-card__stretched-link--list {
    border-radius: 20px;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
}

/* =========================================
   1. Visual Header (Color Block & Image)
   ========================================= */
.card-visual-header {
    position: relative;
    z-index: 2;
    width: calc(100% + 24px);
    height: 200px;
    border-radius: 16px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 0;
    clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
    margin-top: -12px;
    margin-left: -12px;
    margin-right: -12px;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: center;
}

.card-content,
.card-actions-bottom {
    width: 100%;
    position: relative;
    z-index: 2;
}

/* Color cycling - Brand-harmonische Farben (muted, professionell) */
.product-card:nth-child(4n+1) .card-visual-header {
    background: linear-gradient(145deg, #2d3748 0%, #1a202c 100%); /* Deep Slate */
}
.product-card:nth-child(4n+2) .card-visual-header {
    background: linear-gradient(145deg, #1e3a5f 0%, #152944 100%); /* Deep Navy */
}
.product-card:nth-child(4n+3) .card-visual-header {
    background: linear-gradient(145deg, #3b2d4e 0%, #271f36 100%); /* Deep Plum */
}
.product-card:nth-child(4n+4) .card-visual-header {
    background: linear-gradient(145deg, #1a3d2b 0%, #0f2419 100%); /* Deep Forest */
}

/* Image inside the header */
.product-image-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80%;
    height: 80%;
    position: relative;
    z-index: 2;
    background: transparent;
    border-radius: 12px;
}

.card-favorite-overlay,
.btn-favorite--overlay {
    position: absolute;
    right: 14px;
    bottom: 28px;
    z-index: 30;
}

.card-favorite-overlay {
    display: flex;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain; /* or cover if lifestyle images */
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.15)); /* Shadow on the product itself */
    transition: transform 0.5s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05) rotate(2deg);
}

/* =========================================
   2. Body & Content
   ========================================= */
.card-content {
    flex: 1;
    background: #ffffff;
    /* Aligned widths: Remove side padding from content wrapper */
    padding: 14px 4px 0 4px;
    display: flex;
    flex-direction: column;
    z-index: 10;
    margin-top: 0;
    position: relative;
    overflow: visible; /* For buttons sticking out if needed */
}

/* Stock Status */
.stock-status-line {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}
.stock-status-line .text-warning { color: #D97706 !important; }
.stock-status-line .text-success { color: #10B981 !important; }
.stock-status-line .text-danger { color: #EF4444 !important; }

/* Category Tag – Overlay-Variante oben links im Bild-Header */
.category-tag--overlay {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 20;
    background: rgba(0, 0, 0, 0.55);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
    max-width: calc(100% - 72px); /* Platz für rechtes Badge */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Wenn Sale-Badge vorhanden: oben rechts, Brand-Tag bleibt oben links = kein Konflikt */

/* Category Tag (default, nicht mehr genutzt im Grid, bleibt für Liste) */
.category-tag-wrapper {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    justify-content: flex-start;
    min-width: 0;
}

.category-tag-wrapper .btn-favorite {
    margin-left: auto;
    flex: 0 0 auto;
    align-self: center;
}

.category-tag {
    display: inline-block;
    padding: 5px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #4B5563;
    text-transform: uppercase;
    background: #fff;
    letter-spacing: 0.5px;
}

/* Favorite Heart */
.btn-favorite {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.14);
    border: none;
    color: #FBBF24; /* Yellow heart */
    font-size: 1.25rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
    position: relative;
    z-index: 50; /* Ensure clickability */
}
.btn-favorite:hover {
    transform: scale(1.2);
    box-shadow: 0 14px 24px rgba(15, 23, 42, 0.18);
}

/* Title */
.product-title {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
    line-height: 1.3;
    /* Limit lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.6em; /* Ensure fixed height approx 2 lines */
}

.product-title, .product-title a {
    color: #000000 !important; /* Force Black Title */
}

.product-property-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 8px;
    min-width: 0;
}

.product-property-badges--header {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    align-items: center;
    overflow: hidden;
    margin: 0;
    gap: 8px;
}

.product-property-badges--header > * {
    position: relative;
    z-index: 20;
}

.product-property-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 7px;
    border-radius: 5px;
    margin-right: 2px;
    background: rgba(3, 105, 161, 0.1);
    color: #0f5d8a;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.05em;
    flex: 0 0 auto;
}

.product-property-badge--more {
    background: rgba(17, 24, 39, 0.08);
    color: #475569;
    cursor: pointer;
    border: none;
    transition: background 0.15s, color 0.15s;
    position: relative;
    z-index: 30;
}
.product-property-badge--more:hover {
    background: #feaf39;
    color: #fff;
}

/* Properties Popup */
.prop-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9998;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.26);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.prop-popup-overlay.is-open {
    display: flex;
}
.prop-popup {
    position: relative;
    background: #2b2e33;
    color: #fff;
    border-radius: 16px;
    padding: 18px 18px 16px;
    width: min(360px, calc(100vw - 40px));
    max-width: 100%;
    box-shadow: 0 18px 40px rgba(0,0,0,0.42);
    z-index: 9999;
    font-size: 0.82rem;
    outline: none;
}
.prop-popup__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}
.prop-popup__close:hover {
    background: #92400e;
    transform: scale(1.04);
}
.prop-popup__title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #ffe4b4;
    margin-bottom: 12px;
    padding-right: 36px;
}
.prop-popup__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.prop-popup__item {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: #ffe1a8;
    color: #4a2d00;
    font-weight: 700;
    font-size: 0.74rem;
    letter-spacing: 0.01em;
}

.product-variant-property-hint {
    display: inline-block;
    padding: 5px 12px;
    border: 1px solid rgba(20, 64, 28, 0.2);
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #14401c;
    background: #f0fdf4;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: none;
    margin: 0;
    min-width: 0;
    flex: 1 1 auto;
}

/* Rating */
.rating-stars {
    font-size: 0.8rem;
    margin-bottom: 10px;
}

/* =========================================
   3.5 Footer Area (Price & Qty)
   ========================================= */
.card-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.product-price-block {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.price-main-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.current-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--price-green, #16a34a); /* Einheitliches Preis-Grün via CSS-Variable */
    font-family: 'Inter', 'Segoe UI', sans-serif;
    letter-spacing: -0.5px;
}

.price-original {
    font-size: 0.85rem;
    color: #6B7280;
    text-decoration: line-through;
    font-weight: 500;
}

.original-price {
    font-size: 0.85rem;
    color: #6B7280;
    text-decoration: line-through;
    font-weight: 500;
}

.badge-sale-inline {
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    background: #EF4444;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    line-height: 1;
}

.price-vat-hint {
    font-size: 0.7rem;
    color: #000 !important;
    margin-top: 2px;
}

.product-base-price-hint {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: #0369a1 !important;
    font-weight: 600;
    margin-top: 2px;
}

.product-base-price-hint i {
    font-size: 0.65rem;
}

/* =========================================
    4. Card Action Buttons
   ========================================= */
.card-actions-bottom {
    margin-top: auto;
    padding: 0 4px 4px 4px;
    display: flex;
    gap: 10px;
}

/* ========================================================
   List View support (Products/Index toggles .list-view on .product-grid)
   ======================================================== */
.product-grid.list-view {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.product-grid.list-view .product-card {
    display: grid;
    grid-template-columns: 220px 1fr;
    align-items: stretch;
    padding: 12px;
    gap: 14px;
}

.product-grid.list-view .card-visual-header {
    height: 100%;
    min-height: 180px;
    border-radius: 14px;
    clip-path: none;
    padding-bottom: 12px;
}

.product-grid.list-view .card-content {
    padding: 12px 8px 0 8px;
}

.product-grid.list-view .card-actions-bottom {
    padding: 0 0 12px 0;
}

@media (max-width: 768px) {
    .product-grid.list-view .product-card {
        grid-template-columns: 1fr;
    }

    .product-grid.list-view .card-visual-header {
        min-height: 180px;
    }
}

.btn-add-to-cart-block {
    flex-grow: 1;
    background: #FBBF24; /* Yellow */
    color: #1F2937;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.85rem;
    padding: 12px;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(251, 191, 36, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
}

.btn-add-to-cart-block:hover {
    background: #F59E0B;
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(251, 191, 36, 0.4);
}

.btn-add-to-cart-block.disabled {
    background: #E5E7EB;
    color: #9CA3AF;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.product-card .product-image-link,
.product-card .product-title a,
.product-card .btn-add-to-cart-block,
.product-list-item .product-list-item__image-link,
.product-list-item .product-list-item__title a,
.product-list-item .product-list-item__cta,
.product-list-item .btn-add-to-cart-block,
.product-list-item .badge-sale-inline {
    position: relative;
    z-index: 5;
}

/* =========================================
   Badge Styles (Top Right Red Frame)
   ========================================= */
.badge-overlay {
    position: absolute;
    top: 12px;
    z-index: 20;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 5px 10px;
    border-radius: 8px;
    text-transform: uppercase;
    line-height: 1;
    max-width: calc(100% - 24px);
    white-space: nowrap;
}

.badge-sale {
    right: 12px;
    left: auto;
    top: 12px;
    background: linear-gradient(135deg, #feaf39 0%, #e5981f 100%);
    color: #1a1d23;
    border: none;
}

.badge-sold-out {
    top: 12px;
    right: 12px;
    left: auto;
    transform: none;
    background: #ef4444;
    color: white;
    padding: 6px 11px;
    border-radius: 8px;
    white-space: nowrap;
}

/* When both badges are visible, sold-out stacks below sale badge */
.badge-sale + .badge-sold-out {
    top: 46px;
    right: 12px;
    left: auto;
}

.badge-low-stock {
    left: 16px; /* Keep low stock on left or move? Left is fine */
    background: #FFFBEB;
    color: #D97706;
    border: 1px solid #FCD34D;
}

/* Qty Selector Style */
.product-card .qty-selector-mock {
    display: flex;
    align-items: center;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    overflow: hidden;
    height: 36px;
}

.product-card .qty-btn {
    flex-shrink: 0;
    width: 36px;
    height: 100%;
    border: none;
    background: #F9FAFB;
    color: #4B5563;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}
.product-card .qty-btn:hover { background: #E5E7EB; }

.product-card .qty-input {
    flex: 1;
    min-width: 32px;
    height: 100%;
    border: none;
    border-left: 1px solid #E5E7EB;
    border-right: 1px solid #E5E7EB;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
    background: white;
}


