/* ==========================================================================
   SaeSpartner — AI Chat Assistant Widget
   Premium glassmorphism design matching brand palette
   ========================================================================== */

/* --- Chatbot Floating Trigger Button --- */
.chatbot-trigger {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #10367D 0%, #1a4a9e 50%, #74B4D9 100%);
    box-shadow:
        0 6px 24px rgba(16, 54, 125, 0.35),
        0 0 0 0 rgba(116, 180, 217, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: chatbot-pulse 2.5s infinite;
}

.chatbot-trigger:hover {
    transform: scale(1.1);
    box-shadow:
        0 8px 32px rgba(16, 54, 125, 0.45),
        0 0 0 8px rgba(116, 180, 217, 0.15);
}

.chatbot-trigger svg {
    width: 28px;
    height: 28px;
    fill: #fff;
    transition: transform 0.3s ease;
}

.chatbot-trigger.active svg.chat-icon {
    display: none;
}

.chatbot-trigger svg.close-icon {
    display: none;
}

.chatbot-trigger.active svg.close-icon {
    display: block;
}

@keyframes chatbot-pulse {
    0%, 100% { box-shadow: 0 6px 24px rgba(16, 54, 125, 0.35), 0 0 0 0 rgba(116, 180, 217, 0.4); }
    50% { box-shadow: 0 6px 24px rgba(16, 54, 125, 0.35), 0 0 0 12px rgba(116, 180, 217, 0); }
}

.chatbot-trigger.active {
    animation: none;
    background: linear-gradient(135deg, #0B285E 0%, #10367D 100%);
}

/* --- Notification Badge --- */
.chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body, 'Inter', sans-serif);
    border: 2px solid #fff;
    animation: chatbot-badge-bounce 1s ease infinite;
}

@keyframes chatbot-badge-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.chatbot-badge.hidden {
    display: none;
}

/* --- Chat Window Container --- */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    z-index: 9998;
    width: 400px;
    max-height: 600px;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(16, 54, 125, 0.12);
    box-shadow:
        0 20px 60px rgba(16, 54, 125, 0.18),
        0 8px 24px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.chatbot-window.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* --- Chat Header --- */
.chatbot-header {
    background: linear-gradient(135deg, #10367D 0%, #1a4a9e 60%, #2157b3 100%);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
}

.chatbot-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(116, 180, 217, 0.25) 0%, transparent 70%);
    border-radius: 50%;
}

.chatbot-header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: 10%;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(116, 180, 217, 0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.chatbot-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chatbot-avatar svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}

.chatbot-header-info {
    flex: 1;
    position: relative;
    z-index: 1;
}

