/* ================== Grundlayout ================== */
.prospekte-archiv {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #eeeeee;
    margin: 0;
    padding: 20px;
}

.prospekte-archiv {
    min-height: 100%;
    height: auto;
    overflow-x: hidden;
    overscroll-behavior-y: auto;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

/* ================== Header Statistik ================== */
.prospekt-header {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 60px;
    padding: 20px 0;
}

.prospekt-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    gap: 4px;
}

.prospekt-number {
    font-size: 0.85em;
    font-weight: 600;
    color: #252222;
    line-height: 1.1;
}

.prospekt-label {
    font-size: 0.85em;
    color: #252222;
    margin-top: 3px;
}

/* ================== Header ================== */
.prospekte-archiv header {
    text-align: center;
    margin-bottom: 30px;
}

.prospekte-archiv header h1 {
    font-size: 2em;
    color: #ec8f02;
    margin-bottom: 6px;
}

/* ================== Filterbar ================== */
#filter-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 15px;
}

#filter-bar input {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #ccc;
    min-width: 200px;
    transition: all 0.2s;
}

#filter-bar input:focus {
    outline: none;
    border-color: #ec8f02;
    box-shadow: 0 0 6px rgba(236,143,2,0.3);
}

/* ================== Sprach-Dropdown ================== */

#filter-lang-wrapper {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

#filter-lang-btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    width: 180px;
    text-align: left;
}

#filter-bar {
    position: relative;
    z-index: 50;
}

#filter-lang-dropdown .lang-flag img {
    max-width: 18px;
    max-height: 12px;
}

#filter-lang-dropdown label {
    display: grid;
    grid-template-columns: 18px 1fr 18px;
    align-items: center;
    column-gap: 8px;
    padding: 6px 8px;
}

/* Checkbox exakt zentrieren */
#filter-lang-dropdown input[type="checkbox"] {
    margin: 0;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Flag bleibt rechts sauber zentriert */
#filter-lang-dropdown .lang-flag {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* ================== DROPDOWN ================== */

#filter-lang-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    width: max-content;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
    z-index: 99999;
    max-height: 260px;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    padding: 4px 0;
}

/* ================== Klassen & Baureihen ================== */
.klasse {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
    padding: 8px 20px 20px;
    margin-bottom: 10px;
    position: relative;
}

.klasse h2:not(.klasse-toggle) {
    font-weight: 600;
    font-size: 1.6em;
    color: #ec8f02;
    margin: 0 0 10px 0;
    display: inline-block;
    padding-bottom: 4px;
    position: relative;
}

.klasse h2:not(.klasse-toggle)::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: #ec8f02;
    border-radius: 1px;
}

/* ================== Baureihen ================== */
.baureihe h3 {
    font-weight: 500;
    font-size: 1.4em;
    color: #ec8f02;
    margin-bottom: 15px;
}

.baureihe h3 .book-count {
    font-size: 0.85em;
    font-weight: 300;
    color: #777;
    margin-left: 8px;
}

/* ================== Cover Grid ================== */
.covers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    align-items: start;
}

.thumb {
    cursor: pointer;
    display: block;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    background: transparent;
}

.thumb:hover .info-line,
.thumb:hover .title,
.thumb:hover .meta {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ================== Preview Bild ================== */
.img-container {
    position: relative;
    display: block;
}

.img-container img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
    vertical-align: top;
}

/* Overlay über Bild */
.info-line {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;

    background: linear-gradient(
        to top,
        rgba(236, 143, 2, 0.85) 0%,
        rgba(236, 143, 2, 0.5) 50%,
        rgba(236, 143, 2, 0) 100%
    );

    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    align-items: center; /* alles zentriert */
    justify-content: flex-end;
    height: auto;
}

/* Titel auf 2 Zeilen begrenzt */
.info-line .title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: center;
    font-weight: 500;
    font-size: 15px;
    white-space: normal;
    text-shadow:
        0 0 2px #fff,
        0 0 4px #fff,
        0 0 6px #fff,
        0 0 8px #fff;
    margin-bottom: 2px;
}

