/* ===== UNIFIED PRODUCT CARD ===== */

/* --- Card Base (CSS Grid) --- */
.product-card-wrapper {
    width: 100%;
    height: 100%;
}

.product-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    height: 100%;
    transition: all var(--transition-base);
    border: 1px solid #e5e5e5;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: #d0d0d0;
}

/* --- Badges --- */
.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.badge-orange {
    background: #FF6B35;
    color: white;
}

.badge-green {
    background: var(--accent-green);
    color: white;
}

.badge-blue {
    background: #3b82f6;
    color: white;
}

.badge-discount {
    background: #16a34a;
    color: white;
    left: auto;
    right: 12px;
}

/* --- Card Link --- */
.card-link {
    display: contents;
    text-decoration: none;
    color: inherit;
}

/* --- Image --- */
.product-image {
    width: 100%;
    height: 160px;
    background: #f8f8f8;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    aspect-ratio: 1 / 1;
    transition: transform var(--transition-base);
}

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

/* --- Content (flex column inside grid row 2) --- */
.product-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
}

.product-manufacturer {
    font-size: 11px;
    color: #767676;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.2;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.4em;
}

.product-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    margin: 2px 0;
}

.product-quantity {
    color: #666;
    font-weight: 500;
}

.product-category {
    color: #666;
    padding: 2px 6px;
    background: #f0f0f0;
    border-radius: 4px;
    font-size: 10px;
    margin-left: auto;
}

/* --- Size Display --- */
.product-size {
    font-size: 11px;
    color: #666;
    background: #f8f8f8;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
    margin: 2px 0;
    border: 1px solid #e0e0e0;
    font-weight: 500;
}

