/* ============================================
   VARIABLES CSS - Tokens de diseño
   ============================================ */
   :root {
    /* Colores principales */
    --color-primary: #667eea;
    --color-primary-dark: #764ba2;
    --color-secondary: #4facfe;
    --color-secondary-dark: #00f2fe;
    --color-accent: #43e97b;
    --color-accent-dark: #38f9d7;
    
    /* Colores de texto */
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --text-light: #e2e8f0;
    
    /* Colores de fondo */
    --bg-gradient: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-code: #1a202c;
    
    /* Sombras y bordes */
    --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 25px 70px rgba(0, 0, 0, 0.4);
    --border-radius: 20px;
    --border-radius-sm: 10px;
    
    /* Espaciado */
    --spacing-xs: 10px;
    --spacing-sm: 15px;
    --spacing-md: 20px;
    --spacing-lg: 30px;
    --spacing-xl: 40px;
    
    /* Tipografía */
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-mono: 'Consolas', 'Monaco', monospace;
    
    /* Colores semánticos para código */
    --code-tag: #fc8181;
    --code-attr: #fbd38d;
    --code-value: #9ae6b4;
    --code-comment: #718096;
}

/* ============================================
   RESET Y BASE
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    min-height: 100vh;
    padding: var(--spacing-md);
    color: var(--text-primary);
    line-height: 1.6;
}

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

a {
    text-decoration: none;
    color: #0849aa;
    transition: color 0.3s ease;
}

a:hover {
    color: #1a3a6e;
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Títulos */
h1 {
    text-align: center;
    color: white;
    margin-bottom: var(--spacing-xl);
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

h2 {
    color: #2c5aa0;
    border-bottom: 3px solid #2c5aa0;
    padding-bottom: var(--spacing-xs);
    margin-top: 0;
    font-size: 1.8rem;
}

h2.pautas {
    background-color: rgba(179, 182, 184, 0.58);
    padding: var(--spacing-sm);
}

h3 { color: #1a3a6e; margin: 0.3em 0 0.5em 0; font-size: 1.4rem; }
h4 { color: #444; font-size: 1.2rem; font-weight: 600; margin: 0 0 0.2em 0; }
h5 { font-weight: bold; margin: 0 0 0.2em 0; }
h6 { font-size: 1rem; margin: 0 0 0.2em 0; color: #18801d; font-weight: bold; }

p { margin: 0 0 1em 0; }

/* ============================================
   COMPONENTES: TARJETAS (BLOCKS)
   ============================================ */
.blocks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(600px, 1fr));
    gap: var(--spacing-lg);
}

.block {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.block:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, #f093fb 0%, #f5576c 100%);
}

.block:nth-child(2)::before {
    background: linear-gradient(90deg, var(--color-secondary) 0%, var(--color-secondary-dark) 100%);
}

.block:nth-child(3)::before {
    background: linear-gradient(90deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
}

.block-header {
    display: flex;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.block-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin-right: var(--spacing-sm);
    flex-shrink: 0;
}

.block:nth-child(2) .block-number {
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-secondary-dark) 100%);
}

.block:nth-child(3) .block-number {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
}

.block h2 {
    color: var(--text-primary);
    font-size: 1.4rem;
    border: none;
    padding: 0;
}

/* ============================================
   COMPONENTES: DIAGRAMAS DE FLUJO
   ============================================ */
.flow-diagram {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-md);
}

.flow-item {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background: #f7fafc;
    border-radius: var(--border-radius-sm);
    border-left: 4px solid var(--color-primary);
    transition: all 0.3s ease;
    position: relative;
}

.flow-item:hover {
    background: #edf2f7;
    transform: translateX(5px);
}

.flow-item::after {
    content: '↓';
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-muted);
    font-size: 1.2rem;
}

.flow-item:last-child::after {
    display: none;
}

