/* Amperia Chatbot Styles - Imperio Electronic */

:root {
    --chat-primary: #0d6efd;
    --chat-dark: #11111f;
    --chat-light: #ffffff;
    --chat-glass: rgba(255, 255, 255, 0.9);
    --chat-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* Floating Avatar Button */
.amperia-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background: var(--chat-light);
    border-radius: 50%;
    box-shadow: var(--chat-shadow);
    cursor: pointer;
    z-index: 2000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--chat-primary);
    /* We remove overflow: hidden so tooltip can show outside */
}

/* Fail-safe to hide launcher when chat is open */
body.amperia-chat-open .amperia-launcher {
    display: none !important;
}

.amperia-launcher:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 35px rgba(13, 110, 253, 0.4);
}

.amperia-launcher img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%; /* Added since container overflow is not hidden */
}

.amperia-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--chat-primary);
    border-radius: 50%;
    opacity: 0.6;
    animation: amperiaPulse 2s infinite;
    z-index: -1;
}

@keyframes amperiaPulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.5); opacity: 0; }
}

.amperia-tooltip {
    position: absolute;
    right: 80px;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background: #fff;
    color: #333;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    pointer-events: none;
    font-family: 'Poppins', sans-serif;
    border: 1px solid #eee;
}

/* Constantly visible and bouncing when NOT hovered, or just bouncing on hover? Let's make it constantly visible and bouncing like the old one, but fade out on hover or click */
.amperia-tooltip.show-always {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
    animation: bounceLeft 2s infinite;
}

.amperia-launcher:hover .amperia-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

@keyframes bounceLeft {
    0%, 100% { transform: translateY(-50%) translateX(0); }
    50% { transform: translateY(-50%) translateX(-8px); }
}

.amperia-tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px 0 6px 6px;
    border-style: solid;
    border-color: transparent transparent transparent #fff;
}


/* Chat Window */
.amperia-window {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 60px);
    height: 550px;
    max-height: calc(100vh - 150px);
    background: var(--chat-glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 20px;
    box-shadow: var(--chat-shadow);
    z-index: 1999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.amperia-window.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

/* Header */
.amperia-header {
    background: var(--chat-dark);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--chat-primary);
}

#amperia-close {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    opacity: 0.8;
    transition: all 0.2s;
}

#amperia-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
    opacity: 1;
    transform: rotate(90deg);
}

.amperia-header-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.amperia-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--chat-primary);
    background: white;
    overflow: hidden;
}

.amperia-header-info h5 {
    margin: 0;
    font-size: 1.1rem;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
}

.amperia-header-info span {
    font-size: 0.75rem;
    opacity: 0.8;
}

.amperia-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    margin-right: 5px;
    box-shadow: 0 0 5px #28a745;
}

/* Messages Area */
.amperia-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(244, 247, 246, 0.5);
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
    position: relative;
    animation: messageIn 0.3s ease-out;
}

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

.message.bot {
    align-self: flex-start;
    background: white;
    color: var(--chat-dark);
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.message.user {
    align-self: flex-end;
    background: var(--chat-primary);
    color: white;
    border-bottom-right-radius: 2px;
    box-shadow: 0 4px 10px rgba(13, 110, 253, 0.2);
}

/* Typing Indicator */
.typing {
    display: none;
    align-self: flex-start;
    background: white;
    padding: 12px 16px;
    border-radius: 15px;
    border-bottom-left-radius: 2px;
    font-style: italic;
    font-size: 0.85rem;
    color: #888;
}

.typing-dot {
    display: inline-block;
    width: 4px;
    height: 4px;
    background: #888;
    border-radius: 50%;
    margin-right: 2px;
    animation: typingPulse 1s infinite alternate;
}

@keyframes typingPulse {
    from { opacity: 0.3; }
    to { opacity: 1; }
}

/* Options / Buttons */
.amperia-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}

.option-btn {
    background: white;
    border: 1px solid var(--chat-primary);
    color: var(--chat-primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.option-btn:hover {
    background: var(--chat-primary);
    color: white;
}

/* Footer / Input */
.amperia-footer {
    padding: 15px;
    background: #ffffff !important;
    border-top: 1px solid #eee;
    z-index: 10;
}

.amperia-input-group {
    display: flex;
    gap: 10px;
    background: #f8f9fa;
    padding: 5px 5px 5px 15px;
    border-radius: 25px;
    border: 1px solid #dee2e6;
    transition: all 0.2s;
}

.amperia-input-group:focus-within {
    border-color: var(--chat-primary);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.amperia-input-group input {
    flex-grow: 1;
    border: none;
    background: transparent;
    padding: 8px 0;
    font-size: 0.9rem;
    outline: none;
}

.amperia-send-btn {
    width: 35px;
    height: 35px;
    background: var(--chat-primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

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

/* Mobile Adjustments */
@media (max-width: 576px) {
    .amperia-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        height: 100dvh; /* Use dynamic viewport height for mobile */
        max-height: 100dvh;
        border-radius: 0;
    }
    
    .amperia-header {
        padding: 12px 15px;
    }

    .amperia-messages {
        padding: 15px;
        flex-basis: 0; /* Ensures it shrinks correctly to keep footer visible */
    }

    .amperia-footer {
        padding-bottom: env(safe-area-inset-bottom, 15px); /* Respect notch/home bar */
    }

    .option-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .amperia-launcher {
        bottom: 15px;
        right: 15px;
        width: 58px;
        height: 58px;
    }

    .amperia-tooltip {
        display: block !important; 
        right: 75px;
        font-size: 13px;
        width: max-content;
        max-width: calc(100vw - 100px);
        white-space: nowrap;
        line-height: 1.2;
        padding: 8px 12px;
        opacity: 1 !important;
        visibility: visible !important;
    }
}

.whatsapp-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #25D366; /* Official WhatsApp Green */
    color: #FFFFFF !important;
    padding: 12px 20px;
    border-radius: 50px; /* More rounded like the official button */
    text-decoration: none !important;
    font-weight: 600;
    margin-top: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    border: none;
    width: fit-content;
}

.whatsapp-chat-btn i {
    font-size: 1.2rem;
}

.whatsapp-chat-btn:hover {
    background: #128C7E; /* Official WhatsApp Dark Green */
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}

.whatsapp-chat-btn:active {
    transform: translateY(-1px) scale(0.98);
}
