/* =============================
   Variablen
============================= */
:root {
    --tile-size: 220px; /* Default Desktop-Größe */
}

/* =============================
   Grid / Tiles (Code 1)
============================= */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--tile-size), 1fr));
    gap: 1.5rem;
    position: relative;
}
.tile-grid::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -18px;
    height: 16px;
    background:
        repeating-linear-gradient(
            90deg,
            rgba(255,255,255,0.04),
            rgba(255,255,255,0.04) 2px,
            rgba(0,0,0,0.04) 4px
        ),
        linear-gradient(#b98b5a, #9c6b3f);
    border-radius: 4px;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.25),
                0 6px 10px rgba(0,0,0,0.35);
    z-index: 0;
}

@media (max-width: 1023px) {
    .tile-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 1rem;
    }
}
@media (max-width: 767px) {
    .tile-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

/* -------------------------
   Tile Styles
------------------------- */
.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 12px;
    min-height: 180px;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f2f2f2;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 10px 12px rgba(0,0,0,0.25), 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    color: #fff;
    text-decoration: none;
}
.tile:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 24px rgba(0,0,0,0.35);
}
.tile::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 4px;
    background: rgba(0,0,0,0.25);
    z-index: 0;
}
.tile::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 8px;
    pointer-events: none;
    z-index: 2;
    box-shadow:
        inset 0 0 0 6px #8b5a2b,
        inset 0 0 0 8px #6e3f1c,
        inset 0 0 0 10px rgba(255,255,255,0.15),
        0 4px 10px rgba(0,0,0,0.35);
}

/* Tile Inhalte */
.tile-title {
    font-weight: 600;
    font-size: 1.2rem;
    line-height: 1.2;
    word-wrap: break-word;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    position: relative;
    z-index: 3;
}
.tile-year {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    background-color: rgba(0,0,0,0.6);
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 3;
}

/* Badges */
.tile-media-badge {
    position: absolute;
    bottom: 8px; /* jetzt unten */
    left: 8px;   /* links */
    z-index: 5;
    font-size: 1rem;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 2px 6px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    pointer-events: none;
}

.tile-home-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 3;
    font-size: 1rem;
    background: rgba(0,128,0,0.75);
    color: #fff;
    padding: 2px 6px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    pointer-events: none;
}
.tile-fav-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    z-index: 6;
    font-size: 1.5rem;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s, transform 0.2s;
}
.tile-fav-badge.active {
    background: gold;
    color: black;
}
.tile-fav-badge:hover {
    transform: scale(1.2);
}

/* Sections */
.tile-section-title {
    position: sticky;
    top: 5rem;
    background: #B5B5B5;
    padding: 0.4rem 0;
    margin: 1.5rem 0 0.5rem;
    z-index: 50;
}
.tile-section {
    border-bottom: 1px solid rgba(0,0,0,0.08);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}
.tile-section:last-child {
    border-bottom: none;
}

/* =============================
   Filter / Sort (beide identisch)
============================= */
.filter-bar,
.sort-controls {
    position: sticky;
    top: 1rem;
    z-index: 100;
    display: flex;
    flex-wrap: wrap;       /* Elemente umbrechen nur bei Bedarf */
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem 0.8rem;
    background: #f9f9f9;   /* hell, modern */
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    font-size: 0.9rem;
}

