/* css/flipbook.css */

/* Modal backdrop */
.flipbook-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 999999;
}

.flipbook-modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

/* Close button – base style (overridden in header context below) */
.flipbook-close {
    background: #ff3026;
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s ease;
    user-select: none;
    z-index: 20;
}

.flipbook-close:hover {
    background: #ff3026;
    color: #fff;
    transform: rotate(90deg);
}

/* Turn.js container */
/* .flipbook {
    width: 700px;
    height: 350px;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
    background-color: #0f0f0f;
    
    transition: margin-left 0.6s cubic-bezier(0.25, 1, 0.5, 1), left 0.6s cubic-bezier(0.25, 1, 0.5, 1);
} */

/* Ensure each page wrapper fits nicely */
.flipbook .turn-page-wrapper {
    overflow: hidden;
}

/* Ensure pages are styled nicely */
.flipbook div.turn-page {
    width: 100%;
    height: 100%;
    background-color: #f8f8f8;
}

.flipbook img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
}

.flipbook-nav {
    background: rgba(255, 48, 38, 0.9);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s ease;
    user-select: none;
    opacity: 0;
    pointer-events: none;
}

.flipbook-modal:not(.hidden) .flipbook-nav {
    opacity: 1;
    pointer-events: auto;
}

.flipbook-nav:hover {
    background: #ff3026;
    transform: translateY(-50%) scale(1.1);
}

/* Progress Bar Fill */
.flipbook-page-indicator .progress-bar-fill {
    width: 0%;
    height: 100%;
    background: #ff3026;
    border-radius: 10px;
    transition: width 0.3s ease-in-out;
}

/* ── Modal content container ─────────────────────────────────── */
.flipbook-modal-content {
    position: relative;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 24px;
    padding: 24px 24px 24px;
    width: min(1120px, 96vw);
    height: 88vh;
    max-height: 820px;
    min-height: 460px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* ── Flipbook Header ─────────────────────────────────── */
.flipbook-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 0 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 24px 24px 0 0;
    z-index: 40;
}

.flipbook-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.flipbook-project-title {
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    line-height: 1.2;
}

.flipbook-project-date {
    color: rgba(0, 0, 0, 0.45);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.4px;
    white-space: nowrap;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    line-height: 1.2;
}

.flipbook-header-actions {
    position: absolute;
    top: 0;
    right: 0;
    padding: 8px 16px 0 20px;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Sound toggle button */
.flipbook-sound-toggle {
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.6);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s ease;
    user-select: none;
    padding: 0;
    flex-shrink: 0;
}

.flipbook-sound-toggle:hover {
    background: rgba(255, 48, 38, 0.1);
    border-color: rgba(255, 48, 38, 0.35);
    color: #ff3026;
    transform: scale(1.08);
}

.flipbook-sound-toggle.muted {
    background: rgba(255, 48, 38, 0.1);
    border-color: rgba(255, 48, 38, 0.3);
    color: #ff3026;
}

/* reposition close button inside header */
.flipbook-header .flipbook-close {
    position: static;
    width: 36px;
    height: 36px;
    font-size: 20px;
    flex-shrink: 0;
}

/* ── Body: two-column grid ────────────────────────────── */
.flipbook-body {
    display: grid;
    grid-template-columns: 254px 1fr;
    gap: 0;
    flex: 1;
    min-height: 0;
    height: 100%;
}

/* ── Sidebar ──────────────────────────────────────────── */
.flipbook-sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 16px 16px;
    border-right: 1px solid rgba(0, 0, 0, 0.07);
    background: rgba(0, 0, 0, 0.02);
    overflow: hidden;
    min-width: 0;
}

.flipbook-sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Brand name */
.fbs-brand-name {
    color: #1a1a1a;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.35;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    margin: 0;
    word-break: break-word;
}

