/* ═══════════════════════════════════════════════════════════════
   KissBooK Bibliothèque v2.0.0 — Console Paramétrage Imprimante & PDF
   Modale PPA Centrée au Premier Plan Absolu (z-index: 10000150)
   ═══════════════════════════════════════════════════════════════ */

#kbb-print-modal-overlay.kbb-print-overlay {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 18px !important;
    background: rgba(4, 6, 14, 0.86) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    z-index: 10000150 !important;
    box-sizing: border-box !important;
    font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    color: var(--text-primary, #f8fafc);
}

.kbb-print-dialog {
    position: relative;
    z-index: 10000155;
    width: min(96vw, 1060px);
    min-width: min(320px, 94vw);
    height: min(92vh, 790px);
    background: var(--bg-secondary, #0f172a);
    border: 1px solid var(--border-active, rgba(56, 189, 248, 0.45));
    border-radius: 18px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.78), 0 0 0 1px rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.kbb-print-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.94));
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    flex-shrink: 0;
}

.kbb-print-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--accent-primary, #38bdf8);
}

.kbb-print-header small {
    display: block;
    margin-top: 2px;
    font-size: 0.78rem;
    color: #94a3b8;
}

.kbb-print-close {
    position: relative !important;
    z-index: 10000165 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(255, 255, 255, 0.06);
    color: #f8fafc;
    font-size: 16px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.kbb-print-close:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.7);
}

.kbb-print-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 360px 1fr;
    overflow: hidden;
}

.kbb-print-settings {
    padding: 16px;
    overflow-y: auto;
    border-right: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(7, 11, 20, 0.55);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.kbb-print-section {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kbb-print-section h4 {
    margin: 0 0 2px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kbb-print-radios {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.kbb-print-radios label,
.kbb-print-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #cbd5e1;
    cursor: pointer;
}

.kbb-print-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.kbb-print-grid-2 label,
.kbb-print-section > label:not(.kbb-print-check) {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #94a3b8;
}

.kbb-print-input,
.kbb-print-select {
    width: 100%;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: #020617;
    color: #f8fafc;
    font-size: 0.82rem;
    font-family: inherit;
    box-sizing: border-box;
}

.kbb-print-input:focus,
.kbb-print-select:focus {
    outline: none;
    border-color: var(--accent-primary, #38bdf8);
}

.kbb-print-checks-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 2px;
}

.kbb-print-checklist {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 110px;
    overflow-y: auto;
    padding-top: 4px;
}

.kbb-p-thumb-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 7px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(30, 41, 59, 0.7);
    color: #e2e8f0;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
}

.kbb-p-thumb-item:has(input:checked) {
    border-color: var(--accent-primary, #38bdf8);
    background: rgba(56, 189, 248, 0.16);
}

.kbb-print-preview-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: radial-gradient(circle at top center, #1e293b 0%, #070b14 100%);
}

.kbb-print-preview-bar {
    padding: 10px 18px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    font-size: 0.82rem;
    font-weight: 700;
    color: #93c5fd;
    background: rgba(15, 23, 42, 0.65);
    flex-shrink: 0;
}

.kbb-print-preview-sheets {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.kbb-preview-sheet {
    width: min(100%, 440px);
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    flex-shrink: 0;
}

.kbb-preview-sheet.has-crops::after {
    content: '';
    position: absolute;
    inset: 6px;
    border: 1px dashed rgba(100, 116, 139, 0.65);
    pointer-events: none;
}

.kbb-sheet-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    gap: 8px;
}

.kbb-sheet-grid.cols-1 {
    grid-template-columns: 1fr;
}

.kbb-sheet-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
}

.kbb-sheet-slot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f8fafc;
}

.kbb-sheet-slot.blank {
    border: 1px dashed #cbd5e1;
    color: #94a3b8;
    font-size: 0.72rem;
}

.kbb-sheet-slot img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.kbb-sheet-pgnum {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(15, 23, 42, 0.78);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 5px;
}

.kbb-sheet-footer {
    text-align: center;
    font-size: 0.65rem;
    color: #64748b;
    padding-top: 4px;
    flex-shrink: 0;
}

.kbb-print-footer {
    padding: 12px 20px;
    background: rgba(15, 23, 42, 0.96);
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.kbb-print-footer button {
    position: relative !important;
    z-index: 10000165 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    padding: 9px 16px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    border: 1px solid transparent;
    transition: transform 0.12s ease, opacity 0.15s ease;
}

.kbb-print-footer button:hover {
    transform: translateY(-1px);
}

.kbb-print-btn-sec {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(148, 163, 184, 0.35) !important;
    color: #e2e8f0;
}

.kbb-print-btn-pdf {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
}

.kbb-print-btn-go {
    background: linear-gradient(135deg, var(--accent-primary, #0ea5e9), #2563eb);
    color: #fff;
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.35);
}

@media (max-width: 820px) {
    .kbb-print-dialog {
        height: 94vh;
    }
    .kbb-print-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        overflow-y: auto;
    }
    .kbb-print-settings {
        border-right: none;
        border-bottom: 1px solid rgba(148, 163, 184, 0.18);
        max-height: 46vh;
    }
}