/* Inputs / Selects / Buttons – kompakt, nebeneinander */
.filter-bar input,
.sort-controls input,
.filter-bar select,
.sort-controls select,
.filter-bar button,
.sort-controls button {
    flex: 1 1 auto;        /* flexibel, wächst bei Platz */
    min-width: 120px;      /* zu klein nicht */
    max-width: 250px;      /* nicht zu groß */
    padding: 0.4rem 0.8rem;
    border-radius: 999px;  /* Pill-Style */
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-bar input:focus,
.filter-bar select:focus,
.sort-controls input:focus,
.sort-controls select:focus {
    outline: none;
    border-color: #0074D9;
    box-shadow: 0 0 8px rgba(0,116,217,0.2);
}

.filter-bar button,
.sort-controls button {
    min-width: 120px;
    font-weight: 500;
    background: #0074D9;
    color: #fff;
    border: none;
    box-shadow: 0 2px 6px rgba(0,116,217,0.2);
    transition: all 0.2s ease;
}

.filter-bar button:hover,
.sort-controls button:hover {
    background: #005bb5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,116,217,0.25);
}

.filter-bar button.active,
.sort-controls button.active {
    background: #005bb5;
    color: #fff;
    border-color: #004080;
}

.sort-controls select.filter-active,
.sort-controls input.filter-active,
.filter-bar select.filter-active,
.filter-bar input.filter-active,
.filter-bar button.filter-active,
.sort-controls button.filter-active {
    background: #ffe08a;
    border-color: #ffb800;
    color: #333;
    font-weight: 600;
}

@media (max-width: 700px) {
    .filter-bar,
    .sort-controls {
        position: sticky; /* bleibt oben */
        top: 0.5rem;
        display: flex;
        flex-wrap: wrap;  /* nur umbrechen, wenn nötig */
        gap: 0.4rem;
        align-items: center;
        padding: 0.5rem;
        border-radius: 8px;
        background: rgba(255,255,255,0.95);
        box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    }

    .filter-bar input,
    .sort-controls input,
    .filter-bar select,
    .sort-controls select,
    .filter-bar button,
    .sort-controls button {
        flex: 1 1 auto;      /* wachsen und schrumpfen je nach Platz */
        min-width: 100px;    /* Buttons nicht zu klein */
        max-width: 45%;      /* 2 pro Reihe, optional anpassen */
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
}





/* Aktiver Filter */
.filter-bar select.filter-active,
.filter-bar input.filter-active,
.filter-bar button.filter-active,
.sort-controls select.filter-active,
.sort-controls input.filter-active,
.sort-controls button.filter-active {
    border-color: #333;
    background: #ffe08a;
    color: #000;
    font-weight: 600;
}

/* Extra sichtbar auf Mobile */
@media (max-width: 768px) {
    .filter-bar select.filter-active,
    .filter-bar input.filter-active,
    .sort-controls select.filter-active,
    .sort-controls input.filter-active {
        box-shadow: 0 0 0 2px rgba(0,0,0,0.2);
    }
}

/* Filter-Zähler */
.filter-count {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #333;
    color: #fff;
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
    font-size: 0.85rem;
    white-space: nowrap;
}
.filter-count strong {
    font-weight: 700;
}

/* =============================
   Download Grid & Overlay (Code 2)
============================= */
.download-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}
@media (max-width: 600px) {
    .download-list {
        grid-template-columns: repeat(2, 1fr);
    }
}




/* -------------------------
   Download-Card wie Tile
------------------------- */
.download-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 12px;
    min-height: 180px;
    border-radius: 8px; /* wie Tile */
    overflow: hidden;
    background-color: #f2f2f2; /* neutral wie Tile */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 10px 12px rgba(0,0,0,0.25),
                0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    color: #fff;
    text-decoration: none;
}

/* Hover Effekt */
.download-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 24px rgba(0,0,0,0.35);
}

/* Tiefe mit Pseudo-Elementen */
.download-card::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 4px;
    background: rgba(0,0,0,0.25);
    z-index: 0;
}
.download-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 8px;
    pointer-events: none;
    z-index: 2;
    box-shadow:
        inset 0 0 0 6px #8b5a2b,
        inset 0 0 0 8px #6e3f1c,
        inset 0 0 0 10px rgba(255,255,255,0.15),
        0 4px 10px rgba(0,0,0,0.35);
}

/* Vorschau-Bilder */
.download-preview img,
.placeholder {
    width: 100%;

    object-fit: cover;
    border-radius: 6px;
    z-index: 1;
    aspect-ratio: 16/9; /* oder 4/3, je nach Wunsch */

    height: auto; /* alte feste Höhe entfernen */
}

/* Info Bereich */
.download-info {
    padding: 10px;
    z-index: 3; /* über Pseudo-Elementen */
}

.download-info h3 {
    font-weight: 600;
    font-size: 1.2rem;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    word-wrap: break-word;
}

/* Button anpassen */
.download-btn {
    display: inline-block;
    padding: 6px 10px;
    background: #0074D9;
    color: #fff;
    border: none;
    border-radius: 999px; /* wie Filter Buttons */
    cursor: pointer;
    margin: 5px 0;
    font-size: 0.9rem;
    transition: all 0.2s ease;
        position: relative; /* nötig für z-index */
    z-index: 4;         /* über dem ::after (z-index:2) */
}
.download-btn:hover {
    background: gray;
}

/* Länder / Flaggen Label */
.country-label {
    font-size: 0.95em;
    margin: 5px 0 0 0;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 3;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 2px 6px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    pointer-events: none;
}





