/* ==========================================================================
   CARDONA MADARIAGA (CACM) - DEV HUB & TIPS
   Estilos de Alto Contraste "Midnight Cobalt & High Contrast Tech"
   Equilibrio perfecto: Cero blanco parco, cero negro opaco, colores vivos.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&family=Poppins:wght@300;400;500;600;700;800&family=Fira+Code:wght@400;500&display=swap');

:root {
    /* Fondos: Azul Medianoche & Cobalto Profundo */
    --bg-body:          #0b1120; /* Slate / Cobalt 950 */
    --bg-surface:       #131e36; /* Tarjetas Azul Noche Sólidas */
    --bg-surface-alt:   #192744; /* Superficies elevadas */
    --bg-surface-hover: #1e3054;
    --bg-editor:        #070b14; /* Fondo código ultra contraste */
    
    /* Textos & Alto Contraste */
    --texto-titulos:    #ffffff; /* Blanco Puro Brillante */
    --texto-cuerpo:     #cbd5e1; /* Gris Platino Nítido */
    --texto-secundario: #94a3b8; /* Gris Medio Claro */
    --texto-apagado:    #64748b;
    
    /* Acentos Vivos & Saturados */
    --azul-primario:    #0284c7; /* Sky Blue */
    --azul-cyan:        #38bdf8; /* Cyan Neón de Alto Contraste */
    --azul-royal:       #1d4ed8; /* Blue 700 */
    --azul-indigo:      #6366f1; /* Indigo IA */
    
    --dorado-acento:    #f59e0b; /* Ámbar / Oro Brillante */
    --dorado-hover:     #fbbf24;
    --dorado-texto:     #fde047; /* Amarillo Neón de Máximo Contraste */
    
    --verde-exito:      #10b981;
    --rojo-like:        #f43f5e;
    
    /* Bordes Nítidos y Sombras con Volumen */
    --border-color:     #223252; /* Borde bien definido */
    --border-hover:     #38bdf8; /* Brillo al interactuar */
    --border-dorado:    #f59e0b;
    --sombra-card:      0 12px 28px -5px rgba(0, 0, 0, 0.55), 0 6px 12px -3px rgba(0, 0, 0, 0.4);
    --sombra-hover:     0 20px 40px -5px rgba(0, 0, 0, 0.7), 0 0 20px rgba(56, 189, 248, 0.2);
    
    --radius-sm:        8px;
    --radius-md:        12px;
    --radius-lg:        20px;
    --radius-pill:      40px;
    --transition:       all 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--bg-body);
    background-image: 
        radial-gradient(at 10% 10%, rgba(2, 132, 199, 0.16) 0px, transparent 45%),
        radial-gradient(at 90% 15%, rgba(245, 158, 11, 0.14) 0px, transparent 40%),
        radial-gradient(at 50% 85%, rgba(99, 102, 241, 0.12) 0px, transparent 55%);
    background-attachment: fixed;
    color: var(--texto-cuerpo);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: clip;
}

/* Scrollbar moderno */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #070b14;
}
::-webkit-scrollbar-thumb {
    background: #243452;
    border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--azul-cyan);
}

/* ==========================================================================
   HEADER Y NAVEGACIÓN
   ========================================================================== */
.header-principal {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(11, 17, 32, 0.92);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: var(--transition);
}

.nav-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.brand-logo-img {
    height: 48px;
    width: auto;
}

.nav-acciones {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.3rem;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: var(--transition);
}

.btn-amarillo {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}
.btn-amarillo:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: 0 6px 22px rgba(245, 158, 11, 0.55);
    color: #ffffff;
}

.btn-outline {
    background: var(--bg-surface);
    color: #ffffff;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.btn-outline:hover {
    background: var(--bg-surface-alt);
    border-color: var(--azul-cyan);
    color: var(--azul-cyan);
    transform: translateY(-1px);
}

.btn-ia {
    background: linear-gradient(135deg, #4f46e5 0%, #0284c7 100%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
}
.btn-ia:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.55);
}

/* ==========================================================================
   HERO / BANNER DE BIENVENIDA
   ========================================================================== */
.hero-section {
    max-width: 1300px;
    margin: 1.5rem auto 1rem;
    padding: 3rem 1.5rem 2rem;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1.1rem;
    background: rgba(2, 132, 199, 0.18);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: var(--azul-cyan);
    border-radius: var(--radius-pill);
    font-size: 0.84rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
    letter-spacing: 0.4px;
}

