:root {
    --bg-color: #0f172a;
    --accent-primary: #38bdf8;
    --accent-secondary: #818cf8;
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(129, 140, 248, 0.15) 0%, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    display: grid;
    /* Fila 1: min 8.33vh, Fila 2: Elástica (1fr), Fila 3: min 16.67vh */
    grid-template-rows: minmax(8.33vh, auto) 1fr minmax(16.67vh, auto);
    min-height: 100vh;
    gap: 20px;
    padding: 20px;
}

/* Estilos para filas */
.row {
    width: 100%;
    /* Quitamos min-height: 0 para permitir que crezca */
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    min-height: 100%;
    height: auto;
    /* Asegura que pueda crecer */
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    display: block;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.glass-card.left-align {
    align-items: flex-start;
    text-align: left;
    padding-left: 3rem;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Fila Superior */
.header {
    background: transparent;
}

/* Fila Central */
.middle-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

#Fila21 {
    font-size: 0.85rem;
}

#Fila21 .menu-link {
    font-size: 0.9rem;
}

.col {
    height: 100%;
    min-width: 0;
}

/* Specific Column Styles */
.col-center .glass-card.accent {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.1), rgba(129, 140, 248, 0.1));
    border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Fila Inferior */
.footer {
    height: auto;
}

#Fila11 .glass-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.8rem;
    font-weight: 600;
}

#Fila11 .current-date {
    font-size: 1.1rem;
    color: var(--accent-primary);
    font-weight: 400;
    margin-left: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    height: 100%;
}

.header-link,
.footer-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

.header-link:hover,
.footer-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--accent-primary);
}

p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Elements */
.pulse-button {
    margin-top: 1.5rem;
    padding: 0.8rem 2rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: 30px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(56, 189, 248, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
    }
}

/* Responsive Design */
.menu-list {
    list-style: none;
    width: 100%;
    padding: 0;
    margin: 0;
}

.menu-list li {
    margin-bottom: 0.5rem;
    padding: 0;
    text-align: left;
    display: flex;
    flex-direction: column;
    /* Para apilar el sub-ul debajo del link */
    align-items: flex-start;
    width: 100%;
}

.menu-list li::before {
    display: none;
    /* Quitamos el punto fijo para manejarlo más flexiblemente */
}

/* El enlace que contiene el punto y el texto */
.menu-link {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
    cursor: pointer;
    font-size: 1.1rem;
    width: 100%;
}

.menu-link::before {
    content: '•';
    color: var(--accent-primary);
    font-weight: bold;
    margin-right: 0.5rem;
}

.submenu {
    list-style: none;
    padding-left: 1.5rem;
    margin-top: 0.3rem;
    display: none;
    /* Oculto por defecto */
    width: 100%;
}

.is-open>.submenu {
    display: block;
    /* Mostrar cuando el padre tiene la clase is-open */
}

.has-submenu>.menu-link::after {
    content: ' ›';
    margin-left: auto;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.is-open>.menu-link::after {
    transform: rotate(90deg);
}

.menu-link:hover {
    color: var(--accent-primary);
}

.wiki-content h1 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.wiki-content p {
    font-size: 1rem;
    color: var(--text-primary);
}

h1,
h2,
h3,
h4,
h5 {
    white-space: pre-wrap;
    /* Respeta múltiples espacios y saltos de línea */
    margin: 1rem 0;
}

/* Formatos especiales Wiki */
.versalita {
    font-family: 'Courier New', Courier, monospace;
    font-variant: small-caps;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

strong,
b {
    color: var(--text-primary);
}

em,
i {
    color: var(--text-secondary);
}

/* Estilos de Tablas */
.table-container {
    width: 100%;
    overflow-x: auto;
    margin: 1.5rem 0;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(15, 23, 42, 0.3);
}

th,
td {
    padding: 12px 15px;
    border: 1px solid var(--glass-border);
    text-align: left;
}

th {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent-primary);
    font-weight: 600;
}

tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.pdf-link-popup {
    color: var(--accent-primary);
    text-decoration: underline;
    font-weight: 600;
    cursor: pointer;
}

.pdf-link-popup:hover {
    color: var(--text-primary);
}

.wiki-link {
    color: var(--accent-primary);
    text-decoration: none;
    border-bottom: 1px dashed var(--accent-primary);
    transition: all 0.3s ease;
    cursor: pointer;
}

.wiki-link:hover {
    background: rgba(56, 189, 248, 0.1);
    border-bottom-style: solid;
    color: var(--text-primary);
}

.error-box {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 1.5rem;
    border-radius: 12px;
    margin: 1rem 0;
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: left;
}

/* Imágenes */
img {
    max-width: 100%;
    border-radius: 8px;
    margin: 0 0.5rem;
    /* Margen horizontal suave, ninguno vertical para que no salte de línea */
    display: inline-block;
    vertical-align: middle;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .middle-row {
        grid-template-columns: 1fr;
    }

    .container {
        height: auto;
    }

    .header,
    .footer {
        flex: none;
        height: 150px;
    }

    .col {
        height: 300px;
    }
}