.chatbot-header-info h3 {
    color: #fff;
    font-family: var(--font-display, 'Urbanist', sans-serif);
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.chatbot-header-info p {
    color: rgba(255, 255, 255, 0.75);
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 12px;
    margin: 2px 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-online-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
    animation: chatbot-online-pulse 2s infinite;
}

@keyframes chatbot-online-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chatbot-header-close {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

.chatbot-header-close:hover {
    background: rgba(255, 255, 255, 0.22);
}

.chatbot-header-close svg {
    width: 16px;
    height: 16px;
    stroke: #fff;
    fill: none;
    stroke-width: 2;
}

/* --- Chat Messages Area --- */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 300px;
    max-height: 380px;
    background: linear-gradient(180deg, #f8fafd 0%, #ffffff 100%);
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(16, 54, 125, 0.15);
    border-radius: 10px;
}

/* --- Message Bubbles --- */
.chatbot-msg {
    display: flex;
    gap: 10px;
    max-width: 88%;
    animation: chatbot-msg-in 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes chatbot-msg-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chatbot-msg.bot {
    align-self: flex-start;
}

.chatbot-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chatbot-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.chatbot-msg.bot .chatbot-msg-avatar {
    background: linear-gradient(135deg, #10367D, #1a4a9e);
}

.chatbot-msg.user .chatbot-msg-avatar {
    background: linear-gradient(135deg, #74B4D9, #5FA7D2);
}

.chatbot-msg-avatar svg {
    width: 14px;
    height: 14px;
    fill: #fff;
}

.chatbot-msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 13.5px;
    line-height: 1.55;
    position: relative;
}

.chatbot-msg.bot .chatbot-msg-bubble {
    background: #fff;
    color: #1e293b;
    border: 1px solid rgba(16, 54, 125, 0.08);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(16, 54, 125, 0.06);
}

.chatbot-msg.user .chatbot-msg-bubble {
    background: linear-gradient(135deg, #10367D 0%, #1a4a9e 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 12px rgba(16, 54, 125, 0.2);
}

.chatbot-msg-bubble a {
    color: #10367D;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
}

.chatbot-msg.user .chatbot-msg-bubble a {
    color: #b8d9f0;
}

/* --- Quick Reply Chips --- */
.chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0 8px;
    animation: chatbot-msg-in 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-quick-chip {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1.5px solid rgba(16, 54, 125, 0.18);
    background: rgba(16, 54, 125, 0.04);
    color: #10367D;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.chatbot-quick-chip:hover {
    background: #10367D;
    color: #fff;
    border-color: #10367D;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 54, 125, 0.25);
}

/* --- Typing Indicator --- */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    animation: chatbot-msg-in 0.3s ease;
}

.chatbot-typing-avatar {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: linear-gradient(135deg, #10367D, #1a4a9e);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chatbot-typing-avatar svg {
    width: 14px;
    height: 14px;
    fill: #fff;
}

.chatbot-typing-dots {
    display: flex;
    gap: 5px;
    background: #fff;
    padding: 12px 18px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(16, 54, 125, 0.08);
    box-shadow: 0 2px 8px rgba(16, 54, 125, 0.06);
}

.chatbot-typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10367D;
    opacity: 0.4;
    animation: chatbot-dot-bounce 1.4s infinite ease-in-out;
}

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

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

@keyframes chatbot-dot-bounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* --- Input Area --- */
.chatbot-input-area {
    padding: 14px 16px;
    border-top: 1px solid rgba(16, 54, 125, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.95);
}

.chatbot-input {
    flex: 1;
    border: 1.5px solid rgba(16, 54, 125, 0.12);
    border-radius: 14px;
    padding: 11px 16px;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 13.5px;
    color: #1e293b;
    background: #f8fafd;
    outline: none;
    transition: all 0.25s ease;
}

.chatbot-input::placeholder {
    color: #94a3b8;
}

.chatbot-input:focus {
    border-color: #10367D;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(16, 54, 125, 0.08);
}

.chatbot-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #10367D, #1a4a9e);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(16, 54, 125, 0.3);
}

.chatbot-send-btn:active {
    transform: scale(0.95);
}

.chatbot-send-btn svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* --- Powered By --- */
.chatbot-powered {
    text-align: center;
    padding: 8px;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 10.5px;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.3px;
}

.chatbot-powered strong {
    color: #10367D;
    font-weight: 600;
}

/* --- Welcome Toast (auto-popup greeting) --- */
.chatbot-welcome-toast {
    position: fixed;
    bottom: 100px;
    right: 28px;
    z-index: 9997;
    background: #fff;
    padding: 14px 20px;
    border-radius: 16px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 8px 32px rgba(16, 54, 125, 0.15);
    border: 1px solid rgba(16, 54, 125, 0.08);
    max-width: 280px;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 13.5px;
    color: #1e293b;
    line-height: 1.5;
    transform: translateY(10px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.chatbot-welcome-toast.show {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.chatbot-welcome-toast-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: rgba(16, 54, 125, 0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #64748b;
    transition: all 0.2s ease;
}

.chatbot-welcome-toast-close:hover {
    background: rgba(16, 54, 125, 0.15);
}

/* --- Mobile Responsive --- */
@media (max-width: 480px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
    }

    .chatbot-window.open {
        border-radius: 20px 20px 0 0;
    }

    .chatbot-messages {
        max-height: calc(100vh - 200px);
        max-height: calc(100dvh - 200px);
    }

    .chatbot-trigger {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }

    .chatbot-trigger svg {
        width: 24px;
        height: 24px;
    }

    .chatbot-welcome-toast {
        bottom: 86px;
        right: 20px;
        max-width: 250px;
    }
}