.hero-title {
    font-size: 2.7rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0.9rem;
    line-height: 1.2;
    letter-spacing: -0.5px;
}
.hero-title span {
    background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #fde047 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-sub {
    font-size: 1.08rem;
    color: var(--texto-cuerpo);
    max-width: 720px;
    margin: 0 auto 2rem;
}

/* Buscador Rápido */
.search-bar-wrap {
    max-width: 620px;
    margin: 0 auto;
    position: relative;
}

.search-bar-wrap input {
    width: 100%;
    padding: 1rem 1.4rem 1rem 3.2rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    color: #ffffff;
    font-size: 0.96rem;
    outline: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: var(--transition);
}
.search-bar-wrap input:focus {
    border-color: var(--azul-cyan);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25), 0 8px 25px rgba(0, 0, 0, 0.6);
}
.search-bar-wrap input::placeholder {
    color: var(--texto-secundario);
}
.search-bar-wrap i.search-icon {
    position: absolute;
    left: 1.3rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--azul-cyan);
    font-size: 1.05rem;
}

/* ==========================================================================
   DESTACADO: SECCIÓN DEL LIBRO DIGITAL GRATUITO
   ========================================================================== */
.libro-section {
    max-width: 1300px;
    margin: 1rem auto 2.5rem;
    padding: 0 1.5rem;
}

.libro-card {
    background: linear-gradient(135deg, #162444 0%, #111a30 100%);
    border: 2px solid #f59e0b;
    border-radius: var(--radius-lg);
    padding: 2.2rem;
    display: flex;
    align-items: center;
    gap: 2.2rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(245, 158, 11, 0.2);
    position: relative;
    overflow: hidden;
}
.libro-card::after {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.libro-visual {
    flex-shrink: 0;
}
.libro-portada-mini {
    width: 110px;
    height: 150px;
    background: linear-gradient(135deg, #0284c7 0%, #1e3a8a 100%);
    border-radius: 8px 14px 14px 8px;
    border-left: 6px solid #f59e0b;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    text-align: center;
    padding: 0.8rem;
    transition: var(--transition);
}
.libro-card:hover .libro-portada-mini {
    transform: rotate(-3deg) scale(1.05);
}
.libro-portada-mini i {
    font-size: 2.4rem;
    color: #fde047;
    margin-bottom: 0.4rem;
}
.libro-portada-mini span {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.libro-portada-mini small {
    font-size: 0.6rem;
    color: #cbd5e1;
}

.libro-info {
    flex: 1;
}
.badge-libro {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fde047;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-pill);
    margin-bottom: 0.6rem;
}
.libro-info h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0.6rem;
    line-height: 1.3;
}
.libro-info p {
    font-size: 0.95rem;
    color: var(--texto-cuerpo);
    margin-bottom: 1.2rem;
    line-height: 1.5;
}
.libro-acciones {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
}
.libro-formato {
    font-size: 0.82rem;
    color: var(--texto-secundario);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

@media (max-width: 768px) {
    .libro-card {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    .libro-acciones {
        justify-content: center;
    }
}

/* ==========================================================================
   BARRA DE TEMAS / SELECTOR (CHIPS)
   ========================================================================== */
.temas-section {
    max-width: 1300px;
    margin: 0 auto 2.5rem;
    padding: 0 1.5rem;
}

.temas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.temas-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.temas-chips {
    display: flex;
    gap: 0.7rem;
    overflow-x: auto;
    padding-bottom: 0.6rem;
    scrollbar-width: thin;
}

.chip-tema {
    padding: 0.58rem 1.2rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    color: var(--texto-cuerpo);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
}
.chip-tema:hover {
    border-color: var(--azul-cyan);
    background: var(--bg-surface-alt);
    color: #ffffff;
    transform: translateY(-1px);
}
.chip-tema.activo {
    background: #ffffff;
    color: #0b1120;
    font-weight: 700;
    border-color: #ffffff;
    box-shadow: 0 4px 18px rgba(255, 255, 255, 0.25);
}
.chip-tema.activo i {
    color: var(--dorado-acento);
}

/* ==========================================================================
   LAYOUT PRINCIPAL (CONTENIDO + ASISTENTE IA)
   ========================================================================== */
.main-layout {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
    align-items: start;
}

/* GRILLA DE TIPS */
.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.6rem;
}

/* TARJETA DE TIP (ALTO CONTRASTE) */
.card-tip {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.7rem;
    box-shadow: var(--sombra-card);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.card-tip:hover {
    transform: translateY(-4px);
    border-color: var(--azul-cyan);
    box-shadow: var(--sombra-hover);
}

.tip-top-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.9rem;
}
.badge-tema {
    font-size: 0.76rem;
    font-weight: 700;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.tip-fecha {
    font-size: 0.8rem;
    color: var(--texto-secundario);
    font-weight: 500;
}

.tip-titulo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--texto-titulos);
    margin-bottom: 0.65rem;
    line-height: 1.35;
}

.tip-resumen {
    font-size: 0.94rem;
    color: var(--texto-cuerpo);
    margin-bottom: 1.15rem;
    line-height: 1.55;
}

/* Caja de Ejercicio Práctico / Paso a Paso Cotidiano */
.tip-ejercicio-wrap {
    background: #0d1629;
    border: 1.5px solid #233554;
    border-left: 5px solid var(--dorado-acento);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
    position: relative;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}
.tip-ejercicio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
    font-size: 0.88rem;
    color: #ffffff;
}
.tip-ejercicio-wrap pre {
    margin: 0;
    color: #f1f5f9;
    font-family: 'Poppins', sans-serif;
    font-size: 0.92rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Bloque de código o pasos embebidos */
.tip-codigo-wrap {
    background: var(--bg-editor);
    border: 1px solid #1e2d4a;
    border-radius: var(--radius-md);
    padding: 0.95rem 1.15rem;
    margin-bottom: 1.15rem;
    position: relative;
    font-family: 'Fira Code', monospace;
    font-size: 0.84rem;
    overflow-x: auto;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
}
.tip-codigo-wrap pre {
    margin: 0;
    color: #e2e8f0;
    font-family: inherit;
    line-height: 1.5;
}
.btn-copiar-codigo {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.btn-copiar-codigo:hover {
    background: var(--dorado-acento);
    color: #0b1120;
    border-color: var(--dorado-acento);
}

.tip-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1.25rem;
}
.tip-tag {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--azul-cyan);
    background: rgba(2, 132, 199, 0.18);
    border: 1px solid rgba(56, 189, 248, 0.25);
    padding: 0.22rem 0.65rem;
    border-radius: 6px;
}

.tip-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    font-size: 0.86rem;
}
.tip-autor {
    color: #ffffff;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.tip-autor i {
    color: var(--dorado-acento);
}
.tip-interaccion {
    display: flex;
    gap: 0.9rem;
}
.btn-like, .btn-comentar {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--texto-cuerpo);
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.btn-like:hover {
    color: #ffffff;
    background: var(--rojo-like);
    border-color: var(--rojo-like);
}
.btn-like.liked {
    color: #ffffff;
    background: var(--rojo-like);
    border-color: var(--rojo-like);
}
.btn-comentar:hover, .btn-comentar.activo {
    color: #ffffff;
    background: var(--azul-primario);
    border-color: var(--azul-primario);
}
.comentarios-count {
    font-size: 0.82rem;
    font-weight: 700;
}