/* Meta-Zeile (Datum | Größe) */
.info-line .meta {
    font-size: 11px;
    font-weight: 500;
    color: #000;
    text-align: center;
    white-space: nowrap;
    text-shadow:
        0 0 2px #fff,
        0 0 4px #fff,
        0 0 6px #fff,
        0 0 8px #fff;
    position: relative;
}

/* Vertikaler Strich zwischen Datum und Größe */
.info-line .meta span + span::before {
    content: "|";
    margin: 0 6px;
    color: #000;
    text-shadow:
        0 0 2px #fff,
        0 0 4px #fff,
        0 0 6px #fff,
        0 0 8px #fff;
}

/* NEU-Badge */
.badge-new {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #ec8f02;
    color: #fff;
    font-size: 0.75em;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 10;
}

/* Sprach-Flags leicht schwebend */
.flags-overlay {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
    z-index: 10;
    align-items: center;
}

.flags-overlay img.flag-icon {
    width: 16px;
    height: auto;
    max-height: 12px;

    background: rgba(255,255,255,0.95);
    padding: 1px;
    border-radius: 4px;

    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    backdrop-filter: blur(2px);

    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* ================== Flipbook Lightbox ================== */
#flipbook-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 9999;
}

#flipbook-container {
    width: 80%;
    height: 80%;
    margin: 5% auto;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}


#flipbook {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
}

#flipbook canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain;
}

#flipbook-close {
    position: fixed;
    top: 20px;
    right: 25px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0,0,0,0.4);
    border: 2px solid #fff;
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999999 !important;
    pointer-events: auto !important;
    transition: all 0.2s ease;
}

#flipbook-close:hover {
    background: #fff;
    color: #000;
    transform: scale(1.05);
}

/* ---------- iOS Safari GPU SAFE MODE ---------- */
@supports (-webkit-touch-callout: none) and (not (hover: hover)) {
    #flipbook-lightbox,
    #flipbook-container {
        transform: none !important;
        -webkit-transform: none !important;
    }

    #flipbook canvas {
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        will-change: transform;
    }
}

/* ================== Mobile Fix Flipbook Fullscreen ================== */
@media (max-width: 768px) {

    /* Lightbox fullscreen */
    #flipbook-lightbox {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: rgba(0,0,0,0.85) !important;
        z-index: 9999 !important;
        overflow: hidden !important;
        display: none; /* bleibt unsichtbar bis Flipbook geöffnet wird */
    }

    #flipbook-container {
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    #flipbook {
        width: 100% !important;
        height: 100% !important;
    }

    #flipbook canvas {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain;
        transform: translate3d(0,0,0) !important;
        -webkit-transform: translate3d(0,0,0) !important;
    }

    #flipbook-close {
        top: 15px !important;
        right: 15px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 24px !important;
    }

    /* Seite nur sperren, wenn Flipbook geöffnet */
body.flipbook-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
}
    /* Alles andere darf normal scrollen */
    html, body {
        height: auto !important;
        overflow: auto !important;
    }
}

/* ================== Debug-Box für Mobile CSS ================== */
#mobile-debug {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: rgba(236,143,2,0.9);
    color: #fff;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 6px;
    z-index: 99999;
    font-family: monospace;
    pointer-events: none;
}

/* ================== Flag Init ================== */
.flags-overlay img.flag-icon {
    width: 18px;
    height: 12px;
    object-fit: cover;
    border-radius: 2px;
    display: block;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* ================== Changelog Button ================== */

/* OVERLAY BACKDROP */
#changelog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);

    display: flex;
    align-items: center;
    justify-content: center;

    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;

    z-index: 999999;
}

/* AKTIV */
#changelog-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* BOX */
.changelog-box {
    width: 500px;
    max-width: 90%;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);

    transform: translateY(20px);
    transition: transform 0.25s ease;
}

#changelog-overlay.open .changelog-box {
    transform: translateY(0);
}

/* HEADER */
.changelog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.thumb {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.changelog-header h2 {
    margin: 0;
    font-size: 18px;
}

#changelog-close {
    cursor: pointer;
    font-size: 18px;
}

