/**
 * Matenhun Product Slider CSS
 * Alle slider-spezifischen Styles konsolidiert
 * Mehrsprachigkeit: DE/EN/ID unterstützt
 * Version: 1.0.0
 */

/* ===== SLIDER VARIABLES ===== */
:root {
    /* Customizer Variables - werden von functions.php überschrieben */
    --slider-height: 500px;
    --products-per-slide: 3;
    --slider-speed: 4000ms;
    
    /* Design Variables */
    --border-radius: 18px;
    --primary-color: #2c5aa0;
    --secondary-color: #f39c12;
    --ocean-blue: #0ea5e9;
    --ocean-teal: #14b8a6;
    --ocean-dark: #0f172a;
}

/* ===== PRODUCT SLIDER CONTAINER ===== */
#matenhun-product-slider {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    opacity: 0; /* Initial hidden, wird von JS auf 1 gesetzt */
    transition: opacity 0.3s ease;
}

.slider-container {
    height: var(--slider-height);
    overflow: hidden;
    border-radius: var(--border-radius);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    background: #fff;
    width: 100%;
    position: relative;
}

#slider-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
    height: 100%;
}

.slide {
    height: var(--slider-height);
    width: 100%;
    flex-shrink: 0;
}

/* ===== PRODUCT GRID ===== */
.products-grid {
    height: 100%;
    display: grid;
    grid-template-columns: repeat(var(--products-per-slide), 1fr);
    gap: 2rem;
    padding: 2rem;
    align-items: stretch;
}

/* Mobile: Immer nur 1 Produkt pro Slide */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }
    
    :root {
        --products-per-slide: 1; /* Mobile Override */
    }
}

/* ===== PRODUCT CARDS ===== */
.product-card {
    height: calc(var(--slider-height) - 4rem);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.product-card-placeholder {
    background: transparent;
    box-shadow: none;
}

/* ===== PRODUCT BADGES ===== */
.product-new-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

/* Mehrsprachige Badge-Inhalte werden über PHP/JS gesetzt */
.product-new-badge[data-lang="de"]::after { content: "Neu"; }
.product-new-badge[data-lang="en"]::after { content: "New"; }
.product-new-badge[data-lang="id"]::after { content: "Baru"; }

/* ===== PRODUCT IMAGES ===== */
.product-image-container {
    height: 65%;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
    filter: brightness(1.1) contrast(1.1) saturate(1.2);
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

/* ===== WHATSAPP INTEGRATION ===== */
.whatsapp-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 5;
    padding: 1rem;
}

.product-card:hover .whatsapp-overlay {
    opacity: 1;
}

.whatsapp-buy-button {
    background: linear-gradient(135deg, var(--ocean-blue), var(--ocean-teal));
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.4);
    transition: all 0.3s ease;
    transform: translateY(10px);
}

.product-card:hover .whatsapp-buy-button {
    transform: translateY(0);
}

