/* Chat Widget Styles - OptionsTopo Theme */

.ot-chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 15px;
    z-index: 2147483647 !important;
    /* Force Max Z-Index on Container */
    pointer-events: none;
    /* Allow clicks to pass through empty space */
}

/* Ensure children recapture pointer events */
.chat-fab,
.chat-window {
    pointer-events: auto;
}

/* --- Floating Action Button (FAB) --- */
/* --- Floating Action Button (FAB) --- */
.chat-fab {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    /* Vibrant Gradient: Deep Blue to OptionsTopo Green */
    background: linear-gradient(135deg, #0f53eb 0%, #00ff9d 100%);
    border: none;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(15, 83, 235, 0.4), 0 0 15px rgba(0, 255, 157, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    backdrop-filter: blur(4px);
    z-index: 2147483647 !important;
    /* Force Max Z-Index on Button */
    overflow: visible !important;
    padding: 0;
    margin: 0;
}

/* Pulse Animation for Idle State */
.chat-fab::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid rgba(0, 255, 157, 0.5);
    animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
    z-index: -1;
}

.chat-fab:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 10px 30px rgba(15, 83, 235, 0.5), 0 0 25px rgba(0, 255, 157, 0.5);
}

.chat-fab i {
    width: 32px;
    height: 32px;
    transition: transform 0.3s ease;
    stroke-width: 2.5px;
    /* Thicker Icon */
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.9);
        opacity: 1;
    }

    70% {
        transform: scale(1.3);
        opacity: 0;
    }

    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

.chat-fab .icon-close {
    display: none;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #FF3B30;
    color: white;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #0f111a;
    animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* --- Chat Window --- */
.chat-window {
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background: radial-gradient(circle at top left, rgba(26, 30, 46, 0.95), rgba(15, 17, 26, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(0, 255, 157, 0.2);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    backdrop-filter: blur(16px);
}

/* Active State (Open) */
.ot-chat-widget.active .chat-window {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.ot-chat-widget.active .chat-fab {
    transform: rotate(180deg);
    background: rgba(0, 255, 157, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.ot-chat-widget.active .icon-open {
    display: none;
}

.ot-chat-widget.active .icon-close {
    display: block;
    transform: rotate(-180deg);
}

.ot-chat-widget.active .notification-badge {
    display: none;
}


/* --- Header --- */
.chat-header {
    padding: 20px;
    background: linear-gradient(135deg, rgba(0, 255, 157, 0.1) 0%, rgba(0, 0, 0, 0) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.avatar-group {
    position: relative;
    width: 40px;
    height: 40px;
}

.bot-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(0, 255, 157, 0.3);
    object-fit: cover;
    background: #000;
}

.status-dot {
    position: absolute;
    bottom: 2px;
    right: 0;
    width: 10px;
    height: 10px;
    background: #00ff9d;
    border-radius: 50%;
    border: 2px solid #1a1e2e;
    box-shadow: 0 0 5px #00ff9d;
}

.chat-title {
    font-weight: 700;
    color: #fff;
    margin: 0;
    font-size: 16px;
}

.chat-status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    display: block;
}

.close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #fff;
}

/* --- Body --- */
.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Messages */
.message {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: fadeIn 0.3s ease;
}

.message.bot-message {
    align-self: flex-start;
}

.message.user-message {
    align-self: flex-end;
    align-items: flex-end;
}

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.bot-message .message-content {
    background: rgba(255, 255, 255, 0.05);
    color: #e0e0e0;
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.user-message .message-content {
    background: linear-gradient(135deg, rgba(0, 255, 157, 0.15), rgba(0, 200, 120, 0.15));
    color: #fff;
    border-bottom-right-radius: 2px;
    border: 1px solid rgba(0, 255, 157, 0.2);
    box-shadow: 0 2px 10px rgba(0, 255, 157, 0.05);
}

.message-time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    padding: 0 4px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border-bottom-left-radius: 2px;
    width: fit-content;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

/* --- Footer --- */
.chat-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
}

.chat-input-area {
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: border-color 0.2s;
}

.chat-input-area:focus-within {
    border-color: rgba(0, 255, 157, 0.4);
    box-shadow: 0 0 10px rgba(0, 255, 157, 0.05);
}

#chat-input {
    flex: 1;
    background: none;
    border: none;
    color: #fff;
    font-size: 14px;
    padding: 4px;
    outline: none;
}

#chat-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.send-btn {
    background: none;
    border: none;
    color: #00ff9d;
    cursor: pointer;
    padding: 4px;
    opacity: 0.5;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.send-btn:not(:disabled):hover {
    opacity: 1;
    transform: translateX(2px);
    text-shadow: 0 0 10px #00ff9d;
}

.send-btn:disabled {
    cursor: default;
    color: rgba(255, 255, 255, 0.2);
}

.branding {
    text-align: center;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.2);
    margin-top: 8px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

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

    50% {
        transform: scale(1.2);
    }

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

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 40px);
        height: 70vh;
        bottom: 80px;
        right: 20px;
    }

    .ot-chat-widget {
        right: 20px;
        bottom: 20px;
    }
}