/* ==========================================================================
   VARIABLES
   ========================================================================== */
:root {
    --gov-blue: #0b3b71;
    --gov-blue-hover: #002a5c;
    --gov-red: #e30613;
    --gov-cyan: #008c9e;
    --gov-dark: #1a1a1a;
    --gov-muted: #57606a;
    --gov-light-bg: #f4f6f8;

    --radius: 8px;
    --container-width: 1100px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--gov-light-bg);
    color: var(--gov-dark);
    line-height: 1.6;
}

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

img {
    max-width: 100%;
    display: block;
}

.container {
    width: min(100%, var(--container-width));
    margin-inline: auto;
    padding: 0 16px;
}

/* ==========================================================================
   HEADER Y BANNER (INTEGRADO DEL ARCHIVO ANTIGUO)
   ========================================================================== */
.govbar {
    background: var(--gov-blue);
    color: white;
    padding: 8px 0;
    font-size: 0.85rem;
}

.govbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header.site {
    background: white;
    box-shadow: var(--shadow-sm);
    position: relative;
}

/* Banner Responsive */
.nav-container {
    background-image: url('../img/cabecera.jpg');
    /* Asegúrate que la img esté en esta ruta */
    background-color: #0b3b71;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 15px;
    /* Padding móvil original */
    position: relative;
}

/* Overlay sutil para mejorar contraste */
.nav-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to right, rgba(11, 59, 113, 0.45), rgba(11, 59, 113, 0.3));
    pointer-events: none;
}

.site-top {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   NAVEGACIÓN (Extraído de styles-old.css)
   ========================================================================== */
nav.primary {
    margin-top: 0;
}

details.nav {
    border: 1px solid #e7eef6;
    background: white;
    border-radius: 12px;
    position: relative;
    /* Para dropdown */
    z-index: 100;
}

details.nav>summary {
    list-style: none;
    cursor: pointer;
    padding: 8px 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--gov-dark);
}

details.nav>summary::marker {
    display: none;
}

.hamb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #f0f5fb;
    font-size: 1.2rem;
}

.menu-label {
    font-size: 0.9rem;
}

/* Dropdown menu mobile */
.menu {
    display: grid;
    gap: 6px;
    padding: 6px 10px 12px;
    min-width: 200px;
}

.menu a {
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--gov-dark);
    font-weight: 600;
}

.menu a:hover {
    background: #f0f5fb;
    color: var(--gov-blue);
}

/* ==========================================================================
   MEDIA QUERIES (RESPONSIVENESS DEL BANNER)
   ========================================================================== */
@media (min-width: 900px) {

    /* 1. Padding del Banner aumenta en escritorio */
    .nav-container {
        padding: 70px;
    }

    /* 2. Transformación del menú hamburguesa a menú horizontal */
    details.nav {
        background: transparent;
        border: none;
        padding: 0;
    }

    details.nav>summary {
        display: none;
        /* Oculta botón menú */
    }

    /* Forzamos que el menú se muestre siempre en desktop sin necesidad de click */
    details.nav[open]>.menu,
    details.nav:not([open])>.menu {
        display: flex;
        /* Horizontal */
    }

    .menu {
        display: flex !important;
        flex-direction: row;
        gap: 8px;
        padding: 0;
        background: transparent;
    }

    .menu a {
        color: white;
        /* Texto blanco en el banner */
        background: rgba(255, 255, 255, 0.15);
        padding: 8px 16px;
        backdrop-filter: blur(4px);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .menu a:hover {
        background: white;
        color: var(--gov-blue);
    }
}

/* ==========================================================================
   SECCIÓN HERO (BENTO GRID)
   ========================================================================== */
.hero-section {
    padding: 40px 0 60px;
}

.section-title {
    margin-bottom: 24px;
}

.section-title h2 {
    font-size: 1.75rem;
    color: var(--gov-blue);
    margin: 0;
    letter-spacing: -0.5px;
}

.section-title p {
    color: var(--gov-muted);
    margin-top: 5px;
    font-size: 1.05rem;
}

.section-header-sub {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e1e4e8;
}

.section-header-sub h3 {
    margin: 0;
    color: var(--gov-blue);
    font-size: 1.3rem;
}

.bento-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    grid-auto-rows: minmax(100px, auto);
}

@media (min-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(auto-fit, minmax(140px, auto));
    }

    .span-2 {
        grid-column: span 2;
    }

    .row-2 {
        grid-row: span 2;
    }
}

