/* ==========================================================================
   ESTILOS DE CUMPLIMIENTO LEGAL Y LECTOR DE REVISTA PDF (dian.css)
   ========================================================================== */

/* Main layout */
.dian-main {
    padding-top: calc(var(--header-height) + 40px);
    padding-bottom: 80px;
    background-color: var(--bg-light);
}

.dian-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 48px auto;
}

.dian-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--primary-light-bg);
    color: var(--primary);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 16px;
    font-family: var(--font-heading);
}

.dian-title {
    font-size: 2.75rem;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.dian-description {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 20px;
}

.dian-period-badge {
    display: inline-block;
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-main);
}

.dian-period-badge i {
    color: var(--accent);
}

/* ==========================================================================
   GRILLA DE TARJETAS DE DOCUMENTOS
   ========================================================================== */

.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 24px;
    margin-bottom: 60px;
}

.doc-card {
    background-color: var(--bg-white);
    border-radius: var(--border-radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(226, 232, 240, 0.7);
    display: flex;
    flex-direction: column;
    gap: 16px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.doc-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: transparent;
    transition: var(--transition);
}

.doc-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: rgba(30, 58, 138, 0.15);
}

.doc-card:hover::after {
    background-color: var(--accent);
}

/* Estado activo/leído actual de la tarjeta */
.doc-card.active-card {
    border-color: var(--primary);
    background-color: var(--primary-light-bg);
}

.doc-card.active-card::after {
    background-color: var(--primary);
}

.doc-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    background-color: var(--primary-light-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    transition: var(--transition);
}

.doc-card.active-card .doc-card-icon {
    background-color: var(--primary);
    color: var(--bg-white);
}

/* Resaltar Estados Financieros */
.doc-card-icon.highlight-card {
    background-color: rgba(217, 119, 6, 0.1);
    color: var(--accent);
}

.doc-card-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.doc-card-num {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.doc-card-title {
    font-size: 1.05rem;
    color: var(--primary);
    margin-bottom: 8px;
    font-weight: 700;
    line-height: 1.3;
}

.doc-card-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    flex-grow: 1;
    line-height: 1.5;
}

.doc-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 12px;
    font-size: 0.8rem;
}

.doc-action {
    color: var(--accent);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.doc-size {
    color: var(--text-light);
    font-weight: 500;
}

/* ==========================================================================
   SECCIÓN DEL VISOR DE REVISTA (FLIPBOOK)
   ========================================================================== */

.viewer-section {
    background-color: #1e293b; /* slate-800 - Fondo oscuro para el lector */
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin-bottom: 40px;
    border: 1px solid #334155;
    display: none; /* Comienza oculto, se muestra al abrir un doc */
    animation: fadeIn 0.4s ease-out;
}

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

/* Encabezado del visor */
.viewer-header {
    background-color: #0f172a; /* slate-900 */
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1e293b;
}

.viewer-doc-info {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #f8fafc;
}

.viewer-doc-info i {
    font-size: 1.6rem;
    color: var(--accent);
}

.viewer-doc-subtitle {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.viewer-doc-title {
    font-size: 1.15rem;
    color: #ffffff;
    font-weight: 600;
    margin: 0;
}

.viewer-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    padding: 4px;
}

.viewer-close-btn:hover {
    color: #ffffff;
    transform: scale(1.1);
}

/* Contenedor del Libro Abierto */
.book-container {
    padding: 40px 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
    position: relative;
    background-color: #0f172a; /* color oscuro de fondo */
    overflow-x: auto;
}

/* Overlay de carga y progreso */
.loading-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.95);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #f8fafc;
    gap: 16px;
}

.loading-spinner {
    font-size: 2.5rem;
    color: var(--accent);
}

.loading-text {
    font-size: 1rem;
    font-weight: 500;
}

.progress-bar-container {
    width: 250px;
    height: 8px;
    background-color: #334155;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--accent);
    color: white;
    font-size: 8px;
    text-align: center;
    line-height: 8px;
    transition: width 0.1s ease;
}

