/* GC PDF Viewer — estilo granate / negro editorial */

.gc-pdf-viewer {
    --gc-maroon: #7a1f2b;
    --gc-maroon-dark: #5c1621;
    --gc-black: #121212;
    --gc-black-soft: #1b1b1b;
    --gc-cream: #f5efe6;
    --gc-border: #33262880;

    background: var(--gc-black);
    border-radius: 10px;
    overflow: hidden;
    font-family: Georgia, 'Times New Roman', serif;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    max-width: 100%;
    margin: 2rem 0;
}

/* ---------- Toolbar ---------- */
.gc-pdf-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: linear-gradient(180deg, var(--gc-maroon) 0%, var(--gc-maroon-dark) 100%);
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--gc-border);
    flex-wrap: wrap;
}

.gc-pdf-toolbar-left,
.gc-pdf-toolbar-center,
.gc-pdf-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gc-pdf-toolbar-left { flex: 1 1 auto; min-width: 0; }

.gc-pdf-title {
    color: var(--gc-cream);
    font-size: 1rem;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gc-pdf-btn {
    background: rgba(0,0,0,0.15);
    border: 1px solid rgba(245,239,230,0.35);
    color: var(--gc-cream);
    width: 34px;
    height: 34px;
    min-width: 34px;
    flex-shrink: 0;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
    text-decoration: none;
    padding: 0;
    line-height: 0;
    font-family: inherit;
}

.gc-pdf-btn svg {
    width: 18px;
    height: 18px;
    display: block;
    pointer-events: none; /* el click siempre lo recibe el botón, nunca el svg interno */
}

.gc-pdf-btn:hover {
    background: rgba(245,239,230,0.2);
    border-color: rgba(245,239,230,0.65);
}

.gc-pdf-btn:active {
    transform: scale(0.92);
}

.gc-pdf-btn:disabled,
.gc-pdf-btn.is-disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.gc-pdf-page-info {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--gc-cream);
    font-size: 0.9rem;
    white-space: nowrap;
}

.gc-pdf-page-num {
    width: 42px;
    text-align: center;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(245,239,230,0.25);
    color: var(--gc-cream);
    border-radius: 4px;
    padding: 3px 2px;
    font-family: inherit;
    font-size: 0.9rem;
}

.gc-pdf-page-num::-webkit-inner-spin-button,
.gc-pdf-page-num::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.gc-pdf-zoom-level {
    color: var(--gc-cream);
    font-size: 0.85rem;
    width: 44px;
    text-align: center;
}

/* ---------- Canvas area (scroll continuo) ---------- */
.gc-pdf-canvas-wrapper {
    position: relative;
    background: var(--gc-black-soft);
    height: var(--gc-pdf-height, 800px);
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

.gc-pdf-pages {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem 1rem;
}

.gc-pdf-page {
    display: flex;
    justify-content: center;
    scroll-margin-top: 0.5rem; /* para que scrollIntoView no corte el borde superior */
}

.gc-pdf-canvas {
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    max-width: 100%;
    background: #fff;
}

/* ---------- Loading state ---------- */
.gc-pdf-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--gc-cream);
    background: var(--gc-black-soft);
    font-style: italic;
    z-index: 2;
}

.gc-pdf-loading.is-hidden {
    display: none;
}

.gc-pdf-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(245,239,230,0.2);
    border-top-color: var(--gc-maroon);
    border-radius: 50%;
    animation: gc-pdf-spin 0.8s linear infinite;
}

@keyframes gc-pdf-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Fullscreen ---------- */
.gc-pdf-viewer:fullscreen {
    display: flex;
    flex-direction: column;
    max-width: none;
    border-radius: 0;
}

.gc-pdf-viewer:fullscreen .gc-pdf-canvas-wrapper {
    flex: 1 1 auto;
    height: auto;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .gc-pdf-toolbar {
        justify-content: center;
    }
    .gc-pdf-toolbar-left {
        order: -1;
        flex-basis: 100%;
        justify-content: center;
        margin-bottom: 0.35rem;
    }
    .gc-pdf-canvas-wrapper {
        padding: 1rem 0.5rem;
    }
}
