/* ========================================
   SISTEMA DE DOCUMENTOS DNPI - ESTILOS
   Diseño Gubernamental Profesional
   ======================================== */

/* === RESET Y VARIABLES === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-primary: #193cb8;
    --color-primary-dark: #0f2a8a;
    --color-primary-light: #2d4fc9;
    --color-text: #000000;
    --color-text-secondary: #333333;
    --color-text-light: #666666;
    --color-background: #ffffff;
    --color-background-light: #f8f9fa;
    --color-border: #e0e0e0;
    --color-border-light: #f0f0f0;
    --color-success: #28a745;
    --color-warning: #ffc107;
    --color-error: #dc3545;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* === ESTILOS GENERALES === */
body {
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--color-background-light);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === BARRA SUPERIOR GUBERNAMENTAL === */
.gov-bar {
    background-color: var(--color-background);
    color: var(--color-primary);
    padding: 12px 0;
    box-shadow: var(--shadow-md);
    border-bottom: 10px solid var(--color-primary);
}

.gov-bar-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.gov-logo {
    height: 70px;
    width: auto;
}

.gov-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gov-entity {
    font-size: 1.1em;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.gov-ministry {
    font-size: 0.85em;
    font-weight: 300;
    opacity: 0.95;
}

/* === CONTENEDOR PRINCIPAL === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
    flex: 1;
}

/* === HEADER INSTITUCIONAL === */
.institutional-header {
    background: var(--color-background);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
    overflow: hidden;
    border-top: 4px solid var(--color-primary);
}

.header-main {
    padding: 30px;
    background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
}

.header-title h1 {
    color: var(--color-primary);
    font-size: 2.2em;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.header-subtitle {
    color: var(--color-text-light);
    font-size: 1.1em;
    font-weight: 400;
}

.header-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px 30px;
    background-color: var(--color-background-light);
    border-top: 1px solid var(--color-border-light);
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-secondary);
    font-size: 0.95em;
}

.contact-icon {
    font-size: 1.2em;
}

.contact-item a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.contact-item a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* === SECCIÓN DE FILTROS === */
.filters-section {
    background: var(--color-background);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
    overflow: hidden;
    border-left: 4px solid var(--color-primary);
}

.section-header {
    padding: 25px 30px 15px 30px;
    border-bottom: 2px solid var(--color-border-light);
}

.section-header h2 {
    color: var(--color-primary);
    font-size: 1.6em;
    font-weight: 600;
    margin-bottom: 8px;
}

.section-description {
    color: var(--color-text-light);
    font-size: 0.95em;
    line-height: 1.5;
}

.filters-container {
    padding: 25px 30px;
}

.date-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.date-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.date-input-group label {
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: 0.95em;
}

.date-input {
    padding: 12px 15px;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    font-size: 1em;
    font-family: 'Roboto', sans-serif;
    transition: all 0.3s;
    background-color: var(--color-background);
    color: var(--color-text);
}

.date-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(25, 60, 184, 0.1);
}

.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

/* === BOTONES === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-icon {
    font-size: 1.1em;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

/* === INFORMACIÓN DE RESULTADOS === */
.results-info {
    padding: 15px 30px;
    background-color: var(--color-background-light);
    border-top: 1px solid var(--color-border-light);
    color: var(--color-text-secondary);
    font-size: 0.95em;
}

/* === SECCIÓN DE DOCUMENTOS === */
.documents-section {
    background: var(--color-background);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    min-height: 400px;
    overflow: hidden;
    border-left: 4px solid var(--color-primary);
}

.documents-list {
    padding: 20px;
    display: grid;
    gap: 20px;
}

/* === GRUPO DE FECHA === */
.date-group {
    border: 2px solid var(--color-border-light);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
    background: var(--color-background);
}

.date-group:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.date-header {
    background-color: var(--color-primary);
    color: white;
    padding: 10px 10px;
    font-weight: 600;
    font-size: 1.15em;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: 0.3px;
}

.date-header::before {
    content: "📅";
    font-size: 1.3em;
}

.files-list {
    padding: 20px 25px;
    background-color: var(--color-background-light);
}

/* === ITEM DE ARCHIVO === */
.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 10px;
    margin-bottom: 12px;
    background: var(--color-background);
    border-radius: 6px;
    border: 1px solid var(--color-border);
    transition: all 0.3s;
}

