/****** VARIABLES *********/
:root {
    --margin-bottom: 16px;
    --border-radius: 10px;
    --red: #D33;
}


/****** FRONTPAGE *********/

.wp-block-search {
    margin: auto;
    margin-bottom: var(--margin-bottom);
    max-width: 1000px;
    height: 68px;

    /* search input field on front-page */
    .wp-block-search__inside-wrapper input.wp-block-search__input {
        border-radius: var(--border-radius);
        border: 1px solid var(--red);
        color: var(--red);
        height: 59px;
        font-size: 24px;
    }
}

/* Heading Empfohlene Produkte */
.wp-block-woocommerce-product-collection h2.wp-block-heading {
    font-size: 32px;
    margin-top: 60px;
}






/* SEARCH */
.woocommerce-product-search.search-form {
    margin-bottom: var(--margin-bottom);
    height: 59px;
    font-size: 24px;
     border-radius: var(--border-radius);
    border: 1px solid var(--red);

    .search-field, .search-submit {
        border-radius: var(--border-radius);
        border: none;
        color: var(--red);
        svg{
            fill: var(--red);
            width: 32px;
        }
    }
}





/* Container-Grid für die Kategorien (5 Spalten) */
/* Alternative mit auto-fit für nahtloses Zentrieren */
.wc-block-product-categories-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(18%, 1fr)) !important; 
    justify-content: center !important;
    gap: 20px !important; /* Passe den Abstand zwischen den Kacheln hier nach Wunsch an */
}
/* Jedes Listenelement wird nun das quadratische Fundament */
.wc-block-product-categories-list-item {
    position: relative !important;
    width: 100% !important;
    aspect-ratio: 1 / 1 !important; /* Macht die Kachel quadratisch */
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
}

/* Der Link umschließt das Bild und füllt die gesamte Kachel aus */
.wc-block-product-categories-list-item > a {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Das Span, welches das Bild umschließt */
.wc-block-product-categories-list-item__image,
.wc-block-product-categories-list-item__image--placeholder {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

/* Das eigentliche Bild füllt die Kachel perfekt aus */
.wc-block-product-categories-list-item__image img,
.wc-block-product-categories-list-item__image--placeholder img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; /* Schneidet Bilder sauber quadratisch zu */
    display: block !important;
}

/* Der blaue Textbalken (wird absolut oben über die Kachel gelegt) */
.wc-block-product-categories-list-item__name {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    background-color: #5582b6 !important; /* Dein Verlags-Blau */
    color: #ffffff !important;
    text-align: center !important;
    z-index: 10 !important; /* Bringt den Text in den Vordergrund */
    pointer-events: none !important; /* Klicks gehen durch den Text hindurch zum Link */
    box-sizing: border-box !important;
    
    /* SCHRIFT-STYLES */
    font-size: 18px !important;       /* Größere Schrift */
    font-weight: 700 !important;      /* Macht die Schrift richtig fett (Bold) */
    letter-spacing: 1.5px !important; /* Abstand zwischen den Buchstaben */
    padding: 12px 5px !important;     /* Mehr Raum oben/unten */
    text-transform: uppercase !important;
    
    /* AUTOMATISCHER ZEILENUMBRUCH BEI ZU LANGEN WÖRTERN */
    word-break: break-word !important; /* Bricht zu lange Wörter radikal in die nächste Zeile */
    overflow-wrap: break-word !important; /* Zusätzliche Absicherung für moderne Browser */
    hyphens: auto !important;           /* Fügt bei der Trennung wenn möglich einen Bindestrich ein */
}

/* Spezifische WooCommerce-Core-Styles rigoros neutralisieren */
.wc-block-product-categories-list--has-images .wc-block-product-categories-list-item__image,
.wc-block-product-categories-list--has-images .wc-block-product-categories-list-item__image--placeholder {
    margin: 0 !important;
    max-width: 100% !important;
}

/* Titelbalken-Text vergrößern und fetter darstellen */
.wc-block-product-categories-list-item__name {
    font-size: 18px !important;       /* Größere Schrift (Standard war 14px) */
    font-weight: 700 !important;      /* Macht die Schrift richtig fett (Bold) */
    letter-spacing: 1.5px !important; /* Erhöht leicht den Abstand zwischen den Buchstaben für bessere Lesbarkeit */
    padding: 12px 5px !important;     /* Gibt dem blauen Balken durch etwas mehr Abstand oben/unten mehr Raum */
}

/* --- Responsive Anpassungen für kleinere Bildschirme --- */
@media (max-width: 1024px) {
    .wc-block-product-categories-list {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .wc-block-product-categories-list-item__name {
        font-size: 24px !important;     
    }
}

@media (max-width: 600px) {
    .wc-block-product-categories-list {
        grid-template-columns: repeat(1, 1fr) !important;
        gap: 10px !important;
    }
    .wc-block-product-categories-list-item__name {
        font-size: 24px !important;
        padding: 10px 2px !important;
    }
}