/* ==========================================================================
   PORTAL DE TRANSPARENCIA - SISTEMA DE DISEÑO INSTITUCIONAL Y FORMAL
   H. Ayuntamiento de Chicoasén, Chiapas
   ========================================================================== */

:root {
    --brand-dark: #0b1528;
    --brand-primary: #1e3b70;
    --brand-primary-dark: #112347;
    --brand-medium: #254a8e;
    --brand-light: #2e5296;
    --brand-teal: #0284c7;
    --brand-teal-light: #e0f2fe;
    --brand-teal-dark: #0369a1;
    --brand-accent: #c5a059;
    --brand-accent-hover: #b08d44;
    --brand-accent-light: #fef9ee;
    --brand-magenta: #9d174d;

    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #fcfefe;

    --text-heading: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --border-subtle: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-accent: rgba(197, 160, 89, 0.35);
    --border-teal: rgba(2, 132, 199, 0.25);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(17, 35, 71, 0.07), 0 2px 4px -2px rgba(17, 35, 71, 0.04);
    --shadow-lg: 0 10px 20px -3px rgba(17, 35, 71, 0.10), 0 4px 8px -4px rgba(17, 35, 71, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(17, 35, 71, 0.12), 0 8px 10px -6px rgba(17, 35, 71, 0.05);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
}

body {
    background-color: var(--bg-page);
    color: var(--text-body);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   1. HERO BANNER INSTITUCIONAL
   ========================================================================== */
.transparency-hero {
    position: relative;
    background: linear-gradient(135deg, #0b1528 0%, #112347 35%, #1e3b70 70%, #254a8e 100%);
    color: #ffffff;
    padding: 60px 20px 50px;
    overflow: hidden;
    box-shadow: 0 12px 35px rgba(11, 21, 40, 0.25);
}

.transparency-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 12% 25%, rgba(2, 132, 199, 0.22) 0%, transparent 45%),
        radial-gradient(circle at 88% 75%, rgba(197, 160, 89, 0.18) 0%, transparent 50%),
        radial-gradient(circle at 50% 10%, rgba(157, 23, 77, 0.12) 0%, transparent 40%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.035'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.hero-inner {
    max-width: 1240px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(2, 132, 199, 0.2);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(14, 165, 233, 0.35);
    padding: 6px 18px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: #7dd3fc;
    text-transform: uppercase;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.15);
    animation: fadeInDown 0.6s ease forwards;
}

.hero-title {
    font-size: 2.75rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    color: #ffffff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.hero-title span {
    background: linear-gradient(135deg, #7dd3fc 0%, #ffffff 50%, #fde047 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    max-width: 820px;
    margin: 0 auto 35px;
    font-size: 1.08rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}

/* Tarjetas rápidas de indicadores en el Hero */
.hero-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 960px;
    margin: 0 auto -20px;
}

.hero-stat-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    transition: all 0.3s ease;
}

.hero-stat-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    border-color: #38bdf8;
    box-shadow: 0 8px 20px rgba(2, 132, 199, 0.2);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.35) 0%, rgba(30, 59, 112, 0.4) 100%);
    border: 1px solid rgba(56, 189, 248, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7dd3fc;
    font-size: 18px;
    flex-shrink: 0;
}

.stat-info h4 {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.stat-info p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.78);
    margin: 2px 0 0;
}

/* ==========================================================================
   2. CONTENEDOR PRINCIPAL Y LAYOUT
   ========================================================================== */
.portal-main-wrapper {
    max-width: 1260px;
    margin: 45px auto 60px;
    padding: 0 20px;
}

.portal-layout {
    display: grid;
    grid-template-columns: 310px 1fr;
    gap: 30px;
    align-items: start;
}

/* ==========================================================================
   3. SIDEBAR DE NAVEGACIÓN
   ========================================================================== */
.sidebar-sticky {
    position: sticky;
    top: 90px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-nav-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 22px 14px;
    border-bottom: 1px solid var(--border-subtle);
    background: #f8fafc;
}

