/* Estilos generales del visor de PDFs */
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    color: #333;
    margin-bottom: 30px;
    font-size: 2rem;
}

/* Contenedor de cada PDF */
.pdf-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    overflow: hidden;
}

/* Encabezado del PDF */
.pdf-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.pdf-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.25rem;
    flex: 1;
    min-width: 200px;
}

.pdf-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Botones */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-control {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
}

.btn-control:hover {
    background-color: #0056b3;
}

/* Vista Desktop - iframe */
.desktop-pdf-view {
    position: relative;
    width: 100%;
    height: 800px;
    background: #525659;
}

.pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Vista Móvil - PDF.js */
.mobile-pdf-viewer {
    display: flex;
    flex-direction: column;
    background: #525659;
}

.pdf-canvas-wrapper {
    width: 100%;
    overflow: auto;
    background: #525659;
    min-height: 400px;
    max-height: 80vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

.pdf-canvas-container {
    width: 100%;
    overflow: auto;
    background: #525659;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 400px;
    max-height: 80vh;
    padding: 10px;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch; /* Scroll suave en iOS */
}

.pdf-canvas-container canvas {
    max-width: 100%;
    height: auto !important;
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Indicador de carga */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: white;
    font-size: 16px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
.pdf-controls {
    background: #f8f9fa;
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    border-top: 1px solid #dee2e6;
}

.pdf-controls span {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

/* Fallback cuando falla la carga */
.pdf-fallback, .pdf-error {
    padding: 40px;
    text-align: center;
    background: white;
}

.pdf-fallback p, .pdf-error p {
    margin-bottom: 20px;
    color: #666;
    font-size: 16px;
}

/* Alerta de advertencia */
.alert {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-warning {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }

    .pdf-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px 15px;
    }

    .pdf-header h3 {
        font-size: 1rem;
        margin-bottom: 10px;
    }

    .pdf-actions {
        width: 100%;
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
        font-size: 14px;
        padding: 10px;
    }

    .desktop-pdf-view {
        height: 600px;
    }

    .pdf-canvas-wrapper {
        min-height: 300px;
        max-height: 70vh;
    }

    .pdf-canvas-container {
        min-height: 300px;
        max-height: 70vh;
        padding: 5px;
    }

    .pdf-controls {
        padding: 10px;
        gap: 10px;
        flex-wrap: wrap;
    }

    .pdf-navigation {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 8px;
    }

    .pdf-zoom {
        width: 100%;
        justify-content: center;
        gap: 15px;
    }

    .control-btn {
        padding: 8px 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    .page-info {
        font-size: 13px;
    }

    /* Asegurar que el canvas nunca se salga */
    .pdf-canvas-container canvas {
        max-width: calc(100vw - 30px) !important;
        width: auto !important;
        height: auto !important;
    }
}