/* ==========================================================================
   ICATLAX - SIIF (Sistema Integral de Información Financiera)
   Design System & Styling
   ========================================================================== */

:root {
    --primary-wine: #831238;
    --primary-wine-dark: #5C0B26;
    --primary-wine-light: #9E1C48;
    --primary-wine-subtle: rgba(131, 18, 56, 0.06);
    --accent-gold: #C4A068;
    --accent-gold-dark: #A4814B;
    --accent-gold-light: #F4ECE1;
    --slate-900: #0F172A;
    --slate-800: #1E293B;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748B;
    --slate-400: #94A3B8;
    --slate-200: #E2E8F0;
    --slate-100: #F1F5F9;
    --bg-light: #F8FAFC;
    --white: #FFFFFF;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 14px rgba(131, 18, 56, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 12px 28px rgba(131, 18, 56, 0.15);

    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-light);
    color: var(--slate-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.siif-topbar {
    background: var(--primary-wine-dark);
    color: rgba(255, 255, 255, 0.85);
    padding: 8px 0;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.siif-topbar .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.siif-topbar-info {
    display: flex;
    gap: 20px;
}

.siif-topbar-info span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.siif-navbar {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid var(--accent-gold);
}

.siif-navbar .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo img {
    height: 52px;
    width: auto;
    object-fit: contain;
}

.brand-title {
    display: flex;
    flex-direction: column;
}

.brand-title .main-name {
    font-weight: 800;
    font-size: 1.35rem;
    color: var(--primary-wine);
    letter-spacing: 0.5px;
}

.brand-title .sub-name {
    font-size: 0.75rem;
    color: var(--accent-gold-dark);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.btn-institutional {
    background: linear-gradient(135deg, var(--primary-wine), var(--primary-wine-dark));
    color: var(--white);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
}

.btn-institutional:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, var(--primary-wine-light), var(--primary-wine));
}

.btn-outline-gold {
    background: transparent;
    color: var(--primary-wine);
    border: 1.5px solid var(--accent-gold);
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-outline-gold:hover {
    background: var(--accent-gold-light);
    color: var(--primary-wine-dark);
}

/* ==========================================================================
   Hero Header Section
   ========================================================================== */

.hero-banner {
    background: linear-gradient(135deg, var(--slate-900) 0%, var(--primary-wine-dark) 100%);
    color: var(--white);
    padding: 50px 0 60px 0;
    position: relative;
    overflow: hidden;
}

.hero-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(196, 160, 104, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

.hero-content {
    max-width: 800px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(196, 160, 104, 0.2);
    color: var(--accent-gold);
    border: 1px solid rgba(196, 160, 104, 0.4);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 14px;
    color: var(--white);
}

.hero-subtitle {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 28px;
}

/* Stats Cards */
.hero-stats {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    min-width: 150px;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent-gold);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   Main Content & Search Bar
   ========================================================================== */

.main-container {
    max-width: 1200px;
    margin: -30px auto 60px auto;
    padding: 0 20px;
    position: relative;
    z-index: 2;
}

.search-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 24px 30px;
    margin-bottom: 35px;
    border: 1px solid var(--slate-200);
}

.search-box-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 18px;
}

.search-icon {
    position: absolute;
    left: 18px;
    color: var(--slate-400);
    font-size: 1.2rem;
}

.search-input {
    width: 100%;
    padding: 14px 45px 14px 50px;
    font-size: 1rem;
    font-family: var(--font-main);
    border: 2px solid var(--slate-200);
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.25s ease;
    background: var(--bg-light);
}

.search-input:focus {
    border-color: var(--primary-wine);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(131, 18, 56, 0.1);
}

.search-clear {
    position: absolute;
    right: 18px;
    background: none;
    border: none;
    color: var(--slate-400);
    cursor: pointer;
    font-size: 1.1rem;
    display: none;
}

.search-clear:hover {
    color: var(--slate-700);
}

.year-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 6px;
}

