/**
 * CockpitOS Max Bonn Theme - Content Grid Category Grid Layout Styles (Bento Grid - Fix)
 * 
 * Verantwortlichkeit: Category Grid Style Layout (Fixes Bento Grid mit 9 Positionen)
 * 
 * @package CockpitOS_MEC_Light_Theme
 * @version 1.0.0
 */

/* ========================================
   Category Grid Layout (Bento Grid - Fix)
   ======================================== */

/* WICHTIG: Höhere Spezifität für Category Grid */
.elementor-widget-cockpit-os-mec-light-content-grid .cockpit-content-grid--category-grid,
.cockpit-content-grid--category-grid {
    display: grid !important;
    /* 4 Spalten × 4 Zeilen – Desktop (responsive siehe @media unten) */
    grid-template-columns: repeat(4, 1fr) !important;
    grid-template-rows: repeat(4, 1fr) !important;
    gap: 1.25rem !important;
    width: 100% !important;
    min-width: 0; /* Grid-Overflow in Flex-Containern vermeiden */
    /* height/max-height wird über Widget-Option gesteuert, auf Tablet/Mobile auf auto überschrieben */
}

/* ========================================
   Category Card (Base)
   ======================================== */

/* WICHTIG: Höhere Spezifität für Category Cards */
.elementor-widget-cockpit-os-mec-light-content-grid .cockpit-content-grid__category-card,
.cockpit-content-grid__category-card {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    padding: 1.5rem !important; /* 24px – wie im Screenshot */
    min-height: 200px !important;
    min-width: 0 !important; /* In Grid-Zellen kein Overflow */
    border-radius: 16px !important; /* Größerer Radius wie im Screenshot */
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    overflow: hidden !important;
    color: var(--color-white) !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    /* Grid-Positionierung wird durch nth-child Regeln gesetzt */
}

.elementor-widget-cockpit-os-mec-light-content-grid .cockpit-content-grid__category-card:hover,
.cockpit-content-grid__category-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: var(--shadow-lg) !important;
}

/* Empty Card */
.cockpit-content-grid__category-card--empty {
    background-color: var(--color-neutral-ultra-light, #f2f2f2);
    border: 2px dashed var(--color-neutral-light, #d9d9d9);
    cursor: default;
    pointer-events: none;
}

.cockpit-content-grid__category-card--empty:hover {
    transform: none;
    box-shadow: none;
}

.cockpit-content-grid__category-card-empty-text {
    color: var(--color-neutral-semi-light, #a6a6a6);
    font-size: var(--font-size-sm, 0.875rem);
    text-align: center;
    margin: 0;
}

/* ========================================
   Bento Grid Kartengrößen - 4 Spalten Layout
   ======================================== */

.cockpit-content-grid--category-grid .cockpit-content-grid__category-card {
    width: 100%;
    height: 100%;
}

/* Position 0: Alle Shops - item-0 */
.cockpit-content-grid__category-card:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
}

/* Position 1: dm Services - item-1 */
.cockpit-content-grid__category-card:nth-child(2) {
    grid-column: 2;
    grid-row: 1 / span 2; /* Zeile 1-2 */
}

/* Position 2: Rewe - item-2 */
.cockpit-content-grid__category-card:nth-child(3) {
    grid-column: 3;
    grid-row: 1 / span 2; /* Zeile 1-2 */
}

/* Position 3: Kosmetik - item-3 */
.cockpit-content-grid__category-card:nth-child(4) {
    grid-column: 2;
    grid-row: 3 / span 2; /* Zeile 3-4 */
}

/* Position 4: Kiosk - item-4 */
.cockpit-content-grid__category-card:nth-child(5) {
    grid-column: 3;
    grid-row: 3 / span 2; /* Zeile 3-4 */
}

/* Position 5: Cafés - item-5 */
.cockpit-content-grid__category-card:nth-child(6) {
    grid-column: 4;
    grid-row: 1;
}

/* Position 6: ANGEBOTE - item-6 */
.cockpit-content-grid__category-card:nth-child(7) {
    grid-column: 4;
    grid-row: 2 / span 3; /* Zeile 2-4 */
}

/* Position 7: GASTRONOMIE - item-7 */
.cockpit-content-grid__category-card:nth-child(8) {
    grid-column: 1;
    grid-row: 2 / span 3; /* Zeile 2-4 */
}

/* Overlay für Bilder */
.cockpit-content-grid__category-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.6));
    z-index: 1;
}