.product-size.multiple-sizes {
    background: linear-gradient(135deg, #f8f8f8 0%, #e8e8e8 100%);
    color: #555;
    border-color: #d0d0d0;
}

.product-size.matched-size {
    color: var(--accent-green);
    font-weight: 600;
    background-color: var(--light-green);
    border-color: var(--accent-green);
}

/* --- Description --- */
.product-description {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Rating --- */
.product-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.stars {
    display: flex;
    gap: 1px;
}

.star {
    color: #FFB800;
    font-size: 16px;
}

.star.filled {
    color: #FFB800;
}

.star.half {
    position: relative;
    color: #e0e0e0;
}

.star.half::before {
    content: '\2605';
    position: absolute;
    left: 0;
    width: 50%;
    overflow: hidden;
    color: #FFB800;
}

.star.empty {
    color: #e0e0e0;
}

.review-count {
    font-size: 13px;
    color: #767676;
}

.review-count--none {
    font-style: italic;
    color: #aaa;
}

/* --- Variable Content (spacer between content and price) --- */
.product-variable-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* --- Price (grid row 3) --- */
.product-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    padding: 6px 12px;
}

.price-old {
    font-size: 13px;
    color: #767676;
    text-decoration: line-through;
    flex-basis: 100%;
}

.price-current {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    flex: 0 0 auto;
}

.price-per-unit {
    font-size: 11px;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
    margin-left: auto;
    flex: 0 0 auto;
}

.price-unavailable {
    color: #666;
    font-style: italic;
}

/* --- Button (grid row 4) --- */
.btn-add-to-cart {
    width: calc(100% - 16px);
    margin: 0 8px 8px;
    padding: 10px;
    background: transparent;
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.btn-add-to-cart:hover {
    background: var(--primary-green);
    border-color: var(--primary-green);
    color: white;
    transform: scale(1.02);
}

.btn-add-to-cart:active {
    transform: scale(0.98);
}

.btn-add-to-cart.added {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: white;
}

.btn-icon {
    width: 18px;
    height: 18px;
    transition: transform var(--transition-fast);
}

.btn-add-to-cart:hover .btn-icon {
    transform: translateX(2px);
}

/* --- Toast --- */
.auf-bestellung-toast {
    position: absolute;
    bottom: 52px;
    left: 8px;
    right: 8px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    z-index: 10;
    animation: toastFadeIn 0.2s ease-out, toastFadeOut 0.3s ease-in 3.7s forwards;
}

@keyframes toastFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ===== GRID: Fixed (Shop, PDP, Fragebogen, Recommendations) ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    align-items: stretch;
    align-content: start;
    max-width: 100%;
}

/* ===== GRID: Carousel (Main page) ===== */
.products-carousel {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 4px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.products-carousel::-webkit-scrollbar {
    display: none;
}

.products-carousel .product-card-wrapper {
    min-width: 240px;
    max-width: 280px;
    flex: 0 0 240px;
    scroll-snap-align: start;
}

.products-carousel .product-card {
    height: 100%;
}

/* ===== SKELETON LOADING ===== */
.product-card.skeleton {
    animation: skeleton-loading 1.5s linear infinite alternate;
    pointer-events: none;
}

.skeleton-image {
    width: 100%;
    height: 160px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-wave 1.5s infinite;
}

.skeleton-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.skeleton-variable-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-wave 1.5s infinite;
    border-radius: 4px;
}

.skeleton-manufacturer { width: 60px; }
.skeleton-title { height: 20px; width: 100%; }
.skeleton-meta { width: 120px; }
.skeleton-description { width: 100%; }
.skeleton-price { height: 24px; width: 80px; }

.skeleton-button {
    height: 44px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-wave 1.5s infinite;
    border-radius: var(--radius-md);
    margin: 0 8px 8px;
}

@keyframes skeleton-wave {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ===== STOCK BADGE ===== */
.product-card .stock-badge {
    font-size: 0.75rem;
    font-weight: 600;
    min-height: 1em;
    display: block;
}
.product-card .stock-badge:empty { display: none; }
.product-card .stock-badge--low { color: #b45309; }
.product-card .stock-badge--out { color: #dc2626; }
.product-card .stock-badge--order { color: #0369a1; }

/* ===== EMPTY MESSAGE ===== */
.empty-message {
    text-align: center;
    color: #666;
    padding: 40px;
    font-size: 14px;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    /* Grid */
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
    }

    /* Carousel */
    .products-carousel {
        gap: 16px;
    }

    .products-carousel .product-card-wrapper {
        min-width: 200px;
        flex: 0 0 200px;
    }

    /* Image */
    .product-image {
        height: 130px;
        padding: 10px;
    }
    .skeleton-image {
        height: 130px;
    }

    /* Content */
    .product-content {
        padding: 8px;
    }

    /* Rating stacked */
    .product-rating {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    /* Price: unit price on own line */
    .price-per-unit {
        width: 100%;
        font-size: 10px;
        margin-left: 0;
        margin-top: 2px;
    }

    /* Button */
    .btn-add-to-cart {
        margin: 0 6px 8px;
        padding: 8px;
        font-size: 13px;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    /* Grid */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        max-width: 100%;
        overflow: hidden;
    }

    /* Carousel */
    .products-carousel {
        gap: 10px;
    }

    .products-carousel .product-card-wrapper {
        min-width: 180px;
        flex: 0 0 180px;
    }

    /* Badge */
    .product-badge {
        top: 6px;
        left: 6px;
        padding: 2px 6px;
        font-size: 12px;
    }

    .badge-discount {
        top: 6px;
        right: 6px;
        left: auto;
        padding: 2px 6px;
        font-size: 12px;
    }

    /* Image */
    .product-image {
        height: 110px;
    }
    .skeleton-image {
        height: 110px;
    }

    /* Content */
    .product-content {
        padding: 8px 6px;
    }

    .product-manufacturer {
        font-size: 10px;
    }

    .product-name {
        font-size: 13px;
        min-height: 32px;
    }

    /* Price */
    .price-current {
        font-size: 14px;
    }

    .price-old {
        font-size: 11px;
    }

    .product-price {
        padding: 4px 8px;
    }

    /* Button */
    .btn-add-to-cart {
        margin: 0 6px 10px;
        min-height: 44px;
    }
}
