* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --gris: #434444;
    --azul: #095374;
    --verde: #b0bf3e;
    --verde-claro: #d0da89;
    --blanco: #e7ecea;
    --font-principal: 'Poppins', sans-serif;
}

/* ===== ICONO FLOTANTE DE WHATSAPP ===== */
.chat-icon {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #25D366;
    color: white;
    border: 4px solid var(--verde-claro);
    box-shadow: 0 10px 25px rgba(9, 83, 116, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    transition: all 0.3s ease;
    z-index: 9999;
}

.chat-icon:hover {
    background: #128C7E;
    transform: scale(1.1) rotate(5deg);
    border-color: var(--verde);
}

.chat-icon i {
    font-size: 2.8rem;
}

.chat-icon::after {
    content: "¿Necesitas ayuda?";
    position: absolute;
    right: 85px;
    background: var(--azul);
    color: white;
    padding: 8px 18px;
    border-radius: 40px;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
    border: 2px solid var(--verde-claro);
}

.chat-icon:hover::after {
    opacity: 1;
    visibility: visible;
    right: 95px;
}

/* ===== VENTANA DEL CHAT ===== */
.chat-popup {
    position: fixed;
    bottom: 120px;
    right: 30px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(9, 83, 116, 0.5);
    border: 3px solid var(--verde-claro);
    display: none;
    flex-direction: column;
    z-index: 9998;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chat-popup.show {
    display: flex;
}

/* ===== HEADER ===== */
.chat-header {
    background: linear-gradient(135deg, var(--azul) 0%, #0a6b9e 100%);
    padding: 1.5rem;
    position: relative;
}

.chat-header .estado {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--verde-claro);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.chat-header .estado i {
    font-size: 0.6rem;
    color: var(--verde);
}

.chat-header h3 {
    color: white;
    font-size: 1.3rem;
    font-weight: 600;
}

.chat-header .cerrar {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: var(--verde-claro);
    font-size: 1.3rem;
    cursor: pointer;
    width: 35px;
    height: 35px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-header .cerrar:hover {
    background: var(--verde);
    color: var(--gris);
}

/* ===== MENSAJES ===== */
.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: var(--blanco);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 85%;
}

.message.bot {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--azul);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    flex-shrink: 0;
    border: 2px solid var(--verde-claro);
}

.message.user .avatar {
    background: var(--verde);
    color: var(--gris);
}

.message .bubble {
    background: white;
    padding: 0.9rem 1.2rem;
    border-radius: 20px;
    border-top-left-radius: 5px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.message.user .bubble {
    background: var(--azul);
    color: white;
    border-top-right-radius: 5px;
    border-top-left-radius: 20px;
}

.message .bubble p {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.3rem;
}

.message .time {
    font-size: 0.65rem;
    opacity: 0.7;
    text-align: right;
}

.message.user .time {
    color: rgba(255, 255, 255, 0.8);
}

/* ===== OPCIONES RÁPIDAS ===== */
.opciones-rapidas {
    padding: 1rem 1.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    background: white;
    border-bottom: 2px solid var(--verde-claro);
}

.opcion-chip {
    background: var(--blanco);
    border: 2px solid var(--verde-claro);
    padding: 0.5rem 1rem;
    border-radius: 40px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--azul);
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.opcion-chip:hover {
    background: var(--verde);
    color: var(--gris);
    border-color: var(--azul);
    transform: translateY(-2px);
}

/* ===== INPUT ===== */
.chat-input {
    padding: 1rem 1.5rem;
    background: white;
    display: flex;
    gap: 0.8rem;
    border-top: 2px solid var(--verde-claro);
}

.chat-input input {
    flex: 1;
    padding: 0.8rem 1.2rem;
    border: 2px solid var(--verde-claro);
    border-radius: 50px;
    font-family: var(--font-principal);
    font-size: 0.9rem;
    outline: none;
}

.chat-input input:focus {
    border-color: var(--azul);
    box-shadow: 0 0 0 3px rgba(9, 83, 116, 0.1);
}

.chat-input button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--azul) 0%, #0a6b9e 100%);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--verde);
}

.chat-input button:hover {
    background: var(--verde);
    color: var(--gris);
    transform: scale(1.1);
}

/* ===== TYPING INDICATOR ===== */
.typing {
    display: flex;
    gap: 0.3rem;
    padding: 0.8rem 1.2rem;
    background: white;
    border-radius: 30px;
    border-top-left-radius: 5px;
    width: fit-content;
}

.typing span {
    width: 7px;
    height: 7px;
    background: var(--azul);
    border-radius: 50%;
    opacity: 0.5;
    animation: typing 1.4s infinite;
}

.typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ===== SCROLL PERSONALIZADO ===== */
.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--blanco);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--verde-claro);
    border-radius: 10px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 500px) {
    .chat-popup {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .chat-icon {
        bottom: 20px;
        right: 20px;
    }
}