/* ==========================================================================
   DESPLEGABLE DE COMENTARIOS
   ========================================================================== */
.panel-comentarios {
    display: none;
    margin-top: 1.1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border-color);
    animation: fadeInDown 0.24s ease;
}
.panel-comentarios.activo {
    display: block;
}

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

.comentarios-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.9rem;
}
.comentarios-header h5 {
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.comentarios-header .badge-count {
    background: rgba(2, 132, 199, 0.25);
    color: var(--azul-cyan);
    border: 1px solid rgba(56, 189, 248, 0.35);
    padding: 0.15rem 0.55rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.lista-comentarios {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.4rem;
    margin-bottom: 1rem;
}
.lista-comentarios::-webkit-scrollbar {
    width: 5px;
}
.lista-comentarios::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.item-comentario {
    display: flex;
    gap: 0.75rem;
    background: #0d1629;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    font-size: 0.85rem;
}
.item-comentario-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--azul-primario);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    flex-shrink: 0;
}
.item-comentario-body {
    flex: 1;
}
.item-comentario-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}
.item-comentario-meta strong {
    color: #ffffff;
    font-size: 0.85rem;
}
.item-comentario-meta span {
    font-size: 0.74rem;
    color: var(--texto-secundario);
}
.item-comentario-body p {
    color: var(--texto-cuerpo);
    line-height: 1.45;
    margin: 0;
}
.sin-comentarios-msg {
    font-size: 0.85rem;
    color: var(--texto-secundario);
    font-style: italic;
    margin-bottom: 0.6rem;
}