.file-item:last-child {
    margin-bottom: 0;
}

.file-item:hover {
    border-color: var(--color-primary);
    transform: translateX(5px);
    box-shadow: var(--shadow-sm);
}

.file-name {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--color-text);
    font-weight: 500;
    flex: 1;
}

.file-name::before {
    content: "📦";
    font-size: 1.4em;
}

.download-btn {
    padding: 10px 25px;
    background-color: var(--color-primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95em;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.download-btn::before {
    content: "⬇️";
}

.download-btn:hover {
    background-color: var(--color-primary-dark);
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* === MENSAJES === */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-light);
}

.no-results-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-results-title {
    font-size: 1.4em;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 10px;
}

.no-results-text {
    font-size: 1em;
    line-height: 1.6;
}

.loading-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-primary);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid var(--color-border-light);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-message p {
    font-size: 1.2em;
    font-weight: 500;
}

/* === FOOTER INSTITUCIONAL === */
.institutional-footer {
    background-color: var(--color-primary);
    color: white;
    margin-top: 50px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.footer-section h3 {
    font-size: 1.2em;
    font-weight: 700;
    margin-bottom: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 10px;
}

.footer-section p {
    margin-bottom: 8px;
    font-size: 0.95em;
    opacity: 0.95;
    line-height: 1.6;
}

.footer-section a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.footer-section a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.footer-bottom {
    background-color: var(--color-primary-dark);
    padding: 20px;
    text-align: center;
    font-size: 0.9em;
    opacity: 0.9;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .gov-bar-content {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .gov-logo {
        height: 40px;
    }

    .gov-entity {
        font-size: 1em;
    }

    .header-title h1 {
        font-size: 1.6em;
    }

    .header-contact {
        flex-direction: column;
        gap: 12px;
    }

    .date-filters {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .download-btn {
        width: 100%;
        justify-content: center;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 25px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px 15px;
    }

    .header-main,
    .header-contact,
    .filters-container,
    .results-info,
    .documents-list,
    .files-list {
        padding: 20px 15px;
    }

    .section-header {
        padding: 20px 15px 10px;
    }
}

/* === ACCESIBILIDAD === */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* === IMPRESIÓN === */
@media print {
    .gov-bar,
    .filters-section,
    .institutional-footer {
        display: none;
    }

    .date-group {
        page-break-inside: avoid;
    }
}


/* === PAGINACIÓN === */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 30px 20px;
    border-top: 2px solid var(--color-border-light);
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 10px 20px;
    background-color: var(--color-background);
    color: var(--color-text-secondary);
    border: 2px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Roboto', sans-serif;
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

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

.page-numbers {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
}

.page-number {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    background-color: var(--color-background);
    color: var(--color-text-secondary);
    border: 2px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.page-number:hover {
    background-color: var(--color-primary-light);
    color: white;
    border-color: var(--color-primary-light);
}

.page-number.active {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    cursor: default;
}

.page-ellipsis {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-light);
    font-weight: 600;
}

/* Responsive para paginación */
@media (max-width: 768px) {
    .pagination-controls {
        gap: 8px;
        padding: 20px 15px;
    }

    .pagination-btn {
        padding: 8px 15px;
        font-size: 0.9em;
    }

    .page-number {
        min-width: 35px;
        height: 35px;
        font-size: 0.9em;
    }

    /* Ocultar texto en botones en móvil */
    .pagination-btn {
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .pagination-controls {
        gap: 5px;
    }

    .pagination-btn {
        padding: 8px 10px;
        font-size: 0.85em;
    }

    .page-number {
        min-width: 32px;
        height: 32px;
        padding: 0 8px;
    }
}





/* === ALTCHA ESTILOS === */
#altchaContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Estilo para botón de descarga en proceso */
.download-btn[disabled] {
    opacity: 0.6;
    cursor: wait;
    pointer-events: none;
}


/* === BOTONES DE DESCARGA MEJORADOS === */
.download-btn {
    border: none;
    transition: all 0.3s ease;
}

.download-btn:disabled {
    transform: scale(0.98);
}

.download-btn:not(:disabled):active {
    transform: scale(0.95);
}