/* --- Smart Chat Widget Styles --- */
.chat-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-tooltip {
    background: white;
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    font-weight: 500;
    font-size: 14px;
    color: var(--blue-dark);
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    position: relative;
}

.chat-tooltip::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 8px 0 8px 8px;
    border-style: solid;
    border-color: transparent transparent transparent white;
}

.chat-tooltip.show {
    opacity: 1;
    transform: translateX(0);
}

.launcher-icon {
    width: 65px;
    height: 65px;
    background: #25d366; /* WhatsApp Green */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 30px;
    box-shadow: 0 10px 25px rgba(37, 211, 102, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    animation: pulseWA 2s infinite;
}

.launcher-icon:hover {
    transform: scale(1.1);
    animation: none;
}

.chat-widget {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    transform-origin: bottom right;
}

.chat-widget.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.chat-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-avatar {
    width: 45px;
    height: 45px;
    background: white;
    border-radius: 50%;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-avatar img {
    width: 100%;
    height: auto;
    border-radius: 50%;
}

.chat-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.chat-header p {
    margin: 0;
    font-size: 12px;
    color: #4ade80; /* online green */
}

.close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.close-chat:hover {
    opacity: 1;
}

.chat-messages {
    flex: 1;
    background: #e5ddd5; /* whatsapp chat bg */
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.4;
    animation: fadeUp 0.3s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bot-message {
    background: #fff;
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid var(--glass-border);
}

.user-message {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
    box-shadow: 0 4px 15px rgba(15, 34, 74, 0.2);
}

.chat-input-area {
    padding: 15px;
    background: #f0f0f0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input-area input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    border-radius: 20px;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.chat-input-area button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #008f68;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    font-size: 18px;
}

.chat-input-area button:hover {
    transform: scale(1.1);
}

/* --- Responsive Chat Widget --- */
@media (max-width: 768px) {
    .chat-launcher {
        bottom: 20px;
        right: 20px;
    }
    .launcher-icon {
        width: 55px;
        height: 55px;
        font-size: 26px;
    }
    .chat-tooltip {
        display: none;
    }
    .chat-widget {
        width: calc(100% - 20px);
        height: calc(100dvh - 80px);
        right: 10px;
        bottom: 10px;
        border-radius: 16px;
        max-height: 600px;
    }
    .chat-header {
        padding: 12px 15px;
    }
    .chat-avatar {
        width: 38px;
        height: 38px;
    }
    .chat-header h4 {
        font-size: 14px;
    }
    .chat-messages {
        padding: 15px;
        gap: 12px;
    }
    .message {
        max-width: 90%;
        font-size: 13px;
        padding: 10px 14px;
    }
    .chat-input-area {
        padding: 10px;
        gap: 8px;
    }
    .chat-input-area input {
        padding: 10px 14px;
        font-size: 14px;
    }
    .chat-input-area button {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 16px;
    }
}

@media (max-width: 400px) {
    .chat-widget {
        width: 100%;
        height: 100dvh;
        right: 0;
        bottom: 0;
        border-radius: 0;
        max-height: none;
    }
    .chat-widget.active ~ .chat-launcher {
        display: none;
    }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
    .chat-widget {
        height: 100dvh;
        bottom: 0;
        right: 0;
        width: 60%;
        border-radius: 16px 0 0 16px;
        max-height: none;
    }
}