/* Formulario inline para nuevo comentario */
.comentario-input-wrap {
    display: flex;
    gap: 0.45rem;
    background: #0d1629;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.4rem 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: var(--transition);
}
.comentario-input-wrap:focus-within {
    border-color: var(--azul-cyan);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}
.input-comentario-autor {
    width: 30%;
    background: transparent;
    border: none;
    outline: none;
    font-size: 0.85rem;
    padding: 0.4rem 0.5rem;
    border-right: 1px solid var(--border-color);
    color: #ffffff;
}
.input-comentario-autor::placeholder, .input-comentario-texto::placeholder {
    color: var(--texto-apagado);
}
.input-comentario-texto {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 0.85rem;
    padding: 0.4rem 0.5rem;
    color: #ffffff;
}
.btn-enviar-comentario {
    background: var(--azul-primario);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    width: 36px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
    flex-shrink: 0;
}
.btn-enviar-comentario:hover {
    background: var(--azul-cyan);
    color: #0b1120;
    transform: scale(1.05);
}

/* ==========================================================================
   SIDEBAR: ASISTENTE IA POR TEMAS (STICKY FLOTANTE & HIGH CONTRAST)
   ========================================================================== */
.sidebar-ia {
    position: sticky;
    top: 95px;
    align-self: start;
    z-index: 50;
    transition: var(--transition);
}

.ia-widget-card {
    background: linear-gradient(180deg, #162442 0%, #101a2e 100%);
    border: 1px solid #283e68;
    border-radius: var(--radius-lg);
    padding: 1.8rem;
    box-shadow: var(--sombra-card);
}

.ia-widget-header {
    display: flex;
    align-items: center;
    gap: 0.95rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.ia-icon-glow {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #4f46e5 0%, #0284c7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.3rem;
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}
.ia-widget-header h4 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}
.ia-widget-header p {
    font-size: 0.8rem;
    color: var(--texto-secundario);
    margin: 0;
}

.ia-selector-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.5rem;
    display: block;
}
.ia-tema-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #0d1629;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 0.9rem;
    outline: none;
    margin-bottom: 1.15rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
    transition: var(--transition);
}
.ia-tema-select:focus {
    border-color: var(--azul-cyan);
}
.ia-tema-select option {
    background: #0d1629;
    color: #ffffff;
}

.ia-input-wrap textarea {
    width: 100%;
    height: 95px;
    padding: 0.85rem;
    background: #0d1629;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 0.9rem;
    resize: none;
    outline: none;
    margin-bottom: 0.95rem;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
    transition: var(--transition);
}
.ia-input-wrap textarea:focus {
    border-color: var(--azul-cyan);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}
.ia-input-wrap textarea::placeholder {
    color: var(--texto-apagado);
}

.ia-respuesta-box {
    margin-top: 1.15rem;
    padding: 1.1rem;
    background: #09101d;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: #e2e8f0;
    border-left: 4px solid var(--azul-indigo);
    border-top: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    display: none;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   BOTÓN FLOTANTE: ACCESO A LA INTRANET
   ========================================================================== */
.btn-flotante-intranet, .btn-flotante-luma {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1200;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: #0a0f1d;
    color: #ffffff;
    padding: 0.75rem 1.35rem 0.75rem 0.95rem;
    border-radius: var(--radius-pill);
    border: 2px solid var(--dorado-acento);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 18px rgba(245, 158, 11, 0.35);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    animation: flotarSuave 4s ease-in-out infinite;
}
.btn-flotante-intranet:hover, .btn-flotante-luma:hover {
    transform: translateY(-4px) scale(1.03);
    background: #141f38;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.7), 0 0 28px rgba(245, 158, 11, 0.5);
}
.btn-flotante-intranet img, .btn-flotante-luma img {
    width: 32px;
    height: 32px;
}
.btn-flotante-intranet .intranet-text, .btn-flotante-luma .luma-text {
    display: flex;
    flex-direction: column;
    text-align: left;
}
.btn-flotante-intranet .intranet-title, .btn-flotante-luma .luma-title {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--dorado-texto);
    letter-spacing: 0.5px;
}
.btn-flotante-intranet .intranet-sub, .btn-flotante-luma .luma-sub {
    font-size: 0.7rem;
    color: var(--texto-secundario);
}