/* Plus Icon (Standard: oben rechts) */
.cockpit-content-grid__category-card-plus {
    position: absolute;
    top: 12px; /* Wie im Screenshot */
    right: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    /* Hintergrund und Farbe werden inline gesetzt (basierend auf Kartenfarbe) */
    font-size: 20px;
    font-weight: 600;
    line-height: 1;
    z-index: 2;
    transition: all 0.3s ease;
}

/* Plus Icon oben links (Position 0) */
.cockpit-content-grid__category-card--plus-left .cockpit-content-grid__category-card-plus {
    right: auto;
    left: 12px;
}

.cockpit-content-grid__category-card:hover .cockpit-content-grid__category-card-plus {
    transform: scale(1.1);
}

/* Card Content */
.cockpit-content-grid__category-card-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2, 0.5rem);
    flex: 1;
    text-align: left; /* Standard: linksbündig */
}

/* Zentrierte Karte (Position 0) */
.cockpit-content-grid__category-card--centered .cockpit-content-grid__category-card-content {
    text-align: center;
    align-items: center;
    justify-content: center;
}

/* Text unten (Position 7 - große Karte) */
.cockpit-content-grid__category-card--text-bottom .cockpit-content-grid__category-card-content {
    justify-content: flex-end;
    align-items: flex-start;
    margin-top: auto;
}

/* Category Card Title nutzt globale h5 Styles */
.cockpit-content-grid__category-card-title {
    /* Nutzt globale h5 Styles (font-family, font-size, font-weight, text-transform, letter-spacing) */
    color: inherit; /* Erbt Farbe vom Parent (wird dynamisch gesetzt) */
    margin: 0;
    line-height: var(--line-height-tight, 1.2);
    display: block;
    font-size: 1.125rem; /* 18px - wie im Screenshot */
    font-weight: 600;
    text-transform: none; /* Kein uppercase - wie im Screenshot */
    letter-spacing: -0.3px;
}

/* Größere Karten (1x2, 2x1) haben größeren Titel */
.cockpit-content-grid__category-card--1x2 .cockpit-content-grid__category-card-title,
.cockpit-content-grid__category-card--2x1 .cockpit-content-grid__category-card-title {
    font-size: 1.5rem; /* 24px */
    font-weight: 700;
    line-height: 1.2;
}

/* Größere Karte (2x2) hat noch größeren Titel */
.cockpit-content-grid__category-card--2x2 .cockpit-content-grid__category-card-title {
    font-size: 2rem; /* 32px */
    font-weight: 700;
    line-height: 1.1;
}

.cockpit-content-grid__category-card-subtitle {
    font-size: 0.875rem; /* 14px */
    color: inherit;
    margin: 0;
    margin-top: 0.25rem;
    opacity: 0.9;
    line-height: 1.4;
    display: block;
    font-weight: 400;
}

/* Größere Karten (1x2, 2x1) haben größeren Subtitel */
.cockpit-content-grid__category-card--1x2 .cockpit-content-grid__category-card-subtitle,
.cockpit-content-grid__category-card--2x1 .cockpit-content-grid__category-card-subtitle {
    font-size: 1rem; /* 16px */
}

/* Größere Karte (2x2) hat größeren Subtitel */
.cockpit-content-grid__category-card--2x2 .cockpit-content-grid__category-card-subtitle {
    font-size: 1.125rem; /* 18px */
}

/* CTA Button (weißer Kreis mit Pfeil) - Standard: unten links */
.cockpit-content-grid__category-card-cta {
    position: absolute;
    bottom: 24px; /* Wie im Screenshot */
    left: 24px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border-radius: 50%;
    z-index: 2;
    transition: all 0.3s ease;
}

