:root {
    --verde-oscuro: #0c6c3e;
    --verde-claro: #60ad45;
    --verde-amarillento: #b9d539;
    --blanco: #ffffff;
    --gris-claro: #f5f5f5;
    --gris-medio: #e0e0e0;
    --gris-oscuro: #666666;
    --gris-texto: #333333;
    --rojo-error: #dc3545;
    --amarillo-suave: #fff9e6;
    --azul-info: #e3f2fd;
    --sombra: rgba(0, 0, 0, 0.1);
    --sombra-fuerte: rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--verde-oscuro) 0%, var(--verde-claro) 100%);
    color: var(--gris-texto);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== PÁGINA DE INICIO ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    padding: 30px 0;
}

.logo {
    max-width: 200px;
    height: auto;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.welcome-card {
    background: var(--blanco);
    border-radius: var(--border-radius);
    padding: 40px;
    max-width: 700px;
    width: 100%;
    box-shadow: 0 10px 40px var(--sombra-fuerte);
    animation: fadeInUp 0.6s ease;
}

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

.avatar-container {
    text-align: center;
    margin-bottom: 25px;
}

.assistant-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--verde-claro);
    box-shadow: 0 4px 15px rgba(96, 173, 69, 0.3);
    animation: fadeInScale 0.6s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.title {
    font-size: 26px;
    color: var(--verde-oscuro);
    text-align: center;
    margin-bottom: 15px;
    font-weight: 700;
}

.description {
    text-align: center;
    color: var(--gris-oscuro);
    font-size: 15px;
    margin-bottom: 25px;
    line-height: 1.7;
}

.features {
    display: grid;
    gap: 15px;
    margin-bottom: 25px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: var(--gris-claro);
    border-radius: 8px;
    transition: var(--transition);
}

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

.feature-item svg {
    width: 24px;
    height: 24px;
    color: var(--verde-claro);
    flex-shrink: 0;
}

.feature-item span {
    color: var(--gris-texto);
    font-weight: 500;
}

.info-boxes {
    display: grid;
    gap: 15px;
    margin-bottom: 25px;
}

.info-box {
    display: flex;
    gap: 15px;
    padding: 18px;
    border-radius: 10px;
    border-left: 4px solid;
    transition: var(--transition);
}

.info-box.experimental {
    background: var(--amarillo-suave);
    border-left-color: #ffc107;
}

.info-box.privacy {
    background: var(--azul-info);
    border-left-color: #2196f3;
}

.info-box:hover {
    transform: translateX(3px);
    box-shadow: 0 2px 8px var(--sombra);
}

.info-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.info-box.experimental .info-icon {
    background: rgba(255, 193, 7, 0.2);
}

.info-box.privacy .info-icon {
    background: rgba(33, 150, 243, 0.2);
}

.info-icon svg {
    width: 22px;
    height: 22px;
}

.info-box.experimental .info-icon svg {
    color: #f57c00;
}

.info-box.privacy .info-icon svg {
    color: #1976d2;
}

.info-box h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--gris-texto);
}

.info-box p {
    font-size: 13px;
    color: var(--gris-oscuro);
    line-height: 1.6;
    margin: 0;
}

.info-box strong {
    color: var(--gris-texto);
}

.legal-notice {
    background: #f8f9fa;
    border-left: 4px solid var(--verde-oscuro);
    padding: 18px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.legal-notice h3 {
    color: var(--verde-oscuro);
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: 600;
}

.legal-notice p {
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--gris-oscuro);
    line-height: 1.6;
}

.legal-notice p:last-child {
    margin-bottom: 0;
}

.emergency-info {
    background: var(--blanco);
    padding: 12px;
    border-radius: 6px;
    margin-top: 10px;
    border: 2px solid var(--verde-claro);
    font-size: 13px;
}

.consent-section {
    margin-bottom: 25px;
}

.checkbox-container {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    position: relative;
    padding-left: 35px;
}

.checkbox-container input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    left: 0;
    top: 2px;
    height: 22px;
    width: 22px;
    background-color: var(--blanco);
    border: 2px solid var(--gris-medio);
    border-radius: 4px;
    transition: var(--transition);
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--verde-claro);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--verde-claro);
    border-color: var(--verde-claro);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 11px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.consent-text {
    font-size: 14px;
    color: var(--gris-oscuro);
    line-height: 1.6;
}

.nickname-form {
    margin-top: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--verde-oscuro);
    margin-bottom: 8px;
    font-size: 15px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gris-medio);
    border-radius: 8px;
    font-size: 16px;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: var(--verde-claro);
    box-shadow: 0 0 0 3px rgba(96, 173, 69, 0.1);
}

.form-group input.error {
    border-color: var(--rojo-error);
}

.error-message {
    display: block;
    color: var(--rojo-error);
    font-size: 13px;
    margin-top: 6px;
    min-height: 20px;
}

.btn-primary {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--verde-claro), var(--verde-amarillento));
    color: var(--blanco);
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(96, 173, 69, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(96, 173, 69, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary svg {
    width: 20px;
    height: 20px;
}

.footer {
    text-align: center;
    padding: 20px;
    color: var(--blanco);
    font-size: 14px;
    opacity: 0.9;
}

/* ===== PÁGINA DE CHAT ===== */
.chat-page {
    background: var(--gris-claro);
}

.chat-container {
    max-width: 900px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--blanco);
    box-shadow: 0 0 30px var(--sombra);
}

.chat-header {
    background: linear-gradient(135deg, var(--verde-oscuro), var(--verde-claro));
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px var(--sombra);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-small {
    max-width: 120px;
    height: auto;
    filter: brightness(0) invert(1);
}

.header-info h2 {
    color: var(--blanco);
    font-size: 18px;
    margin: 0;
}

.user-greeting {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    margin: 0;
}

.btn-end {
    background: rgba(255, 255, 255, 0.2);
    color: var(--blanco);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-end:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-end svg {
    width: 18px;
    height: 18px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--gris-claro);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--gris-medio);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--gris-oscuro);
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: messageSlide 0.3s ease;
}

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

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

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

