/* PDF Viewer Styles - Optimizado para Chrome, Edge y móviles */

.pdf-container {
    margin: 2rem 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.pdf-header {
    background: #f8f9fa;
    padding: 1rem;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.pdf-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

.pdf-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

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

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

.pdf-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
    text-align: center;
    background: #f8f9fa;
}

.pdf-fallback p {
    margin-bottom: 1rem;
    color: #856404;
}

/* Mobile PDF.js viewer */
.pdf-viewer-container {
    background: #fff;
}

.pdf-controls {
    background: #f8f9fa;
    padding: 1rem;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.pdf-navigation,
.pdf-zoom {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.control-btn:hover:not(:disabled) {
    background: #0056b3;
}

.control-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.page-info {
    padding: 0.5rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 120px;
    text-align: center;
}

.pdf-canvas-wrapper {
    background: #525659;
    min-height: 500px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1rem;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.pdf-canvas-wrapper canvas {
    display: block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    background: white;
}

/* Loading indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: white;
}

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

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

/* Error message */
.pdf-error {
    padding: 2rem;
    text-align: center;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    margin: 1rem;
}

.pdf-error i {
    font-size: 2rem;
    color: #856404;
    margin-bottom: 1rem;
}

.error-details {
    color: #856404;
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

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

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

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

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

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

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

/* Alert */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}

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

/* Responsive */
@media (max-width: 768px) {
    .pdf-header {
        flex-direction: column;
        align-items: stretch;
    }

    .pdf-actions {
        width: 100%;
        justify-content: stretch;
    }

    .pdf-actions .btn {
        flex: 1;
        justify-content: center;
    }

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

    .pdf-controls {
        flex-direction: column;
    }

    .pdf-navigation,
    .pdf-zoom {
        width: 100%;
        justify-content: center;
    }

    .control-btn {
        flex: 1;
    }
}
