/* ========================================
   SISTEMA DE TEMAS - McKenzie AI
   Versión: 2.0 - Optimizado y 100% Responsive
   Autor: McKenzie AI
   Descripción: Sistema de estilos con tema claro/oscuro
   ======================================== */

/* ========================================
   VARIABLES CSS - TEMA CLARO
   ======================================== */
:root {
    /* Colores personalizados - Tema Claro */
    --primary: #2188b7;
    --primary-light: #b4def7;
    --primary-dark: #002b55;
    --accent: #2188b7;

    /* Tema Claro */
    --bg-light: #f8fafc;
    --bg-card: #ffffff;
    --text-dark: #002b55;
    --text-muted: #2188b7;
    --border: #b4def7;

    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, #b4def7, #2188b7);
    --gradient-dark: linear-gradient(135deg, #2188b7, #002b55);

    /* Altura del header (para scroll offset) */
    --header-height: 220px;
}

/* ========================================
   VARIABLES CSS - TEMA OSCURO
   ======================================== */
.dark {
    /* Tema Oscuro */
    --bg-light: #001528;
    --bg-card: #002b55;
    --text-dark: #b4def7;
    --text-muted: #7bb8d9;
    --border: #2188b7;

    /* Gradientes modo oscuro */
    --gradient-primary: linear-gradient(135deg, #2188b7, #b4def7);
    --gradient-dark: linear-gradient(135deg, #002b55, #2188b7);
}

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

html {
    /* CRÍTICO: Scroll suave y compensación por header sticky */
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-height);
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    width: 100%;
    min-height: 100vh;
}

/* ========================================
   HEADER Y NAVEGACIÓN
   ======================================== */
header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 5%;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    animation: slideDown 0.6s ease;
    width: 100%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

nav {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    width: 100%;
}

/* ========================================
   LOGO
   ======================================== */
.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

/* Logo - Tamaño dinámico y responsive */
.logo-img {
    height: 180px;
    width: auto;
    max-width: min(450px, 40vw);
    object-fit: contain;
    transition: transform 0.3s ease, filter 0.3s ease;
    display: block;
}

.logo-img:hover {
    transform: scale(1.03);
}

.logo-text {
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

/* ========================================
   BOTÓN DE TOGGLE TEMA
   ======================================== */
.theme-toggle {
    background: var(--bg-card);
    border: 2px solid var(--border);
    color: var(--text-dark);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--primary-light);
    transform: rotate(180deg);
    border-color: var(--primary);
}

.theme-toggle i {
    transition: opacity 0.3s ease;
}

/* Esconder/mostrar iconos según tema */
.theme-icon-light {
    display: none;
}

.dark .theme-icon-light {
    display: block;
}

.dark .theme-icon-dark {
    display: none;
}

/* ========================================
   NAVEGACIÓN
   ======================================== */
.nav-links {
    display: flex;
    gap: 2.5rem;
    align-items: center;
    flex-shrink: 0;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.05rem;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.nav-links a:hover {
    color: var(--primary);
}

.nav-links a:hover::after {
    width: 100%;
}

/* ========================================
   ANIMACIONES GLOBALES
   ======================================== */
@keyframes fadeInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes messageSlide {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero {
    max-width: 1400px;
    margin: 4rem auto;
    padding: 3rem 5%;
    text-align: center;
    animation: fadeInUp 0.8s ease 0.2s both;
    width: 100%;
}

.hero h1 {
    font-size: clamp(2rem, 6vw, 4rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: var(--gradient-dark);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.hero p {
    font-size: clamp(1rem, 2.5vw, 1.35rem);
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto 2.5rem;
    line-height: 1.7;
}

.cta-button {
    background: var(--gradient-primary);
    color: white;
    padding: 1.2rem 3rem;
    border: none;
    border-radius: 50px;
    font-size: clamp(1rem, 2vw, 1.2rem);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(33, 136, 183, 0.3);
    display: inline-block;
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(33, 136, 183, 0.5);
}

/* ========================================
   FEATURES SECTION
   ======================================== */
.features {
    max-width: 1400px;
    margin: 4rem auto;
    padding: 2rem 5%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: 2rem;
    width: 100%;
}

.feature-card {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.8s ease both;
    width: 100%;
}

.feature-card:nth-child(1) { animation-delay: 0.3s; }
.feature-card:nth-child(2) { animation-delay: 0.4s; }
.feature-card:nth-child(3) { animation-delay: 0.5s; }

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.feature-icon {
    width: 70px;
    height: 70px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    color: white;
}

.feature-card h3 {
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.feature-card p {
    color: var(--text-muted);
    font-size: clamp(0.9rem, 1.5vw, 1.05rem);
    line-height: 1.6;
}

/* ========================================
   DEMO CHATBOT SECTION
   ======================================== */
.demo-section {
    max-width: 900px;
    margin: 5rem auto;
    padding: 2rem 5%;
    width: 100%;
}

.demo-section h2 {
    text-align: center;
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 3rem;
    animation: fadeInUp 0.8s ease both;
    color: var(--text-dark);
}

.chatbot-container {
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 0.8s ease 0.6s both;
    width: 100%;
}

.chatbot-header {
    background: var(--gradient-primary);
    color: white;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chatbot-header h3 {
    font-size: clamp(1rem, 2vw, 1.3rem);
}

.chat-messages {
    height: min(400px, 50vh);
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--bg-light);
}

.message {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.75rem;
    animation: messageSlide 0.3s ease;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.message.bot .message-avatar {
    background: var(--gradient-primary);
    color: white;
}

.message.user .message-avatar {
    background: var(--primary-dark);
    color: white;
}

.message-content {
    background: var(--bg-card);
    padding: 0.9rem 1.2rem;
    border-radius: 12px;
    max-width: 75%;
    border: 1px solid var(--border);
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    line-height: 1.5;
    word-wrap: break-word;
}

.message.user .message-content {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.chat-input-container {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 1rem;
    background: var(--bg-card);
}

.chat-input {
    flex: 1;
    padding: 0.9rem 1.2rem;
    border: 2px solid var(--border);
    border-radius: 25px;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    transition: border-color 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
}

.send-button {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.send-button:hover {
    transform: scale(1.1);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.loading-indicator {
    display: none;
    padding: 0.5rem;
}

.loading-indicator.active {
    display: block;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ========================================
   FOOTER
   ======================================== */
footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 3rem 5%;
    text-align: center;
    margin-top: 5rem;
    color: var(--text-muted);
    width: 100%;
}

footer p {
    font-size: clamp(0.9rem, 1.5vw, 1.05rem);
    margin: 0.5rem 0;
}

/* ========================================
   RESPONSIVE - TABLETS
   ======================================== */
@media (max-width: 1024px) {
    :root {
        --header-height: 180px;
    }

    .logo-img {
        height: 140px;
        max-width: 35vw;
    }

    nav {
        gap: 1.5rem;
    }

    .nav-links {
        gap: 1.5rem;
    }

    .nav-links a {
        font-size: 1rem;
    }
}

/* ========================================
   RESPONSIVE - TABLETS PEQUEÑAS
   ======================================== */
@media (max-width: 768px) {
    :root {
        --header-height: 100px;
    }

    header {
        padding: 1rem 4%;
    }

    .logo-img {
        height: 70px;
        max-width: 180px;
    }

    .logo-text {
        font-size: 1.3rem;
    }

    nav {
        gap: 1rem;
    }

    .nav-links {
        gap: 1.2rem;
    }

    .nav-links a {
        font-size: 0.95rem;
    }

    .theme-toggle {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }

    .hero {
        margin: 2rem auto;
        padding: 2rem 4%;
    }

    .features {
        grid-template-columns: 1fr;
        padding: 2rem 4%;
        gap: 1.5rem;
    }

    .message-content {
        max-width: 80%;
    }

    .demo-section {
        padding: 2rem 4%;
    }
}

/* ========================================
   RESPONSIVE - MÓVILES
   ======================================== */
@media (max-width: 480px) {
    :root {
        --header-height: 90px;
    }

    header {
        padding: 0.8rem 3%;
    }

    .logo-img {
        height: 55px;
        max-width: 140px;
    }

    .logo-text {
        font-size: 1.1rem;
    }

    .nav-links {
        gap: 0.8rem;
    }

    .nav-links a {
        font-size: 0.85rem;
        padding: 0.3rem 0;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .hero {
        padding: 1.5rem 3%;
    }

    .features {
        padding: 1.5rem 3%;
    }

    .feature-card {
        padding: 1.8rem;
    }

    .demo-section {
        padding: 1.5rem 3%;
        margin: 3rem auto;
    }

    .chat-input-container {
        padding: 1rem;
    }

    .send-button {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    footer {
        padding: 2rem 3%;
    }
}

/* ========================================
   RESPONSIVE - MÓVILES MUY PEQUEÑOS
   ======================================== */
@media (max-width: 360px) {
    :root {
        --header-height: 80px;
    }

    .logo-img {
        height: 45px;
        max-width: 120px;
    }

    .logo-text {
        font-size: 1rem;
    }

    .nav-links a {
        font-size: 0.8rem;
    }

    .theme-toggle {
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }
}

/* ========================================
   PANTALLAS ULTRA ANCHAS
   ======================================== */
@media (min-width: 1920px) {
    nav,
    .hero,
    .features,
    .demo-section {
        max-width: 1600px;
    }
}

/* ========================================
   SCROLL SUAVE PARA SECCIONES
   ======================================== */
section {
    scroll-margin-top: var(--header-height);
}