/**
 * Mega Menu Widget Styles
 * Für Elementor Mega Menu Widget (Featured Cards + Dynamic Cards)
 * Verwendet globale CSS Variablen (DRY)
 *
 * @package SMGMall
 * @version 2.0.0
 */

/* ==========================================================================
   Module Imports
   ========================================================================== */

@import 'mega-menu/_mega-menu-overview-cards.css';

/* ==========================================================================
   Container & Layout
   ========================================================================== */

.smg-mega-menu-widget {
    width: 100%;
    height: 100%;
    min-height: 240px; /* Angepasst an neue Card-Höhe */
}

.mega-menu-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem; /* Konsistenter Abstand: 24px */
    width: 100%;
    height: auto;
    min-height: clamp(320px, 40vh, 420px);
    align-items: stretch;
}

/* ==========================================================================
   Elementor Editor Mode - Immer sichtbar!
   ========================================================================== */

/* Im Elementor Editor: Immer anzeigen */
.elementor-editor-active .smg-mega-menu-widget,
.elementor-editor-active .mega-menu-cards,
.elementor-editor-active .mega-menu-card {
    opacity: 1 !important;
    visibility: visible !important;
}

.elementor-editor-active .mega-menu-cards {
    display: grid !important;
}

/* Editor Mode: Widget Container */
.smg-mega-menu-widget.elementor-editor-mode {
    padding: 2rem;
    background: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: 8px;
}

.smg-mega-menu-widget.elementor-editor-mode::before {
    content: "Mega Menu Widget - Featured Cards";
    display: block;
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    background: #fff;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #666;
    text-align: center;
}

/* ==========================================================================
   Featured Cards - Kompakt & Clean (Bento Grid Style)
   ========================================================================== */

/* Single Card - Hochformat */
.mega-menu-card {
    display: block;
    position: relative;
    aspect-ratio: 3 / 4; /* Hochformat */
    height: auto;
    min-height: 280px;
    border-radius: clamp(12px, 2vw, 16px);
    overflow: hidden;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.06),
        0 1px 2px rgba(0, 0, 0, 0.02);
    background: linear-gradient(135deg,
        rgba(var(--smg-50-rgb, 254, 242, 242), 1) 0%,
        rgba(var(--smg-100-rgb, 254, 226, 226), 1) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.mega-menu-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.1) 0%,
        transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 2;
}

.mega-menu-card:hover {
    transform: translateY(-6px) rotateX(1deg);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.12),
        0 8px 20px rgba(227, 30, 36, 0.08);
    border-color: rgba(227, 30, 36, 0.2);
}

.mega-menu-card:hover::before {
    opacity: 1;
}

/* Card Image */
.mega-menu-card .card-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    position: relative;
    transition: transform 0.5s ease;
}

.mega-menu-card:hover .card-image {
    transform: scale(1.05);
}

/* Card Overlay - Kompakt */
.mega-menu-card .card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: clamp(16px, 3vw, 20px);
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.75) 0%,
        rgba(0, 0, 0, 0.2) 40%,
        transparent 100%
    );
    transition: all 0.3s ease;
    z-index: 3;
}

.mega-menu-card:hover .card-overlay {
    background: linear-gradient(
        to top,
        rgba(var(--smg-500-rgb, 227, 30, 36), 0.85) 0%,
        rgba(var(--smg-500-rgb, 227, 30, 36), 0.3) 40%,
        transparent 100%
    );
}

/* Card Title - Kompakt, Farbe abhängig von Bild */
.mega-menu-card .card-title {
    margin: 0;
    font-size: clamp(15px, 2.5vw, 17px);
    font-weight: 700;
    color: var(--smg-gray-900, #111827); /* ✅ Korrigiert: smg-gray-900 statt smg-900 */
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.3;
    transition: color 0.3s ease;
}

/* Weiße Schrift wenn Bild vorhanden (nicht Placeholder) */
.mega-menu-card:has(.card-image[style*="url"]:not([style*="placeholder"])) .card-title {
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

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

/* Tablet (769px - 1024px) */
@media screen and (max-width: 1024px) and (min-width: 769px) {
    .mega-menu-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem; /* 20px */
        min-height: clamp(280px, 35vh, 360px);
    }

    .mega-menu-card {
        min-height: 280px;
        max-height: 360px;
    }

    .mega-menu-card .card-title {
        font-size: 15px;
    }

    .mega-menu-card .card-overlay {
        padding: 16px;
    }
}

/* Mobile (max-width: 768px) */
@media screen and (max-width: 768px) {
    .mega-menu-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem; /* 16px */
        min-height: clamp(260px, 35vh, 320px);
    }

    .mega-menu-card {
        min-height: 260px;
        max-height: 320px;
    }

    .mega-menu-card .card-title {
        font-size: 14px;
    }

    .mega-menu-card .card-overlay {
        padding: 14px;
    }
}

/* Small Mobile (max-width: 480px) */
@media screen and (max-width: 480px) {
    .mega-menu-cards {
        grid-template-columns: 1fr;
        gap: 1rem; /* 16px - gleich wie Mobile */
        min-height: clamp(240px, 40vh, 280px);
    }

    .mega-menu-card {
        min-height: 240px;
        max-height: 280px;
    }

    .mega-menu-card .card-title {
        font-size: 13px;
    }

    .mega-menu-card .card-overlay {
        padding: 12px;
    }
}

/* Mobile Menu (bis 1024px) - Widget wird im Mobile Menu anders gerendert */
@media screen and (max-width: 1024px) {
    /* Desktop Widget verstecken */
    .mega-menu-dropdown .smg-mega-menu-widget {
        display: none;
    }

    /* Mobile-spezifische Styles in _nav-mega-menu-responsive.css */
}