/* CONTENT */
.changelog-content {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.changelog-content h3 {
    margin-top: 0;
    font-size: 15px;
}

.changelog-date {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
}

.changelog-content ul {
    margin: 0 0 20px 0;
    padding-left: 18px;
}

h3 .bauzeitraum {
    font-size: 0.85em;
    font-weight: 300;
    color: #777;
    margin-left: 8px;
}

/* ================== FINAL Accordion Fix ================== */

.klasse {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 0 5px 0 !important;
}

.klasse-toggle {
    background-color: #ec8f02 !important;
    color: #ffffff !important;
    font-size: 20px !important;
    padding: 6px 12px !important;
    cursor: pointer !important;
    border-radius: 5px !important;
    margin: 0 !important;
    position: relative !important;
    font-weight: normal !important;
    display: block !important;
}

.klasse-toggle:hover {
    color: #000000 !important;
}

.klasse-toggle .toggle-icon {
    display: none !important;
}

.klasse-toggle::after {
    content: '';
    position: absolute;
    right: 20px;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%) rotate(0deg);
    background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-size: contain;
    transition: transform 0.3s ease;
}

.klasse-toggle.active::after {
    transform: translateY(-50%) rotate(180deg);
}

.klasse-content {
    max-height: 0;
    overflow: hidden;
    background: #ffffff;
    border-radius: 0 0 5px 5px;
    padding: 0;
    margin: 0;
    transition: max-height 0.4s ease, padding 0.4s ease;
}

.klasse-content.open {
    padding: 10px;
    overflow: visible;
}

/* ================== Neueste Uploads Anpassung ================== */

.neueste-uploads {
    margin-bottom: 30px;
}

.neueste-uploads h2 {
    background-color: #ec8f02;
    color: #ffffff;
    font-size: 20px;
    padding: 6px 12px;
    border-radius: 5px;
    margin: 0 0 12px 0;
    font-weight: normal;
    box-sizing: border-box;
}

.neueste-uploads .covers {
    margin-bottom: 25px;
}

.neueste-uploads .covers {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.neueste-uploads .thumb {
    width: 150px;
    flex: 0 0 150px;
}

/* ================== Beliebteste Prospekte ================== */

.beliebteste-prospekte {
    margin-bottom: 30px;
}

.beliebteste-prospekte h2 {
    background-color: #ec8f02;
    color: #ffffff;
    font-size: 20px;
    padding: 6px 12px;
    border-radius: 5px;
    margin: 0 0 12px 0;
    font-weight: normal;
    box-sizing: border-box;
}

.beliebteste-prospekte .covers {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.beliebteste-prospekte .thumb {
    width: 150px;
    flex: 0 0 150px;
}

/* ================== Mobile Header Statistik ================== */
@media (max-width: 768px) {

    .prospekt-header {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 10px;
        width: 100%;
        box-sizing: border-box;
    }

    .prospekt-block {
        background: #ffffff;
        border-radius: 8px;
        padding: 10px 5px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }

    .prospekt-number {
        font-size: 1rem;
    }

    .prospekt-label {
        font-size: 0.75rem;
        text-align: center;
        line-height: 1.2;
    }
}

/* ================== Version als Statistikblock ================== */

.changelog-trigger {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.changelog-trigger:hover {
    transform: translateY(-2px);
}

/* ================== Mobile Statistik kompakt ================== */
@media (max-width: 768px) {

    .prospekt-header {
        display: grid !important;
        grid-template-columns: repeat(4, auto) !important;
        justify-content: center !important;
        align-items: start !important;
        gap: 18px !important;
        padding: 8px 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
            min-width: 0 !important;

    width: auto !important;

    max-width: none !important;
    }

    .prospekt-header .prospekt-block {
        min-width: 0 !important;
        width: auto !important;
        max-width: 72px !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        gap: 5px !important;
    }

    .prospekt-header .prospekt-number {
        font-size: 0.75em !important;
        line-height: 1.1 !important;
        white-space: nowrap !important;
    }

    .prospekt-header .prospekt-label {
        font-size: 0.62em !important;
        line-height: 1.1 !important;
        margin-top: 0 !important;
        text-align: center !important;
            white-space: nowrap !important;
    }
}

/* ================== Versionsblock klickbar hervorheben ================== */

#changelog-btn {
    cursor: pointer !important;
}

#changelog-btn .prospekt-number {
    color: #ec8f02 !important;
    text-decoration: underline;
    text-underline-offset: 3px;
}

#changelog-btn .prospekt-label::after {
    content: " ⓘ";
    color: #ec8f02;
    font-size: 0.9em;
}