/* Badges container */
.fbs-badges {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

/* Individual badge */
.fbs-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    padding: 5px 10px;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-size: 11px;
    color: rgba(0, 0, 0, 0.65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.fbs-badge:hover {
    background: rgba(255, 48, 38, 0.08);
    border-color: rgba(255, 48, 38, 0.25);
    color: #ff3026;
}

.fbs-badge-icon {
    font-size: 12px;
    flex-shrink: 0;
    line-height: 1;
}

.fbs-badge-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Logo at bottom */
.fbs-logo-wrap {
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fbs-logo {
    max-width: 100%;
    max-height: 70px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.fbs-logo:hover {
    opacity: 1;
}

/* ── Book area ────────────────────────────────────────── */
.flipbook-book-area {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
}

/* Turn.js container Base */
.flipbook {
    margin: 0 auto;
    position: relative;
    background-color: transparent;

    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

/* First page: shift left so the single cover sits center of the book-area,
   visually like a closed book about to open */
/* .flipbook.closed-first {
    margin-left: -25%;
}

.flipbook.closed-last {
    margin-left: 25%;
}

.flipbook.opened {
    margin-left: 0;
} */

.flipbook.closed-first {
    transform: translateX(-25%) !important;
}

.flipbook.closed-last {
    transform: translateX(25%) !important;
}

.flipbook.opened {
    transform: translateX(0) !important;
}

.flipbook .turn-page-wrapper {
    overflow: hidden;
}

.flipbook div.turn-page {
    width: 100%;
    height: 100%;
    background-color: #0f0f0f;
}

.flipbook img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
}

/* Nav buttons scoped to book area */
.flipbook-book-area .flipbook-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 30;
}

.flipbook-book-area .flipbook-prev {
    left: 8px;
}

.flipbook-book-area .flipbook-next {
    right: 8px;
}

/* Progress bar scoped to book area */
.flipbook-book-area .flipbook-page-indicator {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    width: 180px;
    height: 5px;
    background: rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.flipbook-modal:not(.hidden) .flipbook-book-area .flipbook-page-indicator {
    opacity: 1;
}

/* ── Responsive: mobile ──────────────────────────────── */
@media (max-width: 768px) {
    .flipbook-modal-content {
        padding: 58px 12px 16px;
        width: 96vw;
        height: 92vh;
        max-height: none;
        border-radius: 18px;
    }

    .flipbook-header {
        padding: 0 10px 0 14px;
    }

    .flipbook-project-title {
        font-size: 12px;
    }

    .flipbook-project-date {
        font-size: 10px;
    }

    /* Stack: book on top, sidebar row below */
    .flipbook-body {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }

    /* Sidebar becomes a horizontal strip at the bottom */
    .flipbook-sidebar {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        border-right: none;
        border-top: 1px solid rgba(0, 0, 0, 0.07);
        overflow-x: auto;
        overflow-y: hidden;
    }

    .flipbook-sidebar-top {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
        overflow: hidden;
    }

    .fbs-brand-name {
        font-size: 12px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .fbs-badges {
        flex-direction: row;
        gap: 5px;
        flex-wrap: nowrap;
    }

    .fbs-badge {
        font-size: 10px;
        padding: 3px 8px;
        white-space: nowrap;
    }

    .fbs-logo-wrap {
        padding-top: 0;
        border-top: none;
        border-left: 1px solid rgba(0, 0, 0, 0.07);
        padding-left: 10px;
        flex-shrink: 0;
        margin-left: auto;
    }

    .fbs-logo {
        max-height: 36px;
    }

    /* Cancel side-shift on mobile single-page view */
    .flipbook.closed-first,
    .flipbook.closed-last,
    .flipbook.opened {
        /* margin-left: 0 !important; */
        transform: translateX(0) !important;
    }

    .flipbook-nav {
        width: 30px;
        height: 30px;
    }

    .flipbook-book-area .flipbook-prev {
        left: 4px;
    }

    .flipbook-book-area .flipbook-next {
        right: 4px;
    }

    .flipbook-book-area .flipbook-page-indicator {
        width: 120px;
        bottom: 8px;
    }
}