/* ePaper Viewer Frontend Styles */

.epaper-viewer-container {
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.epaper-viewer-wrapper {
    position: relative;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* ePaper Link Styles */
.epaper-link-container {
    display: inline-block;
}

.epaper-link {
    font-size: 16px;
    color: #fff !important;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 8px 16px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.7);
    display: inline-block;
}

.epaper-link:hover {
    background: rgba(0, 0, 0, 0.9);
    color: #fff !important;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.epaper-link:active {
    transform: translateY(0);
}

.epaper-link:visited {
    color: #fff !important;
}

/* Bottom Controls */
.epaper-bottom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.epaper-viewer-wrapper:hover .epaper-bottom-controls {
    opacity: 1;
}

.epaper-bottom-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.epaper-nav-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.epaper-nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.epaper-nav-btn:active {
    transform: scale(0.95);
}

.epaper-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.epaper-nav-btn span {
    font-weight: bold;
    line-height: 1;
}

.epaper-page-indicator {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    min-width: 60px;
    text-align: center;
}

.epaper-current-page {
    font-weight: bold;
}

/* Content Area */
.epaper-viewer-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: #f8f9fa;
    overflow: auto;
    padding-bottom: 70px; /* Space for bottom controls */
}

.epaper-canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: #fff;
}

/* Loading State */
.epaper-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6c757d;
}

.epaper-loading p {
    margin: 10px 0 0 0;
    font-size: 14px;
}

.epaper-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: epaperSpin 1s linear infinite;
}

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

/* Error State */
.epaper-error {
    text-align: center;
    padding: 40px 20px;
    color: #dc3545;
}

.epaper-error button {
    margin-top: 15px;
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.epaper-error button:hover {
    background: #c82333;
}

/* Fallback for no JavaScript */
.epaper-fallback {
    text-align: center;
    padding: 40px 20px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    color: #856404;
}

.epaper-fallback a {
    color: #0073aa;
    text-decoration: none;
}

.epaper-fallback a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .epaper-bottom-controls {
        padding: 12px 15px;
    }
    
    .epaper-bottom-nav {
        gap: 15px;
    }
    
    .epaper-nav-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .epaper-page-indicator {
        font-size: 13px;
        min-width: 50px;
    }
    
    .epaper-viewer-content {
        padding-bottom: 60px;
    }
    
    .epaper-link {
        font-size: 14px;
        padding: 6px 12px;
    }
}

@media screen and (max-width: 480px) {
    .epaper-bottom-controls {
        padding: 10px 12px;
    }
    
    .epaper-bottom-nav {
        gap: 12px;
    }
    
    .epaper-nav-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .epaper-page-indicator {
        font-size: 12px;
        min-width: 45px;
    }
    
    .epaper-viewer-content {
        padding-bottom: 55px;
        min-height: 300px;
    }
    
    .epaper-link {
        font-size: 13px;
        padding: 5px 10px;
    }
}

/* Print Styles */
@media print {
    .epaper-bottom-controls {
        display: none;
    }
    
    .epaper-viewer-wrapper {
        border: none;
        box-shadow: none;
    }
    
    .epaper-viewer-content {
        background: #fff;
        padding-bottom: 0;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .epaper-viewer-wrapper {
        border-width: 2px;
        border-color: #000;
    }
    
    .epaper-nav-btn {
        border: 2px solid #000;
    }
    
    .epaper-nav-btn:hover:not(:disabled) {
        background: #000;
        color: #fff;
    }
    
    .epaper-link {
        border: 2px solid #fff;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .epaper-viewer-wrapper {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .epaper-viewer-content {
        background: #1a202c;
    }
    
    .epaper-loading {
        color: #a0aec0;
    }
    
    .epaper-spinner {
        border-color: #4a5568;
        border-top-color: #63b3ed;
    }
}

/* Accessibility Improvements */
.epaper-nav-btn:focus,
.epaper-link:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Smooth transitions */
.epaper-canvas {
    transition: transform 0.3s ease;
}

.epaper-nav-btn {
    transition: all 0.15s ease;
}

/* Webkit scrollbar styling */
.epaper-viewer-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.epaper-viewer-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.epaper-viewer-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.epaper-viewer-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Page fade effect */
.epaper-canvas.loading {
    opacity: 0.7;
    filter: blur(1px);
}

.epaper-canvas.loaded {
    opacity: 1;
    filter: none;
}

/* Tooltip styles for buttons */
.epaper-nav-btn[title] {
    position: relative;
}

.epaper-nav-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

.epaper-nav-btn[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #333;
    z-index: 1000;
    margin-bottom: 1px;
}