/* ============================================
   Reset & Variables
   ============================================ */
:root {
    --bg-app: #111111;
    --bg-sidebar: #1a1a1a;
    --bg-control: rgba(26, 26, 26, 0.9);
    --border-subtle: #333333;

    --text-primary: #ededed;
    --text-secondary: #a1a1a1;

    --accent: #ffffff;
    --accent-hover: #cccccc;

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-ui);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* ============================================
   Layout
   ============================================ */
.app-container {
    display: flex;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 20;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-100%);
    position: absolute;
    height: 100%;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.logo {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    letter-spacing: 0.05em;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    overflow: hidden;
}

.file-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.file-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-weight: 500;
}

.file-item svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    flex-shrink: 0;
}

.file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.empty-state {
    color: var(--text-secondary);
    font-size: 0.85rem;
    opacity: 0.5;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Action Buttons */
.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.primary-btn {
    background: var(--accent);
    color: #000;
}

.primary-btn:hover {
    background: var(--accent-hover);
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.secondary-btn:hover {
    border-color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
}

/* Main Content */
.main-content {
    flex: 1;
    position: relative;
    background: var(--bg-app);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Drop Zone (Empty State) */
.drop-zone {
    text-align: center;
    padding: 40px;
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border-subtle);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.drop-zone.drag-over {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(255, 255, 255, 0.02);
}

.icon-box svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.drop-zone h2 {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 500;
}

.drop-zone p {
    font-size: 0.9rem;
    line-height: 1.5;
    opacity: 0.7;
}

/* PDF Viewer Canvas */
.pdf-viewer {
    width: 100%;
    height: 100%;
    position: relative;
}

.pdf-viewer.hidden {
    display: none;
}

.canvas-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#pdfCanvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s cubic-bezier(0.2, 0, 0.2, 1), opacity 0.2s ease;
    transform-origin: center center;
}

#pdfCanvas.animating {
    opacity: 0.8;
    transform: scale(0.99);
}

/* Controls Overlay */
.controls-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Show controls only on hover of main content or when not in fullscreen */
.main-content:hover .controls-overlay,
.controls-overlay:hover {
    opacity: 1;
}

.controls-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-control);
    backdrop-filter: blur(12px);
    padding: 8px 16px;
    border-radius: 99px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.icon-btn {
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 8px;
}

.page-info {
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 60px;
    text-align: center;
}

.page-info span {
    color: var(--text-primary);
}

/* Bottom Progress Bar */
.bottom-progress-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    z-index: 100;
    pointer-events: none;
}

.bottom-progress-bar {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.2s ease;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Loader */
.loader {
    position: absolute;
    inset: 0;
    background: rgba(17, 17, 17, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Fullscreen Mode */
:fullscreen .app-container {
    background: #000;
}

:fullscreen .sidebar {
    display: none;
    /* Hide sidebar completely in fullscreen */
}

:fullscreen .main-content {
    background: #000;
}

:fullscreen .canvas-wrapper {
    padding: 0;
    height: 100vh;
}

:fullscreen #pdfCanvas {
    box-shadow: none;
}

:fullscreen .controls-overlay {
    bottom: 30px;
    /* Adjust for aesthetic */
}

/* Hide cursor when user stops moving in fullscreen controls */
body.user-inactive:fullscreen {
    cursor: none;
}

body.user-inactive:fullscreen .controls-overlay {
    opacity: 0;
}