/* ══════════════════════════════════════════════════════
   FlipBook Pro – Gallery & Card Styles
   ══════════════════════════════════════════════════════ */

/* ── Filter Bar ──────────────────────────────────────── */
.fbp-gallery-wrap { --fbp-primary: #6C3FEF; --fbp-accent: #a855f7; font-family:'Segoe UI',system-ui,sans-serif; }

.fbp-filter-bar {
    background: #f8f9fb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Search */
.fbp-search-wrap {
    position: relative;
    max-width: 420px;
}
.fbp-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 36px 10px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: .95rem;
    outline: none;
    transition: border-color .2s;
    background: #fff;
}
.fbp-search-input:focus { border-color: var(--fbp-primary); }
.fbp-search-clear {
    position: absolute;
    right: 10px; top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 1rem;
    display: none;
}
.fbp-search-clear.visible { display: block; }

/* Category tabs */
.fbp-cat-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.fbp-cat-tab {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid #d1d5db;
    background: #fff;
    cursor: pointer;
    font-size: .82rem;
    font-weight: 600;
    color: #374151;
    transition: all .18s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.fbp-cat-tab:hover { border-color: var(--fbp-primary); color: var(--fbp-primary); }
.fbp-cat-tab.active { background: var(--fbp-primary); border-color: var(--fbp-primary); color: #fff; }
.fbp-cat-count {
    background: rgba(0,0,0,.12);
    border-radius: 10px;
    padding: 1px 7px;
    font-size: .75rem;
}
.fbp-cat-tab.active .fbp-cat-count { background: rgba(255,255,255,.25); }

/* Results bar */
.fbp-results-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    font-size: .85rem;
    color: #6b7280;
}
.fbp-results-count { font-weight: 600; color: #374151; }
.fbp-results-query { color: var(--fbp-primary); font-style: italic; }

/* ── Grid ────────────────────────────────────────────── */
.fbp-grid {
    display: grid;
    gap: 22px;
}
.fbp-cols-1 { grid-template-columns: 1fr; }
.fbp-cols-2 { grid-template-columns: repeat(2,1fr); }
.fbp-cols-3 { grid-template-columns: repeat(3,1fr); }
.fbp-cols-4 { grid-template-columns: repeat(4,1fr); }
.fbp-cols-5 { grid-template-columns: repeat(5,1fr); }
.fbp-cols-6 { grid-template-columns: repeat(6,1fr); }

/* ── Book Card ───────────────────────────────────────── */
.fbp-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    transition: transform .22s, box-shadow .22s;
    display: flex;
    flex-direction: column;
}
.fbp-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 28px rgba(108,63,239,.15);
    border-color: #c4b5fd;
}

/* Thumbnail */
.fbp-card-thumb {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
    background: #f3f4f6;
}
.fbp-card-img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}
.fbp-card:hover .fbp-card-img { transform: scale(1.04); }
.fbp-card-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 3.5rem;
    background: linear-gradient(135deg, #f0f0ff, #e8e0ff);
}

/* Badge */
.fbp-card-badge {
    position: absolute;
    top: 10px; left: 10px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
}
.fbp-badge-lock { background: rgba(0,0,0,.65); color: #fff; }
.fbp-badge-free { background: #22c55e; color: #fff; }

/* Body */
.fbp-card-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 6px;
}
.fbp-card-cats { display: flex; flex-wrap: wrap; gap: 5px; }
.fbp-card-cat {
    background: #ede9fe;
    color: var(--fbp-primary);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: .72rem;
    font-weight: 600;
}
.fbp-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.35;
}
.fbp-card-desc {
    margin: 0;
    font-size: .82rem;
    color: #6b7280;
    line-height: 1.5;
}
.fbp-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 8px;
}
.fbp-card-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--fbp-primary);
}
.fbp-card-free {
    font-size: .9rem;
    font-weight: 700;
    color: #22c55e;
}
.fbp-card-views { font-size: .78rem; color: #9ca3af; }

/* Card actions */
.fbp-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.fbp-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 9px 14px;
    background: var(--fbp-primary);
    color: #fff !important;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .18s, transform .1s;
    white-space: nowrap;
}
.fbp-btn:hover { background: #5830d8; transform: translateY(-1px); }
.fbp-btn-outline {
    background: transparent;
    border: 1.5px solid var(--fbp-primary);
    color: var(--fbp-primary) !important;
    flex: 0 0 auto;
    padding: 9px 12px;
}
.fbp-btn-outline:hover { background: var(--fbp-primary); color: #fff !important; }

/* ── Modal ───────────────────────────────────────────── */
.fbp-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fbp-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.75);
    backdrop-filter: blur(4px);
    cursor: pointer;
}
.fbp-modal-box {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 14px;
    width: 92vw;
    max-width: 960px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0,0,0,.4);
    display: flex;
    flex-direction: column;
}
.fbp-modal-close {
    position: sticky;
    top: 0;
    align-self: flex-end;
    margin: 10px 12px 0 0;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 34px; height: 34px;
    font-size: 1rem;
    cursor: pointer;
    z-index: 2;
    flex-shrink: 0;
    transition: background .15s;
}
.fbp-modal-close:hover { background: #e5e7eb; }
.fbp-modal-content { padding: 0 16px 20px; }

/* QR Popup (inside modal or inline) */
.fbp-qr-popup {
    text-align: center;
    padding: 24px;
}
.fbp-qr-popup img { border-radius: 8px; border: 3px solid #f3f4f6; margin: 10px auto; display: block; }
.fbp-qr-popup h3 { margin: 0 0 6px; }
.fbp-qr-popup p { font-size: .85rem; color: #6b7280; margin: 4px 0; }
.fbp-qr-url { font-size: .78rem; word-break: break-all; color: #9ca3af; margin-top: 8px; }

/* ── Spinner ─────────────────────────────────────────── */
.fbp-spinner { display: flex; justify-content: center; padding: 40px; }
.fbp-spin {
    width: 38px; height: 38px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--fbp-primary);
    border-radius: 50%;
    animation: fbp-rotate .7s linear infinite;
}
@keyframes fbp-rotate { to { transform: rotate(360deg); } }

/* ── Empty ───────────────────────────────────────────── */
.fbp-empty {
    grid-column: 1/-1;
    text-align: center;
    padding: 50px 20px;
    color: #9ca3af;
    font-size: 1rem;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 900px) {
    .fbp-cols-4,.fbp-cols-5,.fbp-cols-6 { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 640px) {
    .fbp-cols-3,.fbp-cols-4,.fbp-cols-5,.fbp-cols-6 { grid-template-columns: repeat(2,1fr); }
    .fbp-modal-box { max-height: 98vh; border-radius: 10px; }
}
@media (max-width: 380px) {
    .fbp-cols-2,.fbp-cols-3,.fbp-cols-4 { grid-template-columns: 1fr; }
}