/* CTA Button zentriert (Position 3) */
.cockpit-content-grid__category-card--cta-center .cockpit-content-grid__category-card-cta {
    left: 50%;
    transform: translateX(-50%);
}

.cockpit-content-grid__category-card:hover .cockpit-content-grid__category-card-cta {
    transform: scale(1.1);
}

/* CTA Button Hover - zentriert */
.cockpit-content-grid__category-card--cta-center:hover .cockpit-content-grid__category-card-cta {
    transform: translateX(-50%) scale(1.1);
}

.cockpit-content-grid__category-card-cta-icon {
    font-size: 20px;
    font-weight: 700;
    color: #000000; /* Schwarzer Pfeil - wie im Screenshot */
    line-height: 1;
}

/* ========================================
   Empty State
   ======================================== */

.cockpit-content-grid__category-grid-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--spacing-8, 3rem);
    color: var(--color-neutral-semi-dark);
}

/* ========================================
   Responsive – Category Grid
   ======================================== */

/* Tablet: 3 Spalten, alle Karten gleich groß (Bento-Positionen per nth-child aufheben) */
@media (max-width: 1024px) {
    .elementor-widget-cockpit-os-mec-light-content-grid .cockpit-content-grid--category-grid,
    .cockpit-content-grid--category-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        grid-template-rows: unset !important;
        grid-auto-rows: minmax(180px, 1fr);
        gap: var(--spacing-3, 1rem) !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
    }

    /* Alle Karten: gleiche Zellengröße, Reihenfolge bleibt 1–8 */
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(1),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(2),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(3),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(4),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(5),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(6),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(7),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(8) {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
        min-height: 180px !important;
    }

    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card {
        min-height: 180px !important;
        padding: var(--spacing-5, 1.25rem) !important;
    }
}

/* Mobile: 2 Spalten, alle Karten 1x1 */
@media (max-width: 768px) {
    .elementor-widget-cockpit-os-mec-light-content-grid .cockpit-content-grid--category-grid,
    .cockpit-content-grid--category-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        grid-template-rows: unset !important;
        grid-auto-rows: minmax(160px, 1fr);
        gap: var(--spacing-3, 1rem) !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
    }

    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(1),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(2),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(3),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(4),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(5),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(6),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(7),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(8) {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
        min-height: 160px !important;
    }

    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card {
        min-height: 160px !important;
        padding: var(--spacing-4, 1rem) !important;
    }

    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card-title {
        font-size: var(--font-size-base, 1rem) !important;
    }

    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card--1x2 .cockpit-content-grid__category-card-title,
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card--2x1 .cockpit-content-grid__category-card-title,
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card--medium .cockpit-content-grid__category-card-title,
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card--tall .cockpit-content-grid__category-card-title,
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card--extra-tall .cockpit-content-grid__category-card-title {
        font-size: var(--font-size-base, 1rem) !important;
    }
}

/* Small Mobile: 1 Spalte, volle Breite */
@media (max-width: 480px) {
    .elementor-widget-cockpit-os-mec-light-content-grid .cockpit-content-grid--category-grid,
    .cockpit-content-grid--category-grid {
        grid-template-columns: 1fr !important;
        grid-template-rows: unset !important;
        grid-auto-rows: minmax(150px, 1fr);
        gap: var(--spacing-3, 1rem) !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
    }

    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(1),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(2),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(3),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(4),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(5),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(6),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(7),
    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card:nth-child(8) {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
        min-height: 150px !important;
    }

    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card {
        min-height: 150px !important;
        padding: var(--spacing-4, 1rem) !important;
    }

    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card-plus {
        width: 28px !important;
        height: 28px !important;
        top: 10px !important;
        right: 10px !important;
        font-size: 1rem !important;
    }

    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card--plus-left .cockpit-content-grid__category-card-plus {
        left: 10px !important;
    }

    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card-cta {
        width: 44px !important;
        height: 44px !important;
        bottom: 16px !important;
        left: 16px !important;
    }

    .cockpit-content-grid--category-grid .cockpit-content-grid__category-card-cta-icon {
        font-size: 1.125rem !important;
    }
}