/* TARJETAS PRINCIPALES */
.card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-icon {
    background: var(--gov-light-bg);
    padding: 10px;
    border-radius: 50%;
    color: var(--gov-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    margin-bottom: 12px;
}

.card-icon svg {
    width: 24px;
    height: 24px;
}

.tag {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.tag.blue {
    background: #e3f2fd;
    color: #1565c0;
}

.tag.red {
    background: #ffebee;
    color: #c62828;
}

.card h3 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    color: var(--gov-blue);
}

.card p {
    font-size: 0.9rem;
    color: var(--gov-muted);
    margin: 0;
    flex-grow: 1;
    line-height: 1.4;
}

.card-action {
    margin-top: 16px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gov-blue);
    display: flex;
    align-items: center;
    gap: 5px;
}

.card.hero {
    background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 100%);
    border-top: 4px solid var(--gov-blue);
}

.card.hero h3 {
    font-size: 1.5rem;
}

.btn-hero {
    background: var(--gov-blue);
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    width: fit-content;
    margin-top: 15px;
}

.card.standard {
    border-top: 4px solid var(--gov-red);
}

.card.mini {
    flex-direction: row;
    align-items: center;
    padding: 16px;
    gap: 16px;
    min-height: auto;
    border-left: 4px solid var(--gov-cyan);
}

.card.mini .card-icon {
    width: 40px;
    height: 40px;
    padding: 8px;
    margin: 0;
    background: transparent;
}

.card.mini .content {
    flex: 1;
}

.card.mini h3 {
    font-size: 0.95rem;
    margin: 0;
    color: var(--gov-dark);
}

.card.mini span {
    font-size: 0.8rem;
    color: var(--gov-muted);
    display: block;
}

/* ==========================================================================
   SECCIÓN DOCUMENTOS (LISTA DE ARCHIVOS)
   ========================================================================== */
.archive-section {}

.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 12px;
}

.doc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    padding-bottom: 20px;
    padding-top: 20px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    background: #fff;
    transition: all 0.2s;
}

.doc-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.doc-icon {
    color: var(--gov-red);
    flex-shrink: 0;
}

.doc-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gov-dark);
    line-height: 1.3;
}

.doc-download {
    margin-left: auto;
    color: var(--gov-muted);
    opacity: 0.6;
}

/* Subvenciones List Style */
.subv-list {
    display: grid;
    gap: 8px;
}

.subv-item {
    font-size: 0.9rem;
    padding: 8px 12px;
    background: #f4f6f8;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.subv-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.subv-item::before {
    content: "•";
    color: var(--gov-blue);
    font-weight: bold;
}

/* ==========================================================================
   LISTAS (TRANSPARENCIA)
   ========================================================================== */
.list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.list a {
    display: block;
    padding: 12px 16px;
    border: 1px solid #e1e4e8;
    border-radius: var(--radius);
    background: white;
    color: var(--gov-dark);
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.list a::after {
    content: "→";
    color: var(--gov-blue);
    font-weight: bold;
    opacity: 0.7;
    transition: transform 0.2s;
}

.list a:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.list a:hover::after {
    transform: translateX(4px);
    opacity: 1;
}

/* ==========================================================================
   OFICINAS DE PARTES
   ========================================================================== */
.parts-section {
    padding: 40px 0;
}

.parts-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}

@media(min-width: 768px) {
    .parts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.part-office-card {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    border-left: 4px solid var(--gov-blue);
    box-shadow: var(--shadow-sm);
}

.part-office-card h5 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: var(--gov-dark);
}

.part-office-card p {
    font-size: 0.9rem;
    color: var(--gov-muted);
    margin: 0;
    line-height: 1.5;
}

.part-office-card strong {
    color: var(--gov-blue);
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
}

.part-office-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}


/* FOOTER */
footer {
    background: var(--gov-dark);
    color: #cbd5e1;
    padding: 40px 0;
    margin-top: 0;
    font-size: 0.9rem;
}

.footer-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: 1fr;
}

@media(min-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

.social-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.social-links a {
    color: #cbd5e1;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.social-links a:hover {
    color: white;
    padding-left: 4px;
}

.social-links a::before {
    content: "›";
    color: var(--gov-cyan);
    font-weight: bold;
    font-size: 1.2rem;
    line-height: 1;
}