/* CSS Variable Definitions */
:root {
    --bg-dark: #090b0e;
    --bg-card: rgba(22, 28, 38, 0.55);
    --bg-card-hover: rgba(30, 38, 51, 0.75);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.18);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent-blue: #3b82f6;
    --accent-pink: #ec4899;
    --accent-purple: #8b5cf6;
    --accent-teal: #14b8a6;
    
    --status-checking: #f59e0b;
    --status-ready: #10b981;
    --status-missing: #ef4444;
    
    --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: all 0.2s ease;
}

/* Global Reset & Base Styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Background Glow Effects */
.glow-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    mix-blend-mode: screen;
}

.glow-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
    top: -200px;
    right: -100px;
    animation: float-slow 20s infinite alternate;
}

.glow-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
    bottom: -150px;
    left: -100px;
    animation: float-slow 25s infinite alternate-reverse;
}

@keyframes float-slow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(80px, 50px) scale(1.1); }
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* DASHBOARD VIEW */
.dashboard-view {
    display: none;
    flex-direction: column;
    flex-grow: 1;
}

.dashboard-view.active {
    display: flex;
}

/* Header Area */
.header {
    text-align: center;
    margin-bottom: 3.5rem;
    margin-top: 2rem;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.logo-icon {
    font-size: 2.25rem;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #ffffff 40%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 300;
    max-width: 600px;
    margin: 0 auto;
}

/* Card Grid Layout */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

/* Glassmorphic Presentation Card */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    min-height: 380px;
    height: 100%;
    transition: var(--transition-smooth);
}

.card:hover {
    transform: translateY(-8px);
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Card Glow Accent */
.card-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: var(--glow-color);
    opacity: 0.8;
}

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-icon-wrapper {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transition: var(--transition-smooth);
}

.card:hover .card-icon-wrapper {
    transform: scale(1.1);
}

.card-icon-wrapper.blue { color: var(--accent-blue); background: rgba(59, 130, 246, 0.1); }
.card-icon-wrapper.pink { color: var(--accent-pink); background: rgba(236, 72, 153, 0.1); }
.card-icon-wrapper.purple { color: var(--accent-purple); background: rgba(139, 92, 246, 0.1); }
.card-icon-wrapper.teal { color: var(--accent-teal); background: rgba(20, 184, 166, 0.1); }

.card-icon-wrapper svg {
    width: 24px;
    height: 24px;
}

/* Badges */
.status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    letter-spacing: 0.02em;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.status-badge.checking {
    background: rgba(245, 158, 11, 0.1);
    color: var(--status-checking);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge.ready {
    background: rgba(16, 185, 129, 0.15);
    color: var(--status-ready);
    border: 1px solid rgba(16, 185, 129, 0.3);
    animation: pulse-ready 2s infinite;
}

.status-badge.missing {
    background: rgba(239, 68, 68, 0.1);
    color: var(--status-missing);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

@keyframes pulse-ready {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.2); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Card Body */
.card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-role {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0.2rem 0.55rem;
    border-radius: 8px;
    letter-spacing: 0.01em;
}

.card-desc {
    color: var(--text-secondary);
    font-size: 0.925rem;
    font-weight: 300;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* File Info Area */
.file-info {
    margin-top: auto;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.825rem;
    color: var(--text-secondary);
    overflow: hidden;
}

.file-name {
    font-family: monospace;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
    min-width: 0;
}

.file-size {
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Card Footer & Button */
.card-footer {
    margin-top: 1.5rem;
}

.btn {
    width: 100%;
    height: 48px;
    border-radius: 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
}

.btn-primary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-primary:not(:disabled):hover {
    background: #ffffff;
    color: #000000;
    transform: translateY(-2px);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn svg {
    width: 18px;
    height: 18px;
    transition: var(--transition-fast);
}

.btn:hover svg {
    transform: translateX(4px);
}

/* Footer Section */
.footer {
    text-align: center;
    margin-top: auto;
    padding-top: 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* PRESENTATION VIEWER VIEW */
.viewer-view {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #07090b;
    z-index: 100;
    flex-direction: column;
}

.viewer-view.active {
    display: flex;
}

/* Top Toolbar */
.viewer-toolbar {
    height: 70px;
    min-height: 70px;
    background: rgba(13, 17, 23, 0.75);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
}

.viewer-meta {
    text-align: center;
    flex-grow: 1;
}

#viewer-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
}

.viewer-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
    display: block;
}

/* Buttons */
.btn-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: scale(1.05);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

/* Viewer Workspace */
.viewer-workspace {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    background-color: #0b0d10;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loading & Error Overlays */
.workspace-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(11, 13, 16, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
    gap: 1.5rem;
}

.workspace-overlay.hidden {
    display: none !important;
}

/* Spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(139, 92, 246, 0.1);
    border-top: 4px solid var(--accent-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-family: 'Outfit', sans-serif;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Error Box */
.error-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--status-missing);
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 450px;
    width: 90%;
    text-align: center;
    backdrop-filter: blur(10px);
}

.error-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.error-box h3 {
    font-family: 'Outfit', sans-serif;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.error-box p {
    color: var(--text-secondary);
    font-size: 0.925rem;
    margin-bottom: 1.5rem;
}

.btn-secondary {
    background: var(--status-missing);
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    height: auto;
    width: auto;
    display: inline-block;
}

.btn-secondary:hover {
    background: #ff5c5c;
    transform: translateY(-2px);
}

/* Canvas Viewport */
.canvas-viewport {
    width: 100%;
    height: 100%;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    cursor: grab;
}

.canvas-viewport:active {
    cursor: grabbing;
}

.canvas-container {
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
    background: #000;
    transition: transform 0.15s ease-out;
    transform-origin: center center;
    display: flex;
    border-radius: 4px;
    overflow: hidden;
}

#pdf-canvas {
    max-width: 100%;
    display: block;
}

/* Floating Controls Bar */
.viewer-controls-bar {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(13, 17, 23, 0.85);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 0.65rem 1.25rem;
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 10;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    transition: var(--transition-smooth);
}

.viewer-controls-bar:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(13, 17, 23, 0.95);
}

.controls-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.controls-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
}

.btn-icon-small {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon-small:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.btn-icon-small svg {
    width: 16px;
    height: 16px;
}

/* Page Indicator Details */
.page-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

#page-input {
    width: 44px;
    height: 28px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: var(--text-primary);
    text-align: center;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    outline: none;
    -moz-appearance: textfield;
}

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

#page-input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.page-total {
    white-space: nowrap;
}

.zoom-indicator {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 42px;
    text-align: center;
}

/* Animations */
.animate-fade-in {
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-card {
    opacity: 0;
    transform: translateY(20px);
    animation: cardEntrance 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: calc(var(--card-index) * 0.12s);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes cardEntrance {
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile Media Queries */
@media (max-width: 768px) {
    .app-container {
        padding: 1.5rem 1rem;
    }
    
    .logo-text {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .cards-grid {
        gap: 1.25rem;
    }
    
    .card {
        height: auto;
        padding: 1.5rem;
    }
    
    .viewer-controls-bar {
        width: calc(100% - 2rem);
        bottom: 1.5rem;
        padding: 0.5rem 1rem;
        justify-content: space-between;
        border-radius: 20px;
    }
    
    .controls-divider {
        display: none;
    }
}