@keyframes flotarSuave {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* ==========================================================================
   MODAL PARA NUEVO TIP
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 11, 20, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}
.modal-overlay.activo {
    display: flex;
}
.modal-box {
    background: #131e36;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 640px;
    padding: 2.3rem;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.8);
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.95rem;
}
.modal-header h3 {
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.modal-cerrar {
    background: transparent;
    border: none;
    color: var(--texto-secundario);
    font-size: 1.6rem;
    cursor: pointer;
    transition: var(--transition);
}
.modal-cerrar:hover {
    color: #ffffff;
}

.form-group {
    margin-bottom: 1.25rem;
}
.form-group label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 0.45rem;
    color: #ffffff;
}
.form-control {
    width: 100%;
    padding: 0.85rem 1.15rem;
    background: #0d1629;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 0.92rem;
    outline: none;
    transition: var(--transition);
}
.form-control:focus {
    border-color: var(--azul-cyan);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

/* ==========================================================================
   FOOTER (DELGADO, ELEGANTE Y COMPACTO)
   ========================================================================== */
.footer-principal {
    border-top: 1px solid var(--border-color);
    background: #070b16;
    padding: 1.1rem 1.5rem;
    font-size: 0.84rem;
    color: var(--texto-secundario);
}
.footer-principal strong {
    color: #ffffff;
}

.footer-container {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.footer-links a, .footer-links button {
    background: transparent;
    border: none;
    color: var(--texto-secundario);
    text-decoration: none;
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition);
}
.footer-links a:hover, .footer-links button:hover {
    color: var(--azul-cyan);
    text-decoration: underline;
}

@media (max-width: 768px) {
    .footer-container {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    .footer-links {
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 960px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    .sidebar-ia {
        position: static;
        margin-top: 1.5rem;
    }
    .hero-title {
        font-size: 2.2rem;
    }
}

@media (max-width: 640px) {
    .nav-container {
        flex-direction: column;
        gap: 0.9rem;
    }
    .brand-logo-img {
        height: 40px;
        max-width: 100%;
    }
    .nav-acciones {
        width: 100%;
        justify-content: center;
    }
    .tips-grid {
        grid-template-columns: 1fr;
    }
    .btn-flotante-intranet .intranet-sub,
    .btn-flotante-luma .luma-sub {
        display: none;
    }
}

/* ==========================================================================
   ESQUEMA DE LOGIN LUMA NEXUS ADAPTADO A CARDONA MADARIAGA
   ========================================================================== */
.login-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.2rem;
}

.login-card {
    background: #131e36;
    border: 1.5px solid #233554;
    border-radius: 16px;
    padding: 2.5rem 2.2rem;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    position: relative;
    animation: fadeInDown 0.3s ease;
}

.login-card .logo-img {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    margin: 0 auto 1.2rem;
    display: block;
    border: 2px solid var(--dorado-acento);
    background: #0b1120;
    padding: 6px;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.login-card h1 {
    color: #ffffff;
    font-size: 1.7rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
    letter-spacing: -0.5px;
}
.login-card h1 span {
    color: var(--dorado-acento);
}

.login-card p {
    color: var(--texto-secundario);
    font-size: 0.9rem;
    margin-bottom: 1.8rem;
}

.login-card .form-group {
    text-align: left;
    margin-bottom: 1.2rem;
}
.login-card .form-group label {
    display: block;
    color: #ffffff;
    margin-bottom: 0.45rem;
    font-size: 0.86rem;
    font-weight: 600;
}
.login-card .form-group input {
    width: 100%;
    padding: 0.85rem 1rem;
    background: #0b1120;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}
.login-card .form-group input:focus {
    border-color: var(--azul-cyan);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.login-card .btn-primary {
    width: 100%;
    padding: 0.9rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 0.4rem;
}
.login-card .btn-primary:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

#resvalida1 {
    display: none;
    margin-top: 1.2rem;
    border-radius: 8px;
    padding: 0.8rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    text-align: center;
}

.login-links {
    margin-top: 1.6rem;
    font-size: 0.85rem;
    color: var(--texto-secundario);
    line-height: 1.5;
}
.login-links a {
    color: var(--azul-cyan);
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}
.login-links a:hover {
    text-decoration: underline;
    color: #ffffff;
}

/* Modal Emergente Luma Nexus Style */
.modal-container {
    display: none;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.modal-content {
    background: #131e36;
    border: 1.5px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 650px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
}
.modal-header {
    background: #0d1629;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}
.modal-header img {
    height: 32px;
    width: auto;
}
.modal-header h5 {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}
.modal-body {
    padding: 0;
    flex: 1;
}
.modal-body iframe {
    width: 100%;
    height: 400px;
    border: none;
    background: #0b1120;
}
.modal-footer {
    background: #0d1629;
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
}
