/* ==========================================================================
   AVIFONE - ASISTENTE VIRTUAL PERSONALIZADO (DR. NADIR SALAUES)
   Luxury Palette: Obsidian Black & Pure Gold Trilogy
   ========================================================================== */

:root {
    --avi-primary: #121212;
    --avi-primary-dark: #000000;
    --avi-gold-bright: #FFD700;
    --avi-gold-primary: #D7B615;
    --avi-gold-deep: #DAA520;
    --avi-gold-rgb: 215, 182, 21;
}

/* Botón Flotante del Asistente Virtual */
.chat-icon {
    position: fixed;
    bottom: 25px;
    left: 25px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
    color: var(--avi-gold-bright);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(var(--avi-gold-rgb), 0.45);
    z-index: 9100;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    border: 2px solid var(--avi-gold-bright);
    animation: iconBounce 0.6s ease-out;
}

.chat-icon:hover {
    transform: translateY(-3px) scale(1.08);
    box-shadow: 0 12px 35px rgba(var(--avi-gold-rgb), 0.7);
    color: #ffffff;
}

.chat-icon i {
    font-size: 30px;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

@keyframes iconBounce {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Ventana Principal del Chat */
.chat-window {
    display: none;
    position: fixed;
    bottom: 100px;
    left: 25px;
    width: 380px;
    height: 530px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(var(--avi-gold-rgb), 0.3);
    flex-direction: column;
    z-index: 9000;
    overflow: hidden;
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', sans-serif;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 768px) {
    .chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        max-width: 100vw;
        max-height: 100vh;
    }

    .chat-header {
        border-radius: 0 !important;
        font-size: 1.15em !important;
        padding: 16px 15px !important;
    }

    .chat-input {
        padding: 12px 10px !important;
    }

    #user-input {
        font-size: 1em;
    }
}

/* Cabecera del Chat */
.chat-header {
    background: linear-gradient(135deg, #121212 0%, #1f1f1f 100%);
    color: #ffffff;
    padding: 18px 20px;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    border-bottom: 2px solid var(--avi-gold-primary);
}

.chat-header span {
    font-weight: 700;
    font-size: 1.05em;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
}

.chat-header span i {
    color: var(--avi-gold-bright);
    font-size: 1.3em;
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 215, 0, 0.3);
    color: var(--avi-gold-bright);
    transform: scale(1.1);
}

/* Área de Mensajes */
.chat-messages {
    flex-grow: 1;
    padding: 20px 18px;
    overflow-y: auto;
    background: linear-gradient(180deg, #fdfbf7 0%, #f5eee0 100%);
    position: relative;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.04);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--avi-gold-primary);
    border-radius: 10px;
}

/* Formulario de Entrada */
.chat-input {
    padding: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 10px;
    background: #ffffff;
    align-items: center;
}

#user-input {
    flex-grow: 1;
    padding: 12px 16px;
    border: 1.5px solid rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    font-size: 0.92em;
    font-family: 'Inter', sans-serif;
    background: #fafafa;
    transition: all 0.3s ease;
    outline: none;
    color: #121212;
}

#user-input:focus {
    border-color: var(--avi-gold-primary);
    box-shadow: 0 0 0 3px rgba(var(--avi-gold-rgb), 0.2);
    background: #ffffff;
}

#user-input::placeholder {
    color: #c0c5cb !important;
    opacity: 0.32 !important;
    font-weight: 300 !important;
}

/* Botón de Enviar */
.send-btn {
    background: linear-gradient(135deg, var(--avi-gold-bright) 0%, var(--avi-gold-deep) 100%);
    color: #121212;
    border: none;
    border-radius: 12px;
    width: 46px;
    height: 46px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(var(--avi-gold-rgb), 0.4);
    flex-shrink: 0;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--avi-gold-rgb), 0.6);
}

.send-btn:active {
    transform: translateY(0);
}

.send-btn i {
    font-size: 20px;
    font-weight: bold;
}

/* Burbujas de Mensajes */
.message {
    margin: 12px 0;
    padding: 12px 16px;
    border-radius: 16px;
    max-width: 86%;
    font-size: 0.92em;
    line-height: 1.5;
    word-wrap: break-word;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #ffffff;
    align-self: flex-end;
    margin-left: auto;
    border: 1px solid rgba(var(--avi-gold-rgb), 0.35);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    border-bottom-right-radius: 4px;
}

.assistant-message {
    background: #ffffff;
    color: #1a1a1a;
    align-self: flex-start;
    border: 1px solid rgba(var(--avi-gold-rgb), 0.25);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.06);
    border-bottom-left-radius: 4px;
}

.assistant-message a {
    color: #a67c00;
    font-weight: 700;
    text-decoration: underline;
}

.welcome-message {
    text-align: center;
    color: #736b5e;
    font-size: 0.88em;
    padding: 14px;
}

.chat-popup,
.chat-popup.show,
.chat-popup.chat-popup-hidden {
    display: none !important;
}

/* Typing Dots Animation */
.typing-dots {
    display: inline-flex;
    gap: 3px;
    align-items: center;
    margin-right: 6px;
}

.typing-dots i {
    width: 5px;
    height: 5px;
    background: #d4af37;
    border-radius: 50%;
    animation: typingBlink 1.2s infinite ease-in-out;
}

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

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

@keyframes typingBlink {

    0%,
    100% {
        opacity: 0.2;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}