html, body {
    height: 100%;
}

/* Use CSS Grid so header and footer remain visible while main content scrolls */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #e8f5e9;
    color: #2c2c54;
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1b5e20;
    color: #fff;
    padding: 22px 28px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    position: relative;
}

header h1 {
    margin: 0;
    display: inline-block;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 22px;
    font-weight: 800;
    pointer-events: none;
}

/* Ensure header title text is visible against the dark header background */
header h1 {
    color: #ffffff;
}

/* Ensure back button and title are vertically centered together */
header > div:first-child {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Ensure footer sticks to bottom when page content is short */
/* main content area becomes the scroll container */
#main-content { overflow: auto; position: relative; }

footer {
    /* stays in its own grid row at the bottom */
}

header button {
    background: #4527a0;
    color: #fff;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 6px;
    font-weight: bold;
    transition: all 0.3s ease;
    font-size: 15px;
    min-width: 68px;
    text-align: center;
}

header button:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

header #back-button {
    background: #ffffff;
    color: #1b5e20;
    border: 1px solid rgba(27,94,32,0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    margin-right: 12px;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    font-weight: 700;
    gap: 10px;
    transition: background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

header #back-button:hover {
    background: #f6fff6;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
}

header #back-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

header #back-button svg {
    display: inline-block;
    width: 16px;
    height: 16px;
}

header #back-button .back-label {
    display: inline-block;
    font-weight: 600;
    color: inherit;
}

header #language-switcher {
    display: flex;
    gap: 8px;
    align-items: center;
}

header #language-switcher button {
    margin: 0;
    padding: 8px 12px;
    background: transparent;
    color: rgba(255,255,255,0.95);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
    transition: background-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease, color 0.12s ease;
}

header #language-switcher button:hover {
    background: rgba(255,255,255,0.06);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.06);
}

header #language-switcher button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(27,94,32,0.10);
}

/* Active language */
header #language-switcher button.active,
header #language-switcher button[aria-pressed="true"] {
    background: #ffffff;
    color: #1b5e20;
    border-color: rgba(27,94,32,0.08);
    box-shadow: 0 6px 16px rgba(27,94,32,0.06);
}

#about {
    display: flex;
    gap: 36px;
    padding: 54px 28px;
    align-items: center;
}

#about img {
    width: 380px;
    height: auto;
    border-radius: 14px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.18);
}

#about-text {
    flex: 1;
    font-size: 20px;
    line-height: 1.5;
}

/* Generic container used by standalone pages like impressum */
.container {
    max-width: 1000px;
    margin: 24px auto;
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

.lang-section {
    margin-bottom: 20px;
}

h1, h2, h3, h4 {
    color: #1b5e20;
}

#categories {
    padding: 0 20px 40px;
}

.category-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.10);
    transition: transform 0.22s, box-shadow 0.22s;
    cursor: pointer;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.category-card.coming-soon {
    opacity: 0.72;
    filter: grayscale(0.02);
}

.coming-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 8px;
    background: linear-gradient(90deg, rgba(27,94,32,0.08), rgba(27,94,32,0.04));
    color: #1b5e20;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

#categories-list > .product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.category-grid, .product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
    margin: 24px 0;
    padding: 12px 0;
}

.slideshow-container {
    position: relative;
    margin-top: 15px;
}

.img-wrap {
    position: relative;
}

.img-spinner {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.6);
    border-top-color: rgba(27,94,32,0.9);
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    animation: spin 0.9s linear infinite;
    z-index: 6;
    /* keep in layout but hidden so animation is stable across show/hide */
    display: block;
    visibility: hidden;
    opacity: 0;
    transition: opacity 160ms ease, visibility 160ms ease;
    animation-play-state: paused;
}
    .category-spinner {
        position: fixed;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        pointer-events: none;
        z-index: 9999;
        visibility: hidden;
        opacity: 0;
        transition: opacity 180ms ease, visibility 180ms ease;
    }
    .category-spinner.visible {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }
    .category-spinner .spinner {
        width: 64px;
        height: 64px;
        border-radius: 50%;
        border: 5px solid rgba(255,255,255,0.7);
        border-top-color: rgba(27,94,32,0.95);
        box-shadow: 0 4px 12px rgba(0,0,0,0.12);
        animation: spin 0.9s linear infinite;
    }

.img-spinner.visible {
    visibility: visible;
    opacity: 1;
    /* rotate animation applied when visible; preserves translate so spinner stays centered */
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to   { transform: translate(-50%, -50%) rotate(360deg); }
}

.slideshow-container .prev,
.slideshow-container .next {
    position: absolute;
    z-index: 6;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    font-size: 18px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    opacity: 0.9;
}

.slideshow-container .prev { left: 10px; }
.slideshow-container .next { right: 10px; }

.slideshow-container .prev:hover,
.slideshow-container .next:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.08);
    opacity: 1;
}

.product-img {
    width: 100%;
    height: 360px;
    object-fit: cover;
    border-radius: 12px;
    transition: transform 0.3s, opacity 240ms ease, filter 220ms ease;
    opacity: 1;
}

.product-img:hover {
    transform: scale(1.05);
}

footer {
    padding: 18px 22px;
    background: linear-gradient(180deg, #174918, #1b5e20);
    color: #fff;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-text {
    font-size: 14px;
    opacity: 0.95;
}

.footer-links a {
    color: #fff;
    text-decoration: none;
    margin: 0 6px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    transition: background 0.18s ease, transform 0.12s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.footer-links a:hover {
    background: rgba(255,255,255,0.08);
    transform: translateY(-2px);
}

.footer-links a svg { width: 16px; height: 16px; fill: currentColor; }

.product-grid .category-card {
    cursor: default;
}

@media (orientation: portrait) {

    .category-grid, .product-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .category-card {
        padding: 25px;
    }

    footer {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 18px;
        padding: 28px 16px 18px 16px;
        text-align: left;
    }
    .footer-left {
        margin-bottom: 0;
        display: flex;
        align-items: center;
        height: 100%;
    }
    .footer-right {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: flex-end;
        align-items: center;
        height: 100%;
    }
    .footer-links {
        display: flex;
        flex-direction: row;
        gap: 10px;
        width: auto;
        flex-wrap: wrap;
        justify-content: flex-end;
        align-items: center;
    }
    .footer-links a {
        padding: 12px 14px;
        font-size: 16px;
        margin: 0 0 0 0;
        text-align: center;
        justify-content: center;
        min-width: 90px;
        flex: 0 1 auto;
    }
    .footer-text { font-size: 16px; }

    body {
        font-size: 20px;
        line-height: 1.5;
    }
    header {
        padding: 26px 20px;
    }
    header h1 {
        font-size: 28px;
    }
    header button {
        padding: 14px 20px;
        font-size: 20px;
        min-width: 94px;
    }
    header #back-button {
        padding: 12px 18px;
        margin-right: 10px;
    }
    header #language-switcher button {
        padding: 12px 16px;
        font-size: 20px;
    }
    .product-img {
        height: 280px;
    }
    .slideshow-container .prev,
    .slideshow-container .next {
        width: 52px;
        height: 52px;
        font-size: 24px;
    }
    .category-card h3 { font-size: 22px; }
    .category-card h4 { font-size: 20px; }
    #about-text { font-size: 22px; }
}