/* El cuerpo del libro */
.book-body {
    display: flex;
    justify-content: center;
    align-items: stretch;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    background-color: #1e293b;
    perspective: 1200px; /* Habilita efectos 3D */
    max-width: 100%;
    transition: var(--transition);
}

/* Sombra central del lomo del libro */
.book-body::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 100%;
    background: linear-gradient(to right, 
        rgba(0,0,0,0.2) 0%, 
        rgba(0,0,0,0.5) 45%, 
        rgba(0,0,0,0.6) 50%, 
        rgba(0,0,0,0.5) 55%, 
        rgba(0,0,0,0.2) 100%);
    z-index: 10;
    pointer-events: none;
}

/* Para vista de una sola página (móvil) quitamos la sombra del lomo */
.book-body.single-page-view::after {
    display: none;
}

/* Estilo de las páginas de revista */
.book-page {
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
    user-select: none;
}

/* Sombras en las páginas simulando curvatura */
.left-page {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    border-right: 1px solid rgba(0,0,0,0.1);
    box-shadow: inset -10px 0 20px rgba(0, 0, 0, 0.05);
}

.right-page {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    border-left: 1px solid rgba(0,0,0,0.1);
    box-shadow: inset 10px 0 20px rgba(0, 0, 0, 0.05);
}

/* El elemento canvas dentro de la página */
.book-page canvas {
    max-width: 100%;
    height: auto !important;
    display: block;
}

/* Animaciones de paso de página (clases dinámicas) */
.page-flip-left {
    transform-origin: right center;
    transform: rotateY(-180deg);
    opacity: 0;
    z-index: 15;
}

.page-flip-right {
    transform-origin: left center;
    transform: rotateY(180deg);
    opacity: 0;
    z-index: 15;
}

/* ==========================================================================
   BARRA DE HERRAMIENTAS DEL VISOR (TOOLBAR)
   ========================================================================== */

.viewer-toolbar {
    background-color: #0f172a;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    border-top: 1px solid #1e293b;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-btn {
    background-color: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tool-btn:hover:not(:disabled) {
    background-color: #334155;
    color: #ffffff;
    border-color: #475569;
}

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

.page-indicator {
    color: #cbd5e1;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-indicator input {
    background-color: #1e293b;
    border: 1px solid #334155;
    color: white;
    padding: 4px;
    border-radius: 4px;
    outline: none;
    font-weight: 600;
}

.zoom-value {
    color: #cbd5e1;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 48px;
    text-align: center;
}

.download-btn {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
}

.download-btn:hover {
    background-color: var(--accent-hover) !important;
    border-color: var(--accent-hover) !important;
    color: white !important;
}

/* ==========================================================================
   BLOQUE INFORMATIVO EXTRA
   ========================================================================== */

.dian-info-block {
    background-color: var(--bg-white);
    border-radius: var(--border-radius-md);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(226, 232, 240, 0.7);
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-top: 40px;
}

.info-icon-large {
    font-size: 2.25rem;
    color: var(--primary);
    flex-shrink: 0;
}

.info-content-text h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--primary);
}

.info-content-text p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ==========================================================================
   MEDIA QUERIES VISOR
   ========================================================================== */

/* Responsivo para el visor a pantalla completa */
.viewer-section.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    border-radius: 0;
    border: none;
}

.viewer-section.fullscreen-mode .book-container {
    height: calc(100vh - 140px); /* Restar header y toolbar */
}

@media (max-width: 900px) {
    /* Ocultar segunda página (modo simple) */
    .book-body.single-page-view .right-page {
        display: none !important;
    }
    
    .book-body.single-page-view .left-page {
        border-radius: 4px;
    }
}

@media (max-width: 768px) {
    .dian-title {
        font-size: 2.25rem;
    }
    
    .viewer-toolbar {
        justify-content: center;
    }
    
    .book-container {
        padding: 24px 12px;
    }
}

@media (max-width: 480px) {
    .dian-title {
        font-size: 1.85rem;
    }
    
    .tool-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .page-indicator {
        font-size: 0.8rem;
    }
}
