/* ============================================================
   Mark Mason's PDF Flipper — Feature Styles
   Created by Paul Cutler

   Styles for: Password Gate · Resume Toast · Table of Contents
               Text Search · Bookshelf Grid · Shelf Lightbox
               Access Denied notice
   ============================================================ */

/* ═══════════════════════════════════════════════════════════════
   PASSWORD GATE
═══════════════════════════════════════════════════════════════ */
.pdfflip-pw-gate {
    position: absolute;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 23, 0.96);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: pf-fadein 0.25s ease;
}

.pdfflip-pw-box {
    background: #1a2030;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 36px 32px;
    width: min(340px, 88%);
    text-align: center;
    box-shadow: 0 24px 64px rgba(0,0,0,0.7);
    animation: pf-slide-up 0.3s cubic-bezier(0.16,1,0.3,1);
}

.pdfflip-pw-icon {
    color: var(--pf-accent, #e94560);
    margin-bottom: 16px;
}

.pdfflip-pw-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: rgba(255,255,255,0.92);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: -0.01em;
}

.pdfflip-pw-hint {
    margin: 0 0 20px;
    font-size: 13px;
    color: rgba(255,255,255,0.45);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.pdfflip-pw-form {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.pdfflip-pw-input {
    flex: 1;
    min-width: 0;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 7px;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    padding: 9px 12px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

.pdfflip-pw-input:focus {
    border-color: var(--pf-accent, #e94560);
    background: rgba(255,255,255,0.09);
}

.pdfflip-pw-input::placeholder {
    color: rgba(255,255,255,0.3);
}

.pdfflip-pw-submit {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 9px 16px;
    background: var(--pf-accent, #e94560);
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.18s, opacity 0.18s;
    font-family: inherit;
}

.pdfflip-pw-submit:hover:not(:disabled) {
    background: var(--pf-accent-hover, #ff6b88);
}

.pdfflip-pw-submit:disabled {
    opacity: 0.55;
    cursor: default;
}

.pdfflip-pw-error {
    margin: 4px 0 0;
    font-size: 12px;
    color: #ff7070;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 18px;
}

/* Shake animation on wrong password */
@keyframes pf-pw-shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-8px); }
    40%       { transform: translateX(8px); }
    60%       { transform: translateX(-5px); }
    80%       { transform: translateX(5px); }
}
.pdfflip-pw-shake .pdfflip-pw-box {
    animation: pf-pw-shake 0.45s ease;
}

/* Exit fade */
.pdfflip-pw-exit {
    animation: pf-fadeout 0.35s ease forwards;
}

/* ═══════════════════════════════════════════════════════════════
   RESUME READING TOAST
═══════════════════════════════════════════════════════════════ */
.pdfflip-resume-toast {
    position: absolute;
    bottom: 60px;     /* above controls bar */
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    z-index: 150;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(20, 26, 40, 0.96);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 40px;
    padding: 9px 14px 9px 18px;
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    white-space: nowrap;
    box-shadow: 0 8px 28px rgba(0,0,0,0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s cubic-bezier(0.16,1,0.3,1);
}

.pdfflip-resume-toast.pdfflip-resume-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.pdfflip-resume-yes,
.pdfflip-resume-no {
    padding: 4px 13px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: background 0.15s;
}

.pdfflip-resume-yes {
    background: var(--pf-accent, #e94560);
    color: #fff;
}

.pdfflip-resume-yes:hover {
    background: var(--pf-accent-hover, #ff6b88);
}

.pdfflip-resume-no {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
}

.pdfflip-resume-no:hover {
    background: rgba(255,255,255,0.18);
}

/* ═══════════════════════════════════════════════════════════════
   PASSWORD COVER OVERLAY
   Blurs the cover and shows a centred lock prompt
═══════════════════════════════════════════════════════════════ */

/* Blur the rendered PDF cover when password protected */
.pdfflip-outer[data-password-protected="true"] .pdfflip-cover-canvas-wrap {
    filter: blur(7px);
    -webkit-filter: blur(7px);
    transform: scale(1.04); /* hide blur edges */
    transition: filter 0.3s ease;
}

/* Full-cover lock overlay — sits above the blurred canvas */
.pdfflip-pw-cover-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    pointer-events: none;
    padding: 24px;
}

/* Frosted glass pill */
.pdfflip-pw-cover-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: rgba(10, 14, 23, 0.72);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 16px;
    padding: 22px 30px 18px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    text-align: center;
    max-width: 240px;
}

.pdfflip-pw-cover-icon {
    color: rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdfflip-pw-cover-title {
    font-size: 15px;
    font-weight: 700;
    color: rgba(255,255,255,0.92);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: 0.01em;
    margin: 0;
}

.pdfflip-pw-cover-hint {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
}

.pdfflip-pw-cover-icon svg {
    opacity: 0.9;
}

/* ═══════════════════════════════════════════════════════════════
   TEXT SEARCH PANEL
═══════════════════════════════════════════════════════════════ */
.pdfflip-search-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 130;
    background: rgba(13, 17, 23, 0.97);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: pf-fadein 0.2s ease;
}

.pdfflip-outer[data-theme="light"] .pdfflip-search-panel {
    background: rgba(230, 230, 230, 0.97);
    border-bottom-color: rgba(0,0,0,0.1);
}

.pdfflip-search-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
}

.pdfflip-search-input {
    flex: 1;
    min-width: 0;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 6px;
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    padding: 6px 10px;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: border-color 0.18s;
}

.pdfflip-search-input:focus {
    border-color: var(--pf-accent, #e94560);
    background: rgba(255,255,255,0.1);
}

.pdfflip-search-input::placeholder {
    color: rgba(255,255,255,0.3);
}

.pdfflip-outer[data-theme="light"] .pdfflip-search-input {
    background: rgba(0,0,0,0.07);
    border-color: rgba(0,0,0,0.14);
    color: rgba(0,0,0,0.85);
}

.pdfflip-outer[data-theme="light"] .pdfflip-search-input::placeholder {
    color: rgba(0,0,0,0.35);
}

.pdfflip-outer[data-theme="light"] .pdfflip-search-input:focus {
    background: rgba(0,0,0,0.05);
    border-color: var(--pf-accent, #e94560);
}

.pdfflip-search-count {
    font-size: 12px;
    color: rgba(255,255,255,0.45);
    white-space: nowrap;
    min-width: 44px;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.pdfflip-outer[data-theme="light"] .pdfflip-search-count {
    color: rgba(0,0,0,0.45);
}

/* Reuse .pdfflip-btn for search panel buttons */
.pdfflip-search-prev,
.pdfflip-search-next,
.pdfflip-search-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdfflip-search-prev:disabled,
.pdfflip-search-next:disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* Search button active state */
.pdfflip-btn-search.active {
    color: var(--pf-accent, #e94560);
    background: rgba(233, 69, 96, 0.12);
}

/* ═══════════════════════════════════════════════════════════════
   BOOKSHELF GRID
═══════════════════════════════════════════════════════════════ */
.pdfflip-bookshelf {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    width: 100%;
}

.pdfflip-bookshelf-title {
    margin: 0 0 20px;
    font-size: 22px;
    font-weight: 600;
    color: inherit;
    letter-spacing: -0.01em;
}

.pdfflip-bookshelf-grid {
    display: grid;
    grid-template-columns: repeat(var(--pf-shelf-cols, 3), 1fr);
    gap: 20px;
}

@media (max-width: 768px) {
    .pdfflip-bookshelf-grid {
        grid-template-columns: repeat(min(var(--pf-shelf-cols, 3), 2), 1fr);
        gap: 14px;
    }
}

@media (max-width: 480px) {
    .pdfflip-bookshelf-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

.pdfflip-shelf-item {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    background: #1a1e2a;
    border: var(--pf-border-width, 2px) var(--pf-border-style, solid) var(--pf-border-color, #c9a465);
    transition: transform 0.2s, box-shadow 0.2s;
    outline: none;
}

.pdfflip-shelf-item:hover,
.pdfflip-shelf-item:focus-visible {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}

.pdfflip-shelf-item:focus-visible {
    outline: 2px solid var(--pf-accent, #e94560);
    outline-offset: 2px;
}

.pdfflip-shelf-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    overflow: hidden;
    background: #0d1117;
}

.pdfflip-shelf-placeholder {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #1e2535 25%, #252d42 50%, #1e2535 75%);
    background-size: 200% 200%;
    animation: pf-shimmer 1.6s infinite linear;
}

.pdfflip-shelf-item.pdfflip-shelf-loaded .pdfflip-shelf-placeholder {
    display: none;
}

.pdfflip-shelf-canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

.pdfflip-shelf-label {
    padding: 10px 12px 8px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    line-height: 1.3;
    background: #1a1e2a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdfflip-shelf-open-hint {
    display: none;
    align-items: center;
    gap: 5px;
    padding: 0 12px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--pf-accent, #e94560);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: #1a1e2a;
}

.pdfflip-shelf-item:hover .pdfflip-shelf-open-hint,
.pdfflip-shelf-item:focus-visible .pdfflip-shelf-open-hint {
    display: flex;
}

/* ═══════════════════════════════════════════════════════════════
   BOOKSHELF LIGHTBOX
═══════════════════════════════════════════════════════════════ */
.pdfflip-shelf-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.pdfflip-shelf-lightbox.pdfflip-shelf-lb-open {
    opacity: 1;
    pointer-events: auto;
}

.pdfflip-shelf-lb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

.pdfflip-shelf-lb-inner {
    position: relative;
    z-index: 1;
    width: min(92vw, 1100px);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.94) translateY(16px);
    transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
}

.pdfflip-shelf-lightbox.pdfflip-shelf-lb-open .pdfflip-shelf-lb-inner {
    transform: scale(1) translateY(0);
}

.pdfflip-shelf-lb-close {
    position: absolute;
    top: -14px;
    right: -14px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    transition: background 0.15s, transform 0.15s;
}

.pdfflip-shelf-lb-close:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

.pdfflip-shelf-lb-flipper {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border-radius: 10px;
}

.pdfflip-shelf-lb-flipper .pdfflip-outer {
    height: min(80vh, 620px);
}

/* ═══════════════════════════════════════════════════════════════
   ACCESS DENIED NOTICE
═══════════════════════════════════════════════════════════════ */
.pdfflip-access-denied {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    background: #1e1e2e;
    border: 1px solid rgba(233, 69, 96, 0.35);
    border-left: 4px solid #e94560;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: rgba(255,255,255,0.8);
    font-size: 14px;
}

.pdfflip-access-denied .dashicons {
    color: #e94560;
    font-size: 22px;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.pdfflip-access-denied p {
    margin: 0;
    line-height: 1.5;
}

.pdfflip-access-denied a {
    color: var(--pf-accent, #e94560);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.pdfflip-access-denied a:hover {
    color: #ff6b88;
}

/* ═══════════════════════════════════════════════════════════════
   SHARED KEYFRAMES
═══════════════════════════════════════════════════════════════ */
@keyframes pf-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes pf-fadeout {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes pf-slide-up {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pf-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