.filter-pill {
    padding: 7px 16px;
    border-radius: 20px;
    background: var(--slate-100);
    color: var(--slate-600);
    font-size: 0.88rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-pill:hover {
    background: var(--slate-200);
    color: var(--slate-800);
}

.filter-pill.active {
    background: var(--primary-wine);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Accordion Structure (Years & Trimestres)
   ========================================================================== */

.year-accordion-item {
    background: var(--white);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.25s ease;
}

.year-accordion-item:hover {
    box-shadow: var(--shadow-md);
}

.year-header {
    background: var(--white);
    padding: 20px 26px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    border-left: 5px solid var(--primary-wine);
    transition: background 0.2s ease;
}

.year-header:hover {
    background: var(--primary-wine-subtle);
}

.year-title-box {
    display: flex;
    align-items: center;
    gap: 14px;
}

.year-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary-wine), var(--primary-wine-dark));
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
}

.year-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--slate-800);
}

.year-meta {
    display: flex;
    align-items: center;
    gap: 14px;
}

.doc-count-badge {
    background: var(--slate-100);
    color: var(--slate-600);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 600;
}

.chevron-icon {
    color: var(--slate-400);
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.year-accordion-item.active .chevron-icon {
    transform: rotate(180deg);
    color: var(--primary-wine);
}

.year-content {
    display: none;
    padding: 10px 26px 26px 26px;
    border-top: 1px solid var(--slate-200);
    background: #FAFCFE;
}

.year-accordion-item.active .year-content {
    display: block;
}

/* Trimestre Accordion */
.trimestre-accordion-item {
    background: var(--white);
    border-radius: var(--radius-sm);
    margin-top: 16px;
    border: 1px solid var(--slate-200);
    overflow: hidden;
}

.trimestre-header {
    padding: 14px 20px;
    background: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    border-left: 3.5px solid var(--accent-gold);
    transition: background 0.2s ease;
}

.trimestre-header:hover {
    background: var(--accent-gold-light);
}

.trimestre-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--slate-700);
    display: flex;
    align-items: center;
    gap: 10px;
}

.trimestre-content {
    display: none;
    padding: 16px 20px;
    border-top: 1px dashed var(--slate-200);
    background: var(--white);
}

.trimestre-accordion-item.active .trimestre-content {
    display: block;
}

.trimestre-accordion-item.active .chevron-icon {
    transform: rotate(180deg);
}

/* ==========================================================================
   Document Items Grid / List
   ========================================================================== */

.document-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
}

.doc-card {
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: all 0.25s ease;
    position: relative;
}

.doc-card:hover {
    border-color: var(--primary-wine-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.doc-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 8px;
    background: #FEE2E2;
    color: #DC2626;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.doc-info {
    flex: 1;
    min-width: 0;
}

.doc-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--slate-800);
    margin-bottom: 6px;
    line-height: 1.4;
    word-break: break-word;
}

.doc-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-wine-subtle);
    color: var(--primary-wine);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

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

/* ==========================================================================
   Admin Modal & Drawer
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    background: var(--primary-wine);
    color: var(--white);
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.2rem;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--white);
}

.modal-body {
    padding: 26px;
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--slate-700);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    font-size: 0.95rem;
    font-family: var(--font-main);
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary-wine);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.siif-footer {
    background: var(--slate-900);
    color: var(--slate-400);
    padding: 50px 0 20px 0;
    border-top: 4px solid var(--primary-wine);
}

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

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand h4 {
    color: var(--white);
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.footer-brand p {
    font-size: 0.88rem;
    line-height: 1.6;
}

.footer-links h5 {
    color: var(--accent-gold);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a:hover {
    color: var(--white);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    text-align: center;
    font-size: 0.82rem;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 768px) {
    .siif-topbar { display: none; }
    .hero-title { font-size: 1.6rem; }
    .hero-stats { flex-direction: column; gap: 10px; }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
    .document-list { grid-template-columns: 1fr; }
    .brand-title .sub-name { display: none; }
}