#changelog-btn:hover .prospekt-number {
    color: #e03602 !important;
}

#changelog-btn:hover {
    transform: translateY(-2px);
}

/* ================== Mobile Carousel für Neueste & Beliebteste ================== */

.mobile-carousel-wrapper {
    position: relative;
}

.carousel-arrow {
    display: none;
}

@media (max-width: 768px) {

    .neueste-uploads .mobile-carousel,
    .beliebteste-prospekte .mobile-carousel {
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        gap: 12px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding: 0 42px 10px 42px !important;
        scrollbar-width: none;
    }

    .neueste-uploads .mobile-carousel::-webkit-scrollbar,
    .beliebteste-prospekte .mobile-carousel::-webkit-scrollbar {
        display: none;
    }

    .neueste-uploads .mobile-carousel .thumb,
    .beliebteste-prospekte .mobile-carousel .thumb {
        flex: 0 0 130px !important;
        width: 130px !important;
        min-width: 130px !important;
        scroll-snap-align: start;
    }

    .carousel-arrow {
        display: flex;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 32px;
        height: 32px;
        border: none;
        border-radius: 50%;
        background: rgba(37,34,34,0.9);
        color: #ffffff;
        font-size: 24px;
        line-height: 1;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 30;
        padding: 0;
    }

    .carousel-prev {
        left: 4px;
    }

    .carousel-next {
        right: 4px;
    }

    .carousel-arrow:active,
    .carousel-arrow:hover {
        background: #ec8f02;
    }

    .carousel-arrow.is-hidden {
        opacity: 0.25;
        pointer-events: none;
    }
}

/* ================== Baureihen-Badge in Top-Bereichen ================== */

.baureihe-overlay {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #ec8f02;
    color: #ffffff;
    font-size: 0.75em;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 11;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.alpha-banner{
    background:#fff;
    border:1px solid #ddd;
    border-left:6px solid #ec8f02;
    border-radius:18px;
    padding:30px;
    margin-bottom:30px;
    box-shadow:0 8px 30px rgba(0,0,0,.08);
}

.alpha-header{
    display:flex;
    align-items:center;
    gap:20px;
    margin-bottom:20px;
}

.alpha-logo{
    height:70px;
    width:auto;
}

.alpha-title-wrapper{
    display:flex;
    align-items:center;
    gap:15px;
    flex-wrap:wrap;
}

.alpha-title-wrapper h2{
    margin:0;
    color:#252222;
    font-size:2rem;
}

.alpha-badge{
    background:#ec8f02;
    color:#fff;
    padding:8px 16px;
    border-radius:999px;
    font-size:.75rem;
    font-weight:700;
    letter-spacing:.15em;
}

.alpha-intro{
    font-size:1.05rem;
    color:#252222;
    margin-bottom:20px;
}

.alpha-features{
    list-style:none;
    padding:0;
    margin:0 0 20px;
}

.alpha-features li{
    margin-bottom:10px;
    color:#444;
    font-size:.95rem;
}

.alpha-note{
    color:#666;
    line-height:1.7;
    margin:0;
}

@media(max-width:768px){

    .alpha-header{
        flex-direction:column;
        text-align:center;
    }

    .alpha-title-wrapper{
        justify-content:center;
    }

}

html.flipbook-open,
body.flipbook-open,
#flipbook-lightbox,
#flipbook-container {
    overflow: hidden !important;
    touch-action: none !important;
    overscroll-behavior: none !important;
}