.flow-icon {
    width: 30px;
    height: 30px;
    margin-right: var(--spacing-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Iconos temáticos */
.flow-icon.user-icon { background: #fed7e2; color: #97266d; }
.flow-icon.http-icon { background: #c6f6d5; color: #22543d; }
.flow-icon.ip-icon { background: #feebc8; color: #744210; }
.flow-icon.dns-icon { background: #e9d8fd; color: #553c9a; }
.flow-icon.isp-icon { background: #bee3f8; color: #2a4365; }
.flow-icon.server-icon { background: #fed7d7; color: #742a2a; }
.flow-icon.db-icon { background: #d1fae5; color: #065f46; }

.flow-text {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.flow-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ============================================
   COMPONENTES: CONTENIDO HTML
   ============================================ */
.html-content {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.html-content h3 {
    color: #2b6cb0;
    margin: var(--spacing-lg) 0 var(--spacing-sm) 0;
    font-size: 1.2rem;
    border-bottom: 2px solid #bee3f8;
    padding-bottom: var(--spacing-xs);
}

.highlight-box,
.warning-box {
    padding: var(--spacing-sm);
    margin: var(--spacing-sm) 0;
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    border-left: 4px solid;
}

.highlight-box {
    background: #ebf8ff;
    border-color: #4299e1;
}

.warning-box {
    background: #fffaf0;
    border-color: #ed8936;
    font-size: 0.9rem;
}

/* ============================================
   COMPONENTES: BLOQUES DE CÓDIGO (IDE STYLE)
   ============================================ */
.code-block {
    background: var(--bg-code);
    color: var(--text-light);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    overflow-x: auto;
    margin: var(--spacing-sm) 0;
    position: relative;
    line-height: 1.6;
}

.code-block::before {
    content: 'HTML';
    position: absolute;
    top: 0;
    right: 0;
    background: #4a5568;
    color: #fff;
    padding: 2px 10px;
    font-size: 0.75rem;
    border-radius: 0 0 0 5px;
}

/* Sintaxis resaltada */
.code-block .tag { color: var(--code-tag); }
.code-block .attr { color: var(--code-attr); }
.code-block .value { color: var(--code-value); }
.code-block .content { color: var(--text-light); }
.code-block .comment { color: var(--code-comment); font-style: italic; }
.code-block .indent { 
    margin-left: var(--spacing-md); 
    display: block; 
}

/* Estructura visual de elementos */
.element-structure {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin: var(--spacing-md) 0;
    padding: var(--spacing-md);
    background: #f7fafc;
    border-radius: var(--border-radius-sm);
    font-family: monospace;
}

.element-structure .part {
    padding: 8px 12px;
    border-radius: 5px;
    text-align: center;
}

.element-structure .part.opening { background: #c6f6d5; color: #22543d; }
.element-structure .part.content { background: #bee3f8; color: #2a4365; }
.element-structure .part.closing { background: #fed7d7; color: #742a2a; }
.element-structure .part.plus { 
    background: none; 
    color: var(--text-muted); 
    font-weight: bold; 
    font-size: 1.2rem; 
    padding: 0; 
}

/* Lista inline de etiquetas */
.tags-inline {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-sm);
    margin: var(--spacing-sm) 0;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 2;
    overflow-x: auto;
}

.tags-inline code {
    background: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #cbd5e0;
    color: var(--text-primary);
    margin: 0 2px;
    white-space: nowrap;
}

/* Ejemplo de atributos */
.attribute-example {
    background: #faf5ff;
    border: 1px solid #d6bcfa;
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-sm);
    margin: var(--spacing-sm) 0;
}

/* ============================================
   COMPONENTES: TRÍADA TECNOLÓGICA
   ============================================ */
.tech-trio {
    display: flex;
    justify-content: space-around;
    margin: var(--spacing-md) 0;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.tech-item {
    text-align: center;
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    flex: 1;
    min-width: 150px;
    border: 2px solid;
}

.tech-item.html {
    background: #fff5f5;
    color: #c53030;
    border-color: #fc8181;
}

.tech-item.css {
    background: #ebf8ff;
    color: #2b6cb0;
    border-color: #63b3ed;
}

.tech-item.js {
    background: #fffff0;
    color: #975a16;
    border-color: #f6e05e;
}

.tech-item h4 { margin-bottom: 5px; font-size: 1.1rem; }
.tech-item p { font-size: 0.85rem; margin: 0; }

/* ============================================
   COMPONENTES: HEADER Y NAVEGACIÓN
   ============================================ */
.contenedora {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background-color: white;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-md);
}

#logo { flex-basis: 7em; }

/* Menú responsive - Base móvil */
#menuResponsive { position: relative; }

#menuResponsive button {
    display: block;
    background-color: #2c5aa0;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

#menuResponsive button:hover { background-color: #1a3a6e; }

#menuResponsive ul {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-xs) 0;
    min-width: 200px;
    z-index: 1000;
    margin: 0;
    list-style: none;
}

#menuResponsive ul.mostrar { display: block; }

#menuResponsive ul li {
    padding: 0;
    border-bottom: 1px solid #f0f0f0;
}

#menuResponsive ul li:last-child { border-bottom: none; }

#menuResponsive ul li a {
    display: block;
    padding: 12px 20px;
    color: #333;
    transition: color 0.3s ease, background-color 0.3s ease;
}

#menuResponsive ul li a:hover {
    color: #102b53;
    background-color: #f8f9fa;
}

/* ============================================
   COMPONENTES: FOOTER Y UTILITARIOS
   ============================================ */
.logosUN {
    display: grid;
    grid-template-rows: repeat(3, 1fr);
    grid-template-columns: 1fr;
    gap: 0.5em;
}

.paginaAccion { font-weight: bold; color: #1076b1; }
.destacado { font-weight: bold; color: #000; }

/* Listas con bordes */
ul {
    list-style: none;
    padding: 0;
    margin: var(--spacing-xs) 0;
    border-bottom: 1px solid #eee;
}

ul:last-child { border-bottom: none; }

li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

li:last-child { border-bottom: none; }

h6 + li { margin-top: 5px; }

/* Tabla flexible */
.tabla-fila {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 2px solid #ddd;
    margin-bottom: var(--spacing-xs);
    padding-bottom: var(--spacing-xs);
}

.tabla-celda {
    flex: 1;
    min-width: 200px;
    padding: var(--spacing-xs);
}

/* ============================================
   MEDIA QUERIES - RESPONSIVE
   ============================================ */

/* Tablet y desktop (798px+) */
@media (min-width: 798px) {
    /* Menú horizontal en desktop */
    #menuResponsive button { display: none; }
    
    #menuResponsive ul {
        display: flex !important;
        position: static;
        flex-direction: row;
        background: none;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        min-width: auto;
    }
    
    #menuResponsive ul li {
        border: none;
        margin: 0 var(--spacing-xs);
    }
    
    #menuResponsive ul li a {
        padding: 8px 15px;
        color: #2c5aa0;
        font-weight: 500;
        border-radius: 4px;
    }
    
    #menuResponsive ul li a:hover {
        background-color: #e8f0fe;
        color: #1a3a6e;
    }
    
    /* Logos UN en fila */
    .logosUN {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: 1fr;
    }
    
    /* Ajustes de indentación en código para pantallas grandes */
    .code-block .indent { margin-left: var(--spacing-lg); }
}

/* Móvil (hasta 768px) */
@media (max-width: 768px) {
    .blocks-grid { grid-template-columns: 1fr; }
    
    h1 { font-size: 1.8rem; }
    
    .element-structure { flex-direction: column; }
    .element-structure .part.plus { transform: rotate(90deg); }
    
    .code-block .indent { margin-left: var(--spacing-sm); }
}

/* ============================================
   PRINT - ESTILOS PARA IMPRESIÓN
   ============================================ */
@media print {
    body {
        background: white;
        color: black;
        padding: 0;
    }
    
    .block {
        box-shadow: none;
        page-break-inside: avoid;
        border: 1px solid #ddd;
    }
    
    .code-block {
        background: #f8f9fa;
        color: #333;
        border: 1px solid #ddd;
    }
    
    .code-block::before { display: none; }
    
    a { color: #000; text-decoration: underline; }
    
    /* Ocultar elementos interactivos en impresión */
    #menuResponsive button,
    .flow-item::after { display: none; }
}

/* ============================================
   COMPONENTES: FOOTER
   ============================================ */
   footer {
    background: #18284b; /* Fondo oscuro sólido */
    color: #e2e8f0;      /* Texto claro para alto contraste */
    padding: 50px 20px 30px;
    margin-top: 60px;
    font-size: 0.95rem;
    line-height: 1.5;
}

footer .wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

/* Layout de columnas */
#pie {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

/* Títulos de columnas */
.columna h5 {
    color: #ffffff;
    font-size: 1.15rem;
    margin: 0 0 15px 0;
    font-weight: 700;
    border-bottom: 2px solid #4a5568;
    padding-bottom: 8px;
    display: inline-block;
}

/* Reset de estilos globales de listas dentro del footer */
.columna ul {
    list-style: none;
    padding: 0;
    margin: 0;
    border: none; /* Elimina el border-bottom global */
}

.columna li {
    padding: 6px 0;
    border: none; /* Elimina el border-bottom global */
}

/* Enlaces del footer */
.columna a {
    color: #90cdf4; /* Azul claro para buen contraste */
    text-decoration: none;
    transition: all 0.2s ease;
}

.columna a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* Logo institucional */
#logospie {
    text-align: center;
    padding-top: 25px;
    border-top: 1px solid #4a5568;
}

#logospie img {
    max-width: 160px;
    height: auto;
    /* Si el SVG es oscuro, esto lo invierte a blanco automáticamente */
    filter: brightness(0) invert(1);
    transition: filter 0.3s ease;
}

#logospie img:hover {
    filter: brightness(0.8) invert(1);
}

/* ============================================
   RESPONSIVE FOOTER
   ============================================ */
@media (max-width: 768px) {
    footer {
        padding: 40px 15px 20px;
        margin-top: 40px;
    }

    #pie {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
    }

    .columna h5 {
        border-bottom: none;
        margin-bottom: 10px;
    }

    #logospie {
        border-top: none;
        padding-top: 20px;
    }
}

/* Ajuste para impresión */
@media print {
    footer {
        background: none;
        color: #000;
        padding: 20px 0;
        margin-top: 20px;
        border-top: 2px solid #000;
    }

    .columna a { color: #000; text-decoration: underline; }
    /* #logospie img { filter: none; max-width: 120px; }*/
}