.whatsapp-buy-button:hover {
    background: linear-gradient(135deg, #0284c7, #0d9488);
    transform: translateY(-3px) scale(1.05);
    color: white;
    text-decoration: none;
}

/* Mobile: WhatsApp Button immer sichtbar */
@media (max-width: 768px) {
    .whatsapp-overlay {
        opacity: 1;
        position: relative;
        background: transparent;
        padding: 0.5rem 0;
        align-items: center;
        justify-content: center;
    }
    
    .whatsapp-buy-button {
        position: relative;
        transform: none;
        margin: 0 auto;
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* ===== PRODUCT INFO ===== */
.product-info {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.product-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
    font-family: var(--body-font);
    /* Mehrsprachige Unterstützung über data attributes */
}

.product-description {
    color: #64748b;
    font-size: 1.0rem !important;
    ont-weight: 400 !important;
    line-height: 1.2;
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    /* Mehrsprachige Unterstützung über data attributes */
}

.product-footer {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.whatsapp-quick-button {
    background: linear-gradient(135deg, var(--ocean-blue), var(--ocean-teal));
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.whatsapp-quick-button:hover {
    background: linear-gradient(135deg, #0284c7, #0d9488);
    transform: translateY(-2px);
    color: white;
    text-decoration: none;
}

/* ===== SLIDER NAVIGATION ===== */
.slider-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 100;
    color: var(--ocean-dark);
}

.slider-nav-btn:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.slider-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.slider-nav-btn.prev {
    left: -30px;
}

.slider-nav-btn.next {
    right: -30px;
}

.slider-nav-btn svg {
    width: 28px;
    height: 28px;
}

/* Mobile: Navigation Buttons anpassen */
@media (max-width: 768px) {
    .slider-nav-btn {
        width: 50px;
        height: 50px;
    }
    
    .slider-nav-btn.prev {
        left: -25px;
    }
    
    .slider-nav-btn.next {
        right: -25px;
    }
    
    .slider-nav-btn svg {
        width: 24px;
        height: 24px;
    }
}

/* ===== DOTS NAVIGATION ===== */
.slider-dots {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-top: 2rem;
}

.slider-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #cbd5e1;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.slider-dot.active {
    background: var(--primary-color);
    transform: scale(1.3);
}

.slider-dot:hover {
    background: var(--secondary-color);
}

.slider-dot:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== NO PRODUCTS MESSAGE ===== */
.no-products-message {
    text-align: center;
    padding: 4rem 2rem;
    color: #64748b;
    font-size: 1.1rem;
}

/* ===== LOADING STATE ===== */
.slider-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--slider-height);
    color: #64748b;
    font-size: 1.1rem;
}

.slider-loading::after {
    content: '';
    width: 24px;
    height: 24px;
    margin-left: 1rem;
    border: 2px solid #e2e8f0;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== RESPONSIVE ANPASSUNGEN ===== */
@media (max-width: 1024px) {
    .products-grid {
        gap: 1.5rem;
        padding: 1.5rem;
    }
    
    .slider-nav-btn.prev {
        left: -25px;
    }
    
    .slider-nav-btn.next {
        right: -25px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        padding: 1rem;
        gap: 1rem;
    }
    
    .product-info {
        padding: 1rem;
    }
    
    .product-footer {
        padding: 0 1rem 1rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .slider-dots {
        gap: 0.6rem;
        margin-top: 1.5rem;
    }
    
    .slider-dot {
        width: 12px;
        height: 12px;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    .slider-nav-btn,
    .slider-dot,
    .product-card,
    .whatsapp-buy-button,
    .whatsapp-quick-button {
        transition: none;
    }
    
    #slider-track {
        transition: none;
    }
    
    .product-image {
        transition: none;
    }
}

/* Screen Reader Only Content */
.screen-reader-text {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

@media (max-width: 768px) {
    .products-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.6rem !important;
        padding: 0.5rem !important;
        width: 100% !important;
        min-height: unset !important;
    }

    .product-card {
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 auto 0.9rem auto !important;
        min-height: 140px !important;
        height: auto !important;
        max-height: unset !important;
    }

    .product-image-container {
        height: 145px !important;
        min-height: 100px !important;
        max-height: 35vw !important;
    }

    .product-image {
        height: 100% !important;
        max-height: 145px !important;
        object-fit: cover !important;
    }

    .product-info {
        padding: 0.5rem !important;
        font-size: 0.97rem !important;
    }
    
    @media (max-width: 768px) {
    .slider-nav-btn {
        width: 36px !important;
        height: 36px !important;
        top: 50% !important;
        left: 2px !important;
        right: 2px !important;
        z-index: 1000 !important;
        opacity: 1 !important;
        background: rgba(255,255,255,0.95) !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.07) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    .slider-nav-btn.prev {
        left: 4px !important;
        right: auto !important;
    }
    .slider-nav-btn.next {
        right: 4px !important;
        left: auto !important;
    }
    .slider-nav-btn svg {
        width: 18px !important;
        height: 18px !important;
    }
    
}

/* ===== FUNKTIONIERENDER SLIDER MOBILE-FIX ===== */

/* ENTFERNEN Sie den Grid-zu-Flex Fix und verwenden Sie stattdessen: */

@media (max-width: 768px) {
    /* Slider: 1 Produkt pro Slide auf Mobile */
    .products-grid {
        grid-template-columns: 1fr !important; /* Nur 1 Spalte */
        gap: 1.5rem !important;
        padding: 1.5rem !important;
    }
    
    /* Product Cards: Volle Breite, kompakte Höhe */
    .product-card {
        width: 100% !important;
        height: auto !important;
        min-height: 300px !important; /* Feste Mindesthöhe */
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Bilder: Feste Höhe */
    .product-image-container {
        height: 180px !important; /* Feste Höhe für Bilder */
        flex-shrink: 0 !important;
    }
    
    .product-image {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
    
    /* Info-Bereich: Flex-grow */
    .product-info {
        flex: 1 !important;
        padding: 1rem !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
    }
    
    .product-title {
        font-size: 1.1rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .product-description {
        font-size: 0.9rem !important;
        flex: 1 !important;
    }
    
    /* Slider Container: Flexible Höhe */
    .slider-container {
        height: auto !important;
        min-height: 350px !important;
    }
    
    .slide {
        height: auto !important;
        min-height: 350px !important;
    }
    
    /* Navigation: Größere Buttons */
    .slider-nav-btn {
        width: 50px !important;
        height: 50px !important;
        background: rgba(255,255,255,0.95) !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
    }
    
    .slider-nav-btn.prev {
        left: 15px !important;
    }
    
    .slider-nav-btn.next {
        right: 15px !important;
    }
    
    /* WhatsApp Overlay: Immer sichtbar auf Mobile */
    .whatsapp-overlay {
        opacity: 1 !important;
        position: relative !important;
        background: transparent !important;
        padding: 0 !important;
        align-items: center !important;
    }
    
    .whatsapp-buy-button {
        transform: none !important;
        margin: 0.5rem 0 !important;
    }
}

/* Sehr kleine Bildschirme */
@media (max-width: 480px) {
    .products-grid {
        padding: 1rem !important;
    }
    
    .product-card {
        min-height: 280px !important;
    }
    
    .product-image-container {
        height: 160px !important;
    }
    
    .slider-container {
        min-height: 320px !important;
    }
    
    .slide {
        min-height: 320px !important;
    }
}

/* ===== SLIDER MOBILE FIXES - AN SLIDER.CSS ANHÄNGEN ===== */

@media (max-width: 768px) {
    /* Slider: 1 Produkt pro Slide auf Mobile */
    .products-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
        padding: 1.5rem !important;
    }
    
    /* Product Cards: Kompakte, funktionelle Struktur */
    .product-card {
        width: 100% !important;
        height: auto !important;
        min-height: 300px !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Bilder: Feste Höhe für Konsistenz */
    .product-image-container {
        height: 180px !important;
        flex-shrink: 0 !important;
    }
    
    .product-image {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
    
    /* Info-Bereich: Flexibles Layout */
    .product-info {
        flex: 1 !important;
        padding: 1rem !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
    }
    
    .product-title {
        font-size: 1.1rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .product-description {
        font-size: 0.9rem !important;
        flex: 1 !important;
    }
    
    /* Slider Container: Anpassbare Höhe */
    .slider-container {
        height: auto !important;
        min-height: 350px !important;
    }
    
    .slide {
        height: auto !important;
        min-height: 350px !important;
    }
    
    /* Navigation: Touch-optimiert */
    .slider-nav-btn {
        width: 50px !important;
        height: 50px !important;
        background: rgba(255,255,255,0.95) !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
    }
    
    .slider-nav-btn.prev {
        left: 15px !important;
    }
    
    .slider-nav-btn.next {
        right: 15px !important;
    }
    
    /* WhatsApp: Immer sichtbar auf Mobile */
    .whatsapp-overlay {
        opacity: 1 !important;
        position: relative !important;
        background: transparent !important;
        padding: 0 !important;
        align-items: center !important;
    }
    
    .whatsapp-buy-button {
        transform: none !important;
        margin: 0.5rem 0 !important;
    }
}

/* Sehr kleine Bildschirme */
@media (max-width: 480px) {
    .products-grid {
        padding: 1rem !important;
    }
    
    .product-card {
        min-height: 280px !important;
    }
    
    .product-image-container {
        height: 160px !important;
    }
    
    .slider-container {
        min-height: 320px !important;
    }
    
    .slide {
        min-height: 320px !important;
    }
}