/**
 * EscapeReadz Bookshelf - Frontend Styles & UI Components
 * 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
   ========================================================================== */

.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;
}

.bookshelf-carousel-wrapper .bookshelf-grid {
    display: flex !important;
    gap: 24px;
    padding: 15px;
    width: 100%;
    box-sizing: border-box;
}

@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
   ========================================================================== */

.book-card-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    margin-top: 10px;
    padding: 0 8px;
    box-sizing: border-box;
}

.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;
    color: #fff;
    transition: opacity 0.2s ease;
}

.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;
    height: 100% !important;
    align-items: center;
    text-align: center;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

.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%;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    min-height: 2.8em; 
}

.series-link,
.restart-reading-btn {
    margin-top: auto !important;
}

/* ==========================================================================
   BUTTONS & ACTIONS (Inkl. Leih- & Kauf-Button Integration)
   ========================================================================== */

.reader-overlay-btn-trigger {
    display: inline-block !important;
    background-color: #DA3258 !important;
    color: #ffffff !important;
    border: 0 !important;
    padding: 7px 4px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    text-decoration: none !important;
    text-align: center !important;
    box-shadow: 0 4px 12px rgba(218, 50, 88, 0.2) !important;
    transition: background-color 0.2s ease, transform 0.2s ease !important;
}

.reader-overlay-btn-trigger:hover {
    background-color: #be2546 !important;
    transform: translateY(-1px) !important;
}

/* WooCommerce Kaufen- & Leih-Button Sektion */
.escape-buy-section .added_to_cart {
    display: none !important;
}

.escape-buy-section .reader-overlay-btn-trigger.cart-success {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
    color: #ffffff !important;
    transition: background-color 0.3s ease;
}

.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;
    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;
    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;
    background: linear-gradient(to right, rgba(0,0,0,0) 0%, rgba(218,50,88,1) 80%, rgba(218,50,88,1) 100%);
}
.view-all-link:hover {
    color: #ffffff;
    text-decoration: underline;
}

.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;
}

/* ==========================================================================
   SPRACHFLAGGE
   ========================================================================== */

.book-language-flag {
    position: absolute !important;
    top: -8px !important;   
    left: -8px !important;  
    right: auto !important;
    z-index: 9999 !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;
    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;
}

.book-language-flag img {
    width: 18px !important;
    height: auto !important;
    display: block !important;
    margin: 0 auto !important;
}

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

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

.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 */
@media (max-width: 1024px) {
    .bookshelf-grid .book-card:hover,
    .custom-bookshelf-grid .book-card:hover {
        transform: none !important;
        z-index: 1 !important;
    }
    .bookshelf-grid .book-card .book-action-btn,
    .custom-bookshelf-grid .book-card .book-action-btn {
        opacity: 1 !important;
        transform: scale(1) !important;
    }
}

/* ABGESCHLOSSENE BÜCHER */
.book-card-thumbnail.book-is-finished .book-action-btn,
.book-card-thumbnail.book-is-finished .heart-btn {
    background: #10B981 !important;
    color: #ffffff !important;
}

.bookshelf-grid .book-card-thumbnail.book-is-finished,
.bookshelf-carousel-wrapper .book-card-thumbnail.book-is-finished {
    opacity: 0.55 !important;
    filter: grayscale(30%) !important;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

/* NETFLIX-STYLE POPUP */
.netflix-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    animation: netflixFadeIn 0.3s ease forwards;
}

.netflix-card {
    position: relative;
    background: #181818;
    color: #ffffff;
    width: 90%;
    max-width: 650px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0px 10px 30px rgba(177, 177, 177, 0.5);
    animation: netflixScaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.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);
}

.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;
}

.netflix-hero-bg::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(to top, #181818, transparent);
}

.netflix-main-content {
    padding: 25px 30px 30px 30px;
}

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

.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;
}

.netflix-pitch {
    font-size: 15px;
    line-height: 1.6;
    color: #d2d2d2;
    margin-bottom: 25px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 5px;
}

.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;
}

@keyframes netflixFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* KARUSSELL PFEILE */
.bookshelf-carousel-wrapper .carousel-arrow {
    position: absolute;
    top: 40% !important;
    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.arrow-left { left: -22px !important; }
.bookshelf-carousel-wrapper .carousel-arrow.arrow-right { right: -22px !important; }

/* Verhindert das Aufploppen des "View cart"-Links bei WooCommerce AJAX */
.escape-buy-section .added_to_cart,
.escape-borrow-section .added_to_cart,
.added_to_cart {
    display: none !important;
}

/* Grünfärbung beim Klick in den Warenkorb */
.escape-woo-btn.cart-success {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
    color: #ffffff !important;
    transition: background-color 0.3s ease;
}