/* =========================================
   1. VARIABLES DE COLOR
   ========================================= */
:root {
    --fondo: #f8f9fa;
    --tarjeta: #ffffff;
    --texto: #212529;
    --texto-suave: #6c757d;
    --primario: #0d6efd;
    --primario-hover: #0b5ed7;
    --borde: #dee2e6;
    --codigo-fondo: #f1f3f5;
    --codigo-texto: #d63384;
    --sombra: 0 2px 8px rgba(0,0,0,0.08);
    --radio: 12px;
}

/* =========================================
   2. RESET Y BASE (FONDO OPTIMIZADO)
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--texto);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    
    /* Fondo con imagen sin overlay */
    background: url('img/cirnofondo2.png') center/cover no-repeat fixed #1e3a8a;
}

/* =========================================
   3. CABECERA Y PIE DE PÁGINA
   ========================================= */
.hero, footer {
    background: rgba(255, 255, 255, 0.95); /* Semi-transparente para legibilidad */
    backdrop-filter: blur(8px); /* Efecto vidrio sutil */
}

.hero {
    text-align: center;
    padding: 3rem 1rem 2rem;
    border-bottom: 1px solid var(--borde);
}

.hero-image {
    width: 120px;
    height: auto;
    margin: 0 auto 1rem;
    display: block;
}

.hero h1 { font-size: 2.2rem; margin-bottom: 0.5rem; }
.hero .subtitle {
    color: var(--texto-suave);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 1.5rem;
}

footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--texto-suave);
    font-size: 0.9rem;
    border-top: 1px solid var(--borde);
    margin-top: auto; /* Empuja el footer al final si hay poco contenido */
}

/* =========================================
   4. CONTENEDOR Y BUSCADOR
   ========================================= */
.container {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
    width: 100%;
}

.search-section {
    padding: 1.5rem 1rem;
    display: flex;
    justify-content: center;
}

#buscador {
    width: 100%;
    max-width: 600px;
    padding: 0.9rem 1.2rem;
    font-size: 1rem;
    border: 2px solid var(--borde);
    border-radius: 50px;
    background: var(--tarjeta);
    color: var(--texto);
    outline: none;
    transition: all 0.3s ease;
}

#buscador:focus {
    border-color: var(--primario);
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.15);
}

#buscador::placeholder { color: var(--texto-suave); }

/* =========================================
   5. NAVEGACIÓN (PESTAÑAS PRINCIPALES)
   ========================================= */
.tabs-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--borde);
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}

.tabs-container {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0 0.5rem;
    scrollbar-width: none;
}
.tabs-container::-webkit-scrollbar { display: none; }

.tab-btn {
    flex: 0 0 auto;
    padding: 0.7rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--texto-suave);
    background: transparent;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab-btn:hover { color: var(--primario); background: rgba(13, 110, 253, 0.08); }
.tab-btn.active {
    color: var(--primario);
    background: rgba(13, 110, 253, 0.12);
    border-color: var(--primario);
    font-weight: 600;
}

/* =========================================
   6. CONTENIDO DE PESTAÑAS Y ANIMACIONES
   ========================================= */
.tab-content, .vm-content {
    display: none;
    animation: fadeIn 0.3s ease;
}
.tab-content.active, .vm-content.active { display: block; }

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

#diccionario { padding-top: 1rem; }

.tab-placeholder {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--texto-suave);
}
.tab-placeholder h2 { color: var(--texto); margin-bottom: 1rem; }
.tab-placeholder em { font-style: normal; opacity: 0.8; }

/* =========================================
   7. TARJETAS Y TUTORIALES
   ========================================= */
.termino, .paso {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    border: 1px solid var(--borde);
    border-radius: var(--radio);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--sombra);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.termino:hover, .paso:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

.termino h2 {
    font-size: 1.5rem;
    color: var(--primario);
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--fondo);
}

.definicion { font-size: 1.05rem; margin-bottom: 1rem; }

/* Sub-pestañas VM */
.vm-wrapper { padding: 1rem 0; }
.vm-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--borde);
    padding-bottom: 0.5rem;
    flex-wrap: wrap;
}

