/* ─── PDFlo.link Viewer ─── */
/* Clean top bar, no page shadows, pill-shaped branding badge */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

:root {
    --primary: #9df425;
    --primary-dark: #88d61e;
    --bg: #E5E5E5;
    --paper: #FDFDFD;
    --text: #111111;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --toolbar-height: 56px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* ─── Reader Container ─── */
.pdf-reader-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ─── Toolbar ─── */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--toolbar-height);
    min-height: var(--toolbar-height);
    background: white;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
}

/* ─── Toolbar Buttons ─── */
.toolbar-button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    width: 32px;
    height: 32px;
}

.toolbar-button:hover {
    background: #f3f4f6;
    color: var(--text);
}

.toolbar-button:active {
    transform: scale(0.92);
}

.toolbar-button:disabled {
    opacity: 0.3;
    cursor: default;
}

.toolbar-button:disabled:hover {
    background: transparent;
    color: var(--text-muted);
}

.toolbar-button .material-symbols-outlined {
    font-size: 20px;
}

/* View mode toggle — highlight active state */
.toolbar-button.view-mode-active {
    color: var(--primary-dark);
    background: rgba(157, 244, 37, 0.1);
}

/* Old SVG icons fallback */
.toolbar-button svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

/* ─── Page Number Input ─── */
.page-number-input {
    width: 48px;
    height: 32px;
    text-align: center;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    outline: none;
    transition: border-color 0.15s;
    appearance: textfield;
    -moz-appearance: textfield;
}

.page-number-input::-webkit-outer-spin-button,
.page-number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.page-number-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(157, 244, 37, 0.2);
}

.page-indicator {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    gap: 6px !important;
}

/* ─── Zoom Select ─── */
.zoom-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    font-weight: 500;
    background: white;
    height: 32px;
    color: var(--text);
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 24px;
}

.zoom-select:focus {
    border-color: var(--primary);
}

/* ─── Content Area ─── */
.content {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ─── Sidebar ─── */
#sidebar {
    width: 180px;
    flex-shrink: 0;
    background: white;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    transition: width 0.3s, padding 0.3s;
    padding: 10px;
}

#sidebar::-webkit-scrollbar {
    display: none;
}

#sidebar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#sidebar.collapsed {
    width: 0;
    padding: 0;
    border: none;
    overflow: hidden;
}

/* ─── Thumbnails ─── */
.thumbnail {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: border-color 0.2s;
}

.thumbnail:hover {
    border-color: var(--primary);
}

.thumbnail.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(157, 244, 37, 0.25);
}

/* ─── Viewport ─── */
#viewport {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    padding: 20px;
    background: var(--bg);
    overflow: hidden;
    cursor: grab;
    user-select: none;
}

#viewport.dragging {
    cursor: grabbing;
}

/* ─── Page Container — NO SHADOWS ─── */
.page-container {
    background: white;
    flex-shrink: 0;
    pointer-events: none;
    /* NO box-shadow, NO border — clean page display */
}

.page-container canvas {
    display: block;
}

/* ─── Overlays ─── */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.loader-content,
.error-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.progress-bar {
    width: 200px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 1rem;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: var(--primary);
    width: 0;
    transition: width 0.3s;
}

/* ─── Branding Footer (pill badge, bottom-right) ─── */
.branding-footer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 50;
    opacity: 0.55;
    transition: opacity 0.25s;
    overflow: hidden;
}

.branding-footer:hover {
    opacity: 1;
}

.branding-footer a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    white-space: nowrap;
    line-height: 1;
}

.branding-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--primary);
    display: block;
    flex-shrink: 0;
}

.branding-text {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.01em;
}

.branding-accent {
    color: var(--primary-dark);
}

/* ─── Ad Container ─── */
.ad-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 5px;
    text-align: center;
    border-top: 1px solid var(--border);
    z-index: 50;
}

/* ─── Desktop Only ─── */
.desktop-only-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Mobile Responsive ─── */
@media (max-width: 768px) {
    .toolbar {
        padding: 0 8px;
    }

    .toolbar-divider {
        display: none;
    }

    .desktop-only-buttons {
        display: none;
    }

    #sidebar {
        position: absolute;
        left: 0;
        top: var(--toolbar-height);
        bottom: 0;
        z-index: 90;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.08);
    }

    #sidebar.collapsed {
        left: -200px;
    }

    #viewport {
        padding: 10px;
    }

    .branding-footer {
        bottom: 8px;
        right: 12px;
    }
}