/* Overlay */
#overlay-gallery {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    display: none;
    z-index: 10000;
    justify-content: center;
    padding: 20px;
}
#overlay-content {
    background: #fff;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#overlay-header {
    display: flex;
    flex-wrap: wrap;        /* Buttons umbrechen bei wenig Platz */
    gap: 10px;              /* Abstand zwischen Buttons */
    align-items: center;
    padding: 10px;
    background: #fff;
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Overlay Buttons */
#overlay-header button {
    flex: none;              /* Größe nach Inhalt */
    padding: 8px 14px;       /* größere Klickfläche */
    font-size: 0.95rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    background: #0074D9;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}


/* Mobile Anpassung */
@media (max-width: 600px) {
    #overlay-header {
        gap: 8px;
    }
    #overlay-header button {
        flex: 1 1 45%;       /* 2 Buttons pro Reihe */
        font-size: 0.9rem;
        padding: 6px 10px;
    }
}


#overlay-images-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px 26px 10px 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px,1fr));
    gap: 10px;
}
.overlay-item { position: relative; }
.overlay-item img {
    width: 100%;
    border-radius: 5px;
    cursor: pointer;
    border: 2px solid transparent;
}
.overlay-item img.selected {
    border: 5px solid #0074D9;
    box-shadow: 0 0 8px rgba(0,116,217,.6);
}
.overlay-item img.current-view {
    outline: 3px solid #0074D9;
    outline-offset: -3px;
    box-shadow: 0 0 12px rgba(0,116,217,0.7);
}
.overlay-item input {
    position: absolute;
    top: 5px;
    left: 5px;
    transform: scale(1.3);
    z-index: 2;
}
.private-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,.5);
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Lightbox */
#lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 20000;
    overflow: hidden;
}

#lightbox-img-container {
    position: relative;
    z-index: 1;
    display: flex;               /* Flex für Zentrierung */
    justify-content: center;     /* horizontal zentrieren */
    align-items: center;         /* vertikal zentrieren */
    width: 90vw;                 /* Breite abhängig vom Viewport */
    height: 80vh;                /* Höhe abhängig vom Viewport */
    overflow: hidden;            /* für Zoom */
    margin: 0 auto;
}

#lightbox-img {
    max-width: 100%;    /* passt in Container */
    max-height: 100%;   /* passt in Container */
    height: auto;       /* richtiges Verhältnis */
    width: auto;        /* richtiges Verhältnis */
    display: block;
    transform-origin: center center;
}





#lightbox-img-container.zoomed {
    cursor: grab; /* nur beim Zoom */
}

/* Buttons über dem Bild */
.lightbox-btn {
    position: absolute;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    background: rgba(0,0,0,.4);
    padding: 5px 10px;
    border-radius: 5px;
    z-index: 10; /* höher als Bild */
}

.close-btn { top: 10px; right: 10px; }
.prev-btn { left: 10px; top: 50%; transform: translateY(-50%); }
.next-btn { right: 10px; top: 50%; transform: translateY(-50%); }


.lightbox-btn.select-btn {
    top: 10px;
    left: 10px;
    z-index: 1001;
    font-size: 20px;
    background: rgba(0,128,0,0.6);
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
}
.lightbox-btn.select-btn:hover {
    background: rgba(0,128,0,0.8);
}




@media(max-width:768px) {
    .prev-btn, .next-btn, .close-btn {
        font-size: 20px;
        padding: 4px 8px;
    }
}

@media (max-width: 768px) {
    #lightbox-img-container {
        width: 95vw;
        height: 75vh;
    }
}


/* Result Count */
/* Ergebnisanzeige unter Filterleiste */
.result-count {
    font-size: 0.9rem;
    color: #555;
    margin: 0.5rem 0 1rem 0; /* Abstand oben und unten */
    font-weight: 600;
}


/* Active Filter */

/* Container */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
    position: relative; /* wichtig, wenn Overlay */
    z-index: 1000;      /* sicherstellen, dass es über anderen Elementen liegt */
}

/* Einzelne Badge */
.active-filters .badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 0.85rem;
    background: #eee;
    border-radius: 12px;
    cursor: pointer;
    user-select: none; /* verhindert zufälliges Markieren beim Klick */
}

/* Hover / Effekt für Badge */
.active-filters .badge:hover {
    background: #ddd;
}

/* Das kleine "x" etwas hervorheben */
.active-filters .badge span:last-child {
    font-weight: bold;
    color: #555;
}

/* Optional: "×" beim Hover rot */
.active-filters .badge:hover span:last-child {
    color: red;
}