.vm-btn {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--texto-suave);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}
.vm-btn:hover { color: var(--primario); }
.vm-btn.active {
    color: var(--primario);
    border-bottom-color: var(--primario);
    font-weight: 600;
}

.vm-intro {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--codigo-fondo);
    border-left: 4px solid var(--primario);
    border-radius: 0 8px 8px 0;
}

.paso h4 { color: var(--primario); margin-bottom: 0.8rem; font-size: 1.1rem; }
.paso p { margin-bottom: 1rem; line-height: 1.7; }

.vm-img {
    width: 100%;
    max-width: 700px;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--borde);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    display: block;
    margin: 0 auto 1rem;
}

.vm-note {
    margin-top: 2rem;
    padding: 1rem;
    background: #e7f3ff;
    border-radius: 8px;
    color: #0550ae;
}

/* =========================================
   8. CÓDIGO Y EJEMPLOS
   ========================================= */
details {
    background: var(--codigo-fondo);
    border-radius: 8px;
    border: 1px solid var(--borde);
    overflow: hidden;
}

summary {
    padding: 0.8rem 1rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--texto-suave);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
summary::-webkit-details-marker { display: none; }
summary::before {
    content: "▶";
    font-size: 0.8rem;
    transition: transform 0.2s;
}
details[open] summary::before { transform: rotate(90deg); }

.codigo {
    padding: 1rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.95rem;
    color: var(--texto);
    background: #ffffff;
    border-top: 1px solid var(--borde);
    white-space: pre-wrap;
}

code {
    background: var(--codigo-fondo);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    color: var(--codigo-texto);
    font-weight: 600;
    font-family: inherit;
}

/* =========================================
   9. RESPONSIVE (UNIFICADO)
   ========================================= */
@media (max-width: 600px) {
    .hero h1 { font-size: 1.6rem; }
    .hero-image { width: 100px; }
    #buscador { font-size: 16px; }
    .termino, .paso { padding: 1.2rem; }
    
    .tab-btn, .vm-btn { padding: 0.5rem 0.8rem; font-size: 0.85rem; }
    .tabs-container { justify-content: flex-start; }
    
    body { background-attachment: scroll; } /* Mejor rendimiento en móviles */
}
/* =========================================
   10. CARRUSEL DE IMÁGENES
   ========================================= */

.carrusel {
    position: relative;
    max-width: 700px;
    margin: 1.5rem auto;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    background: var(--tarjeta);
}

.carrusel-slides {
    display: flex;
    transition: transform 0.4s ease-in-out;
}

.carrusel-slide {
    min-width: 100%;
    display: none;
}

.carrusel-slide.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

.carrusel-slide .vm-img {
    width: 100%;
    margin: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
}

/* Leyenda debajo de la imagen */
.carrusel-caption {
    padding: 0.8rem 1rem;
    background: var(--fondo);
    text-align: center;
    font-size: 0.9rem;
    color: var(--texto-suave);
    border-top: 1px solid var(--borde);
}

/* Botones de navegación (flechas) */
.carrusel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.2s;
    z-index: 10;
}

.carrusel-btn:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

.carrusel-btn.prev { left: 10px; }
.carrusel-btn.next { right: 10px; }

/* Ocultar flechas en móviles muy pequeños */
@media (max-width: 480px) {
    .carrusel-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    .carrusel-btn.prev { left: 5px; }
    .carrusel-btn.next { right: 5px; }
}

/* Indicadores (puntos) */
.carrusel-indicadores {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 0.8rem;
    background: var(--tarjeta);
    border-top: 1px solid var(--borde);
}

.indicador {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--borde);
    cursor: pointer;
    transition: all 0.2s;
}

.indicador:hover {
    background: var(--primario);
}

.indicador.active {
    background: var(--primario);
    width: 24px;
    border-radius: 5px;
}

/* Animación de entrada */
@keyframes fadeIn {
    from { opacity: 0.8; }
    to { opacity: 1; }
}