.sidebar-header h3 {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--brand-primary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.sidebar-nav-list {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-tab-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-body);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    border: 1px solid transparent;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.tab-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.tab-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f1f5f9;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.tab-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-count-badge {
    font-size: 11px;
    font-weight: 700;
    background: #f1f5f9;
    color: var(--text-muted);
    padding: 3px 8px;
    border-radius: 20px;
    transition: all 0.2s ease;
}

.nav-tab-item:hover {
    background: #f0f7ff;
    color: var(--brand-primary);
    border-color: #bfdbfe;
    transform: translateX(3px);
}

.nav-tab-item:hover .tab-icon {
    background: #dbeafe;
    color: var(--brand-teal-dark);
}

.nav-tab-item.active {
    background: linear-gradient(135deg, #112347 0%, #1e3b70 50%, #0369a1 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(30, 59, 112, 0.3);
    border-color: var(--brand-primary);
}

.nav-tab-item.active .tab-icon {
    background: rgba(255, 255, 255, 0.2);
    color: #7dd3fc;
}

.nav-tab-item.active .tab-count-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* Tarjeta lateral de atención ciudadana */
.sidebar-help-card {
    background: linear-gradient(145deg, #eff6ff 0%, #e0f2fe 100%);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-lg);
    padding: 20px;
    color: #0c4a6e;
    font-size: 13px;
    line-height: 1.5;
}

.sidebar-help-card h4 {
    font-size: 14px;
    font-weight: 700;
    color: #075985;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.sidebar-help-card p {
    color: #0369a1;
    margin-bottom: 12px;
}

.help-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #0284c7 0%, #1e3b70 100%);
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.help-link-btn:hover {
    background: linear-gradient(135deg, #0369a1 0%, #112347 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.35);
    color: #ffffff;
}

/* ==========================================================================
   4. PANEL DE CONTENIDO Y DOCUMENTOS
   ========================================================================== */
.content-main-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-md);
    padding: 30px;
    min-height: 520px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.tab-pane.active {
    display: block;
}

/* Encabezado de la pestaña activa con Buscador */
.tab-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 25px;
    border-bottom: 1.5px solid var(--border-subtle);
    flex-wrap: wrap;
    gap: 16px;
}

.tab-title-group h2 {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text-heading);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.tab-title-group h2 i {
    color: var(--brand-teal);
}

.tab-title-group p {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Barra de Búsqueda Interactiva */
.search-filter-box {
    position: relative;
    width: 290px;
    max-width: 100%;
}

.search-input-field {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    background: #f8fafc;
    color: var(--text-heading);
    outline: none;
    transition: all 0.2s ease;
}

.search-input-field:focus {
    background: #ffffff;
    border-color: var(--brand-teal);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.search-field-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

/* ==========================================================================
   5. TARJETAS DE DOCUMENTOS (DOCUMENT CARDS)
   ========================================================================== */
.documents-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.document-card {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.document-card:hover {
    border-color: #93c5fd;
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(17, 35, 71, 0.08);
}

.doc-info-side {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    flex-grow: 1;
}

.doc-pdf-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: #fee2e2;
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.document-card:hover .doc-pdf-icon {
    background: #dc2626;
    color: #ffffff;
    transform: scale(1.05);
}

.doc-details {
    min-width: 0;
}

.doc-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-heading);
    text-decoration: none;
    line-height: 1.4;
    display: block;
    transition: color 0.2s ease;
}

.doc-title:hover {
    color: var(--brand-primary);
}

.doc-meta-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
    flex-wrap: wrap;
}

.meta-pill {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.meta-year {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.meta-format {
    background: #f1f5f9;
    color: var(--text-muted);
}

/* Botones de acción */
.doc-actions-side {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-view-pdf {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: var(--brand-primary);
    padding: 9px 15px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-view-pdf:hover {
    background: var(--brand-primary);
    color: #ffffff;
    border-color: var(--brand-primary);
    transform: translateY(-1px);
}

.btn-download-pdf {
    background: linear-gradient(135deg, #0284c7 0%, #1e3b70 100%);
    border: 1px solid var(--brand-teal-dark);
    color: #ffffff;
    padding: 9px 15px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.btn-download-pdf:hover {
    background: linear-gradient(135deg, #0369a1 0%, #112347 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
    color: #ffffff;
}

/* Estado Vacío (Empty State) */
.empty-state-box {
    text-align: center;
    padding: 60px 20px;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    margin: 20px 0;
}

.empty-icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #e2e8f0;
    color: var(--text-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 14px;
}

.empty-state-box h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 6px;
}

.empty-state-box p {
    font-size: 13.5px;
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto;
}

/* ==========================================================================
   6. VISOR DE PDF INTEGRADO
   ========================================================================== */
.pdf-viewer-card {
    background: #ffffff;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    margin-top: 30px;
    display: none;
    animation: slideUp 0.35s ease forwards;
}

.viewer-header {
    background: #0f172a;
    color: #ffffff;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.viewer-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.viewer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.viewer-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s ease;
}

.viewer-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

.viewer-btn-close {
    background: #ef4444;
}

.viewer-btn-close:hover {
    background: #dc2626;
}

.pdf-iframe-element {
    width: 100%;
    height: 700px;
    border: none;
    display: block;
    background: #334155;
}

/* ==========================================================================
   7. SECCIÓN DE ÓRGANOS GARANTES Y TRANSPARENCIA (PNT / SIPOT / ITAIP)
   ========================================================================== */
.guarantor-section {
    background: #ffffff;
    border-top: 1px solid var(--border-subtle);
    padding: 60px 20px 70px;
    margin-top: 50px;
}

.guarantor-inner {
    max-width: 1240px;
    margin: 0 auto;
    text-align: center;
}

.guarantor-header {
    margin-bottom: 40px;
}

.guarantor-header h3 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--brand-primary-dark);
    letter-spacing: -0.01em;
}

.guarantor-header p {
    font-size: 14.5px;
    color: var(--text-muted);
    max-width: 650px;
    margin: 8px auto 0;
}

.guarantor-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.guarantor-card {
    background: #f8fafc;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 30px 24px;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.guarantor-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3.5px;
    background: linear-gradient(90deg, #1e3b70 0%, #0284c7 50%, #c5a059 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.guarantor-card:hover {
    background: #ffffff;
    border-color: #93c5fd;
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.guarantor-card:hover::after {
    opacity: 1;
}

.guarantor-logo-wrapper {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}

.guarantor-logo {
    max-height: 70px;
    max-width: 220px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.guarantor-card:hover .guarantor-logo {
    transform: scale(1.06);
}

.guarantor-badge-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: linear-gradient(135deg, #112347 0%, #1e3b70 50%, #0284c7 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(17, 35, 71, 0.25);
    transition: all 0.3s ease;
}

.guarantor-badge-fallback i {
    font-size: 24px;
    color: #7dd3fc;
}

.guarantor-badge-fallback span {
    font-size: 10.5px !important;
    font-weight: 800 !important;
    letter-spacing: 0.6px;
    color: #ffffff !important;
    text-transform: uppercase;
}

.guarantor-card:hover .guarantor-badge-fallback {
    transform: scale(1.1);
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.35);
}

.guarantor-card h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 6px;
}

.guarantor-card span {
    font-size: 12.5px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.guarantor-card:hover span {
    color: var(--brand-primary);
    font-weight: 600;
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

/* ==========================================================================
   8. RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 1024px) {
    .portal-layout {
        grid-template-columns: 1fr;
    }

    .sidebar-sticky {
        position: static;
    }

    .sidebar-nav-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 6px;
    }

    .hero-stats-grid {
        grid-template-columns: 1fr;
        max-width: 450px;
    }

    .guarantor-cards-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
    }
}

@media (max-width: 640px) {
    .transparency-hero {
        padding: 40px 16px 35px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .content-main-panel {
        padding: 20px 16px;
    }

    .document-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .doc-actions-side {
        width: 100%;
        justify-content: flex-end;
    }

    .sidebar-nav-list {
        grid-template-columns: 1fr;
    }

    .search-filter-box {
        width: 100%;
    }
}

