/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8f9fa;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease;
}

body.dark-mode {
    background: #1a1a1a;
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.dark-mode-toggle:hover {
    background: #34495e;
    transform: scale(1.1);
}

.dark-mode .dark-mode-toggle {
    background: #667eea;
}

.dark-mode .dark-mode-toggle:hover {
    background: #5a6fd8;
}

/* Layout */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    height: 100vh;
}

.pdf-container {
    flex: 1;
    height: 100%;
    position: relative;
    background: white;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.dark-mode .pdf-container {
    background: #2d2d2d;
}

.pdf-canvas-container {
    max-width: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* PDF Rendering */
.pdf-page {
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-radius: 8px;
    max-width: 100%;
    height: auto;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.dark-mode .pdf-page {
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* Fallback Display */
.pdf-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    padding: 40px;
    text-align: center;
    background: #f8f9fa;
    color: #666;
}

.pdf-fallback .fallback-content {
    text-align: center;
    padding: 40px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.pdf-fallback .fallback-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 20px;
    color: #667eea;
}

.pdf-fallback h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.4em;
}

.pdf-fallback p {
    margin-bottom: 25px;
    color: #666;
    line-height: 1.6;
}

.pdf-fallback .fallback-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.pdf-fallback .fallback-btn {
    display: inline-block;
    padding: 12px 24px;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
}

.pdf-fallback .fallback-btn.primary {
    background: #2c3e50;
}

.pdf-fallback .fallback-btn.secondary {
    background: #667eea;
}

/* Buttons */
.buttons {
    padding: 15px 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    background: white;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.dark-mode .buttons {
    background: #2d2d2d;
    border-top: 1px solid #404040;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #2c3e50;
    color: white;
}

.btn-secondary {
    background: #667eea;
    color: white;
}

.dark-mode .btn-primary {
    background: #34495e;
}

.dark-mode .btn-secondary {
    background: #5a6fd8;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.icon {
    width: 18px;
    height: 18px;
}

/* Footer */
.footer {
    background: #f8f9fa;
    padding: 10px;
    text-align: center;
    color: #666;
    border-top: 1px solid #eee;
    font-size: 12px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.dark-mode .footer {
    background: #1a1a1a;
    color: #999;
    border-top: 1px solid #404040;
}

/* Loading Animation */
.loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #667eea;
    background: #fafafa;
    z-index: 10;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.dark-mode .loading {
    background: #0f0f0f;
    color: #8b9cff;
}

.pdf-canvas-container {
    display: none;
}

.loading-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.loading-dots {
    display: flex;
    gap: 8px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: loadingPulse 1.5s ease-in-out infinite;
}

.dark-mode .loading-dot {
    background: #8b9cff;
}

.loading-dot:nth-child(1) { animation-delay: 0s; }
.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

.loading-text {
    font-size: 16px;
    font-weight: 500;
    color: #667eea;
    letter-spacing: 0.5px;
}

.dark-mode .loading-text {
    color: #8b9cff;
}

@keyframes loadingPulse {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Legacy spinner (fallback) */
.spinner {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .content {
        height: 100vh;
    }
    
    .buttons {
        flex-direction: column;
        align-items: center;
        padding: 10px;
    }
    
    .btn {
        width: 200px;
        justify-content: center;
    }

    .dark-mode-toggle {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
}
