/**
 * EscapeReadz Bookshelf - Frontend Styles
 * Background: Black (#000000) | Accent/Glow: #DA3258
 */

.bookshelf-carousel-wrapper,
.personal-bookshelf-wrapper,
.series-archive-wrapper {
    background-color: #000000;
    color: #ffffff;
    padding: 30px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* ==========================================================================
   RASTER-STEUERUNG (Trennt normales Regal vom Swipe-Karussell)
   ========================================================================== */

/* 1. Das normale Bücherregal, Serien-Archiv und Custom Grid erhalten echtes CSS-Grid */
.personal-bookshelf-wrapper .bookshelf-grid,
.series-archive-wrapper .bookshelf-grid,
.custom-bookshelf-grid {
    display: grid !important;
    gap: 24px;
    padding: 15px;
    width: 100%;
    box-sizing: border-box;
    grid-auto-rows: 1fr !important; /* Alle Karten einer Reihe orientieren sich am höchsten Element */
}

/* 2. Das Karussell-Grid DARF KEIN CSS-Grid erzwungen bekommen (wichtig für die JS-Logik!) */
.bookshelf-carousel-wrapper .bookshelf-grid {
    display: flex !important;
    gap: 24px;
    padding: 15px;
    width: 100%;
    box-sizing: border-box;
}

/* Spalten-Steuerung NUR für die statischen Grid-Regale */
@media (min-width: 1025px) {
    .personal-bookshelf-wrapper .bookshelf-grid,
    .series-archive-wrapper .bookshelf-grid,
    .custom-bookshelf-grid {
        grid-template-columns: repeat(6, 1fr) !important;
    }
}

@media (max-width: 1024px) and (min-width: 768px) {
    .personal-bookshelf-wrapper .bookshelf-grid,
    .series-archive-wrapper .bookshelf-grid,
    .custom-bookshelf-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

@media (max-width: 767px) {
    .personal-bookshelf-wrapper .bookshelf-grid,
    .series-archive-wrapper .bookshelf-grid,
    .custom-bookshelf-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px;
    }
}

/* ==========================================================================
   BUCHKARTE & ELEMENTE
   ========================================================================== */

/* Die Button-Leiste – jetzt als Spalte untereinander */
.book-card-actions {
    display: flex;
    flex-direction: column; /* Stapelt die Buttons untereinander */
    gap: 6px;               /* Abstand zwischen den beiden Buttons */
    width: 100%;
    margin-top: 10px;       /* Abstand nach oben zum Buchtitel */
    padding: 0 8px;         /* Kleiner Seitenabstand zum Kartenrand */
    box-sizing: border-box;
}

/* Die Buttons von Beginn an im Pinkton */
.book-btn {
    width: 100%;
    padding: 7px 4px;
    font-size: 12px;
    font-weight: bold;
    font-family: inherit;
    text-align: center;
    cursor: pointer;
    border-radius: 6px;
    border: none;
    background-color: #da3258; /* Dein Pinkton */
    color: #fff;               /* Weiße Schrift */
    transition: opacity 0.2s ease;
}

/* Hover-Effekt: Reduziert die Deckkraft leicht */
.book-btn:hover {
    opacity: 0.8;
}

/*===================================================*/

.bookshelf-grid .book-card,
.custom-bookshelf-grid .book-card {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important; /* Ausrichtung von oben nach unten */
    height: 100% !important;
    align-items: center;
    text-align: center;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

/* Die dezente Vergrößerung der gesamten Karte inkl. Rahmen */
.bookshelf-grid .book-card:hover,
.custom-bookshelf-grid .book-card:hover {
    transform: scale(1.03) !important;
    z-index: 99 !important;
}

.bookshelf-grid .book-card .cover-container,
.custom-bookshelf-grid .book-card .cover-container {
    position: relative;
    width: 100%;
    aspect-ratio: 5 / 8; 
    border-radius: 8px;
    transition: box-shadow 0.3s ease !important;
    overflow: hidden;
    background-color: #111111;
}

.bookshelf-grid .book-card .book-cover,
.custom-bookshelf-grid .book-card .book-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    padding-bottom: 0;
}

.bookshelf-grid .book-card .book-title,
.custom-bookshelf-grid .book-card .book-title {
    margin: 12px 0 6px 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #ffffff;
    min-width: 100%;
    
    /* Erlaubt Zeilenumbrüche für die 20 PHP-Zeichen */
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    
    /* Reserviert immer die Höhe für 2 Zeilen (fängt einzeilige Titel ab) */
    min-height: 2.8em; 
}

/* 🧲 DER MAGNET: Schiebt Links und Buttons bündig an die Unterkante */
.series-link,
.restart-reading-btn {
    margin-top: auto !important;
}

/* ==========================================================================
   BUTTONS & ACTIONS
   ========================================================================== */

.bookshelf-grid .book-card .book-action-btn,
.custom-bookshelf-grid .book-card .book-action-btn {
    position: absolute !important;
    top: -8px !important;    
    right: -8px !important;  
    left: auto !important;   
    z-index: 110 !important; 
    width: 34px;
    height: 34px;
    background: #DA3258 !important; 
    color: #ffffff !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0; 
    transform: scale(0.8);
    transition: opacity 0.25s ease, transform 0.2s ease, background 0.2s ease !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.bookshelf-grid .book-card:hover .book-action-btn,
.custom-bookshelf-grid .book-card:hover .book-action-btn {
    opacity: 1 !important;
    transform: scale(1) !important;
}

.bookshelf-grid .book-card .book-action-btn:hover,
.custom-bookshelf-grid .book-card .book-action-btn:hover {
    background: #ffffff !important;
    color: #DA3258 !important;
    transform: scale(1.1) !important;
}

.bookshelf-grid .book-card .heart-btn.is-active,
.custom-bookshelf-grid .book-card .heart-btn.is-active {
    background: #ffffff !important;
    color: #DA3258 !important;
    opacity: 1 !important;
    transform: scale(1) !important;
}

.series-link {
    font-size: 11px;
    color: #aaaaaa;
    text-decoration: none;
    margin-top: auto; /* Schiebt es nach unten */
    transition: color 0.2s ease;
}
.series-link:hover {
    color: #DA3258;
    text-decoration: underline;
}

.book-card.is-finished .book-cover {
    filter: opacity(0.7);
    transition: filter 0.3s ease;
}
.book-card.is-finished:hover .book-cover {
    filter: opacity(1);
}

.restart-reading-btn {
    background: #DA3258;
    color: #ffffff;
    border: none;
    padding: 6px 14px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    margin-top: auto; /* Schiebt es nach unten */
    transition: background 0.2s ease, transform 0.1s ease;
}
.restart-reading-btn:hover {
    background: #b82545;
    transform: translateY(-1px);
}

.carousel-footer {
    text-align: right;
    padding: 10px 15px 0 15px;
}
.view-all-link {
	padding: 10px 20px 10px 100px;
	border-top-right-radius:50px;
	border-bottom-right-radius:50px;
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: color 0.2s ease;
	/* Permalink - use to edit and share this gradient. Permalink - Zum Bearbeiten und Teilen dieses Verlaufs verwenden: https://colorzilla.com/gradient-editor/#000000+0,da3258+80,da3258+100&0+0,1+80,1+100 */
background: linear-gradient(to right,  rgba(0,0,0,0) 0%,rgba(218,50,88,1) 80%,rgba(218,50,88,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */

}
.view-all-link:hover {
    color: #ffffff;
    text-decoration: underline;
}

.series-part-badge {
    display: inline-block;
    background: rgba(218, 50, 88, 0.15);
    color: #DA3258;
    border: 1px solid rgba(218, 50, 88, 0.3);
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 12px;
    margin-top: 4px;
}

.empty-shelf-message {
    text-align: center !important;
    font-size: 25px !important;
    color: #bababa !important;
    padding: 60px 20px !important;
    width: 100% !important;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* ==========================================================================
   HERZ-BUTTON NUR IN DER BEITRAGSANSICHT (SINGLE) AUSBLENDEN
   ========================================================================== */

.single .book-action-btn,
.single .heart-btn,
.single-post .book-action-btn,
.single-post .heart-btn {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.single .book-card:hover .book-action-btn {
    display: none !important;
    opacity: 0 !important;
}

/* ==========================================================================
   SPRACHFLAGGE DAUERHAFT SICHTBAR & ÖFFENTLICH (AUSBRECHER-STIL)
   ========================================================================== */

.book-language-flag {
    position: absolute !important;
    top: -8px !important;   
    left: -8px !important;  
    right: auto !important;
    z-index: 110 !important; 
    width: 34px !important;
    height: 34px !important;
    background: #ffffff !important; 
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    line-height: 1 !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    opacity: 1 !important;
    transform: scale(1) !important;
    pointer-events: none; 
    user-select: none;
}

.bookshelf-grid .book-card:hover .book-language-flag,
.custom-bookshelf-grid .book-card:hover .book-language-flag {
    transform: scale(1) !important; 
    opacity: 1 !important;
}

@media (max-width: 767px) {
    .book-language-flag {
        width: 28px !important;
        height: 28px !important;
        font-size: 16px !important;
        top: -6px !important;
        left: -6px !important;
    }
}

/* ==========================================================================
   FLAGGEN-REFIX V2: CONTAINER ÖFFNEN
   ========================================================================== */

.bookshelf-grid .book-card *,
.custom-bookshelf-grid .book-card *,
.bookshelf-carousel-wrapper *,
.series-archive-wrapper * {
    overflow: visible !important;
}

.bookshelf-grid .book-cover,
.custom-bookshelf-grid .book-cover,
.bookshelf-carousel-wrapper .book-cover,
.series-archive-wrapper .book-cover,
.book-card img {
    border-radius: 8px !important;
    overflow: hidden !important; /* Verhindert ausgefranste Ecken */
}

.book-language-flag {
    z-index: 9999 !important; 
}

/* ==========================================================================
   SHORTCODE: BOOK CREDITS (AUTOR & ÜBERSETZER)
   ========================================================================== */

.book-credits-wrapper {
   display: inline-flex;
    flex-direction: column; 
    gap: 4px;              
    font-size: 1.15rem;    
    color: #abb8c3;        
    line-height: 1.3;
    font-weight: 500;
    padding: 10px 0 30px 0;
    border-bottom: 2px dotted #606060;
}

.book-credits-wrapper .credit-translator {
    font-style: italic;    
}

/* ==========================================================================
   TOUCHSCREEN-FIX: SOWOHL KARTE ALS AUCH HERZ AUF MOBIL BERUHIGEN
   ========================================================================== */
@media (max-width: 1024px) {
    /* 1. Verhindert, dass die GANZE Buchkarte beim Tippen auf dem Handy zoomt */
    .bookshelf-grid .book-card:hover,
    .custom-bookshelf-grid .book-card:hover {
        transform: none !important;
        z-index: 1 !important;
    }

    /* 2. Macht das Herz dauerhaft voll sichtbar und friert die Größe auf 1 ein */
    .bookshelf-grid .book-card .book-action-btn,
    .custom-bookshelf-grid .book-card .book-action-btn {
        opacity: 1 !important;
        transform: scale(1) !important; /* ✅ Zwingt das Herz auf Normalgröße */
    }

    /* 3. Killt jegliche Skalierung und Farbwechsel beim Hovern des Buttons */
    .bookshelf-grid .book-card:hover .book-action-btn,
    .custom-bookshelf-grid .book-card:hover .book-action-btn,
    .bookshelf-grid .book-card .book-action-btn:hover,
    .custom-bookshelf-grid .book-card .book-action-btn:hover {
        transform: scale(1) !important; /* ✅ Blockiert den Button-Zoom (1.1) */
        background: #DA3258 !important; /* Behält das sattere Pink bei */
        color: #ffffff !important;
    }

    /* 4. Sorgt dafür, dass bereits aktivierte Herzen weiß und unskaliert bleiben */
    .bookshelf-grid .book-card .heart-btn.is-active,
    .custom-bookshelf-grid .book-card .heart-btn.is-active,
    .bookshelf-grid .book-card:hover .heart-btn.is-active {
        background: #ffffff !important;
        color: #DA3258 !important;
        transform: scale(1) !important;
    }
}

/* ==========================================================================
   BÜCHERREGAL: OPTIK FÜR ABGESCHLOSSENE BÜCHER (KORRIGIERT)
   ========================================================================== */

/* Das Herz-Icon bei abgeschlossenen Büchern grün statt pink einfärben */
.book-card-thumbnail.book-is-finished .book-action-btn,
.book-card-thumbnail.book-is-finished .heart-btn {
    background: #10B981 !important; /* Ein schönes, klares Smaragd-Grün */
    color: #ffffff !important;
}

/* 1. EDLES AUSGRAUEN: Nur innerhalb von Rastern/Karussells, NICHT auf der Detailseite */


.bookshelf-grid .book-card-thumbnail.book-is-finished,
.bookshelf-carousel-wrapper .book-card-thumbnail.book-is-finished {
    opacity: 0.55 !important; /* Höhere Deckkraft, damit es auf Schwarz nicht absäuft */
    filter: grayscale(30%) !important; /* Nicht komplett schwarz-weiß, sondern nur dezent entsättigt */
    transition: opacity 0.3s ease, filter 0.3s ease;
}

/* Hover-Effekt: Wenn man mit der Maus drübergeht, leuchtet es wieder voll auf */
.bookshelf-grid .book-card-thumbnail.book-is-finished:hover,
.bookshelf-carousel-wrapper .book-card-thumbnail.book-is-finished:hover {
    opacity: 0.9 !important;
    filter: grayscale(10%) !important;
}

/* 2. SCHUTZ FÜR DIE DETAILSEITE: Hier soll das Buch IMMER strahlen */
.single-book .book-card-thumbnail.book-is-finished,
.postid-book .book-card-thumbnail.book-is-finished {
    opacity: 1 !important;
    filter: none !important;
}

/* ==========================================================================
   🎬 NETFLIX-STYLE POPUP FOR BOOK DESCRIPTION
   ========================================================================== */

/* 1. Der abgedunkelte Hintergrund (Backdrop) */
.netflix-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); /* Tiefes Netflix-Schwarz mit Transparenz */
    z-index: 99999; /* Garantiert über dem Reader und dem Footer */
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px); /* Macht den Hintergrund leicht unscharf */
    animation: netflixFadeIn 0.3s ease forwards;
}

/* 2. Die eigentliche Popup-Karte */
.netflix-card {
    position: relative;
    background: #181818; /* Netflix Card-Hintergrund */
    color: #ffffff;
    width: 90%;
    max-width: 650px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0px 10px 30px rgba(177, 177, 177, 0.5)
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    animation: netflixScaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 3. Schließen-Button oben rechts */
.netflix-close {
  position: absolute;
  top: 15px;
  right: 20px;
  color: #ffffff;
  font-size: 30px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.2s ease, color 0.2s ease;
}

.netflix-close:hover {
    color: #DA3258; 
    transform: scale(1.1);
}

/* 4. Hero-Bereich (Hintergrundbild / Cover-Ausschnitt) */
.netflix-hero-bg {
    width: 100%;
    height: 250px;
    background-size: cover;
    background-position: center center;
    position: relative;
	background-repeat: no-repeat;
	border-top-left-radius: 8px;
    border-top-right-radius: 8px;
	aspect-ratio: 21 / 9;
}
/* Sanfter Verlauf nach unten zum Text hin */
.netflix-hero-bg::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(to top, #181818, transparent);
}

/* 5. Inhaltsbereich */
.netflix-main-content {
    padding: 25px 30px 30px 30px;
}

.netflix-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 15px 0;
    color: #ffffff;
}

/* 6. Badges (Autor, Jahr, Alter, etc.) */
.netflix-badge-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.netflix-badge {
    background: #333333;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Spezielles Highlight für den Autor oder das Alter */
.netflix-badge:first-child {
    color: #88bd92; /* Erstes Badge (meist Autor) in Netflix-Rot */
    background: rgba(229, 9, 20, 0.1);
    border: 1px solid #88bd92;
}

/* 7. Pitch / Klappentext */
.netflix-pitch {
    font-size: 15px;
    line-height: 1.6;
    color: #d2d2d2;
    margin-bottom: 25px;
    max-height: 180px;
    overflow-y: auto; /* Scrollbar, falls der Text mal sehr lang ist */
    padding-right: 5px;
}

/* Hübsche, dezente Scrollbar für den Text */
.netflix-pitch::-webkit-scrollbar {
    width: 4px;
}
.netflix-pitch::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

/* 8. Aktionsbereich (Abo-Button) */
.netflix-action-area {
    display: flex;
    justify-content: flex-start;
}

.netflix-subscribe-btn {
    background-color: #da3258;
    color: #ffffff !important;
    text-decoration: none !important;
    padding: 12px 25px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 4px;
    transition: background 0.2s ease, transform 0.2s ease;
    box-shadow: 0 4px 12px rgba(229, 9, 20, 0.3);
}

.netflix-subscribe-btn:hover {
    background-color: #DA3258;
    transform: translateY(-2px);
}

/* Animations-Keyframes */
@keyframes netflixFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes netflixScaleUp {
    from { transform: scale(0.93); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   🎠 STEUERPFEILE KARUSSELL (Sicher isoliert)
   ========================================================================== */

/* Die absolute Positionierung und das Design der Pfeile gilt NUR innerhalb des Karussells */
.bookshelf-carousel-wrapper .carousel-arrow {
    position: absolute;
    top: 40% !important; /* Leicht nach oben versetzt, um den Footer-Konflikt zu lösen */
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8) !important;
    color: #ffffff !important;
    border: 1px solid #333333 !important;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.bookshelf-carousel-wrapper .carousel-arrow:hover {
    background: #ffffff !important;
    color: #da3258 !important;
    border-color: #ffffff !important;
    transform: translateY(-50%) scale(1.1);
}

/* Die Richtungs-Klassen werden strikt an das Karussell gebunden! */
.bookshelf-carousel-wrapper .carousel-arrow.arrow-left { 
    left: -22px !important; /* Ragt elegant leicht aus dem Grid heraus */
}

.bookshelf-carousel-wrapper .carousel-arrow.arrow-right { 
    right: -22px !important; 
}

/* Auf mobilen Touch-Geräten blenden wir die Pfeile aus, da man dort wischt */
@media (max-width: 768px) {
    /* Für mobile Touch-Geräte: Pfeile NICHT löschen, sondern optimieren */
@media (max-width: 768px) {
    .bookshelf-carousel-wrapper .carousel-arrow {
        width: 32px !important;    /* Etwas kleiner, damit sie nicht stören */
        height: 32px !important;
        background: rgba(0, 0, 0, 0.85) !important; /* Etwas dunkler für besseren Kontrast */
        top: 35% !important;       /* Perfekt auf Cover-Höhe ausrichten */
    }

    /* Wir schieben sie ein Stück nach innen, damit sie nicht aus dem Bildschirm ragen */
    .bookshelf-carousel-wrapper .carousel-arrow.arrow-left { 
        left: 5px !important; 
    }

    .bookshelf-carousel-wrapper .carousel-arrow.arrow-right { 
        right: 5px !important; 
    }
    
    /* Die Icons im Pfeil drin auch minimal verkleinern */
    .bookshelf-carousel-wrapper .carousel-arrow .dashicons {
        font-size: 16px !important;
        width: 16px !important;
        height: 16px !important;
    }
}
}

/* Ersetzt die Breite des Netflix-Buttons im Karussell auf 100% */
.book-card .book-card-actions,
.book-card .open-desc-btn {
    width: 100% !important;
    display: block;
    box-sizing: border-box;
}