.bot-avatar {
    background: linear-gradient(135deg, var(--verde-claro), var(--verde-amarillento));
}

.user-avatar {
    background: linear-gradient(135deg, var(--verde-oscuro), var(--verde-claro));
}

.message-avatar svg {
    width: 22px;
    height: 22px;
    color: var(--blanco);
}

.message-content {
    max-width: 70%;
    padding: 14px 18px;
    border-radius: 12px;
    line-height: 1.6;
}

.message-content p {
    margin: 0 0 12px 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content strong {
    font-weight: 600;
    color: inherit;
}

.message-content em {
    font-style: italic;
}

.message-content ol,
.message-content ul {
    margin: 12px 0;
    padding-left: 24px;
}

.message-content ol {
    list-style-type: decimal;
}

.message-content ul {
    list-style-type: disc;
}

.message-content li {
    margin: 8px 0;
    line-height: 1.6;
}

.message-content li strong {
    display: inline-block;
    margin-right: 4px;
}

.bot-message .message-content {
    background: var(--gris-claro);
    color: var(--gris-texto);
    border-bottom-left-radius: 4px;
}

.bot-message .message-content ol {
    background: rgba(255, 255, 255, 0.5);
    padding: 12px 12px 12px 32px;
    border-radius: 8px;
    margin: 12px 0;
}

.bot-message .message-content ul {
    background: rgba(255, 255, 255, 0.5);
    padding: 12px 12px 12px 32px;
    border-radius: 8px;
    margin: 12px 0;
}

.bot-message .message-content li {
    margin: 10px 0;
}

.bot-message .message-content li::marker {
    color: var(--verde-claro);
    font-weight: 600;
}

.user-message .message-content {
    background: linear-gradient(135deg, var(--verde-claro), var(--verde-amarillento));
    color: var(--blanco);
    border-bottom-right-radius: 4px;
}

.typing-indicator {
    margin-bottom: 20px;
}

.typing-dots {
    display: flex;
    gap: 6px;
    padding: 8px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--gris-oscuro);
    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;
}

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

.chat-input-container {
    padding: 20px 25px;
    background: var(--blanco);
    border-top: 1px solid var(--gris-medio);
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#message-input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid var(--gris-medio);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 150px;
    transition: var(--transition);
}

#message-input:focus {
    outline: none;
    border-color: var(--verde-claro);
}

.btn-send {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--verde-claro), var(--verde-amarillento));
    color: var(--blanco);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(96, 173, 69, 0.3);
}

.btn-send:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(96, 173, 69, 0.4);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-send svg {
    width: 22px;
    height: 22px;
}

.input-hint {
    font-size: 12px;
    color: var(--gris-oscuro);
    margin-top: 8px;
    text-align: center;
}

/* ===== MODALES ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content {
    background: var(--blanco);
    padding: 35px;
    border-radius: var(--border-radius);
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlide 0.3s ease;
}

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

.modal-content h3 {
    color: var(--verde-oscuro);
    margin-bottom: 15px;
    font-size: 22px;
}

.modal-content p {
    color: var(--gris-oscuro);
    margin-bottom: 25px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-secondary {
    padding: 12px 24px;
    background: var(--gris-claro);
    color: var(--gris-texto);
    border: 1px solid var(--gris-medio);
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--gris-medio);
}

.btn-danger {
    padding: 12px 24px;
    background: var(--rojo-error);
    color: var(--blanco);
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-danger:hover {
    background: #c82333;
}

.error-content {
    text-align: center;
}

.error-icon {
    margin: 0 auto 20px;
    width: 60px;
    height: 60px;
    background: #fff3cd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-icon svg {
    width: 30px;
    height: 30px;
    color: #856404;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .welcome-card {
        padding: 30px 20px;
    }

    .title {
        font-size: 22px;
    }

    .description {
        font-size: 14px;
    }

    .assistant-avatar {
        width: 100px;
        height: 100px;
    }

    .logo {
        max-width: 150px;
    }

    .info-box {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .chat-header {
        padding: 15px 20px;
    }

    .logo-small {
        max-width: 100px;
    }

    .header-info h2 {
        font-size: 16px;
    }

    .btn-end span {
        display: none;
    }

    .chat-messages {
        padding: 20px 15px;
    }

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

    .chat-input-container {
        padding: 15px;
    }

    .modal-content {
        padding: 25px 20px;
    }

    .modal-actions {
        flex-direction: column;
    }

    .btn-secondary,
    .btn-danger {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .welcome-card {
        padding: 25px 15px;
    }

    .title {
        font-size: 20px;
    }

    .assistant-avatar {
        width: 90px;
        height: 90px;
    }

    .feature-item {
        font-size: 14px;
    }

    .info-box h3 {
        font-size: 14px;
    }

    .info-box p {
        font-size: 12px;
    }

    .legal-notice {
        padding: 15px;
    }

    .message-content {
        max-width: 85%;
        font-size: 14px;
    }
}