/* ==============================================
   Fleeks Chat Widget - Apple-Minimalist Style
   ============================================== */

/* Chat Bubble (Floating Button) */
.fleeks-chat-bubble {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0066cc, #5856d6);
    color: #fff;
    border: none;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 102, 204, 0.35);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.fleeks-chat-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0, 102, 204, 0.45);
}

.fleeks-chat-bubble svg {
    width: 28px;
    height: 28px;
    transition: transform 0.3s ease;
}

.fleeks-chat-bubble.open svg {
    transform: rotate(90deg);
}

/* Badge (unread count) */
.fleeks-chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #ff3b30;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
}

.fleeks-chat-badge.show {
    opacity: 1;
    transform: scale(1);
}

/* Chat Window */
.fleeks-chat-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 380px;
    max-height: 560px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 12px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.06);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.fleeks-chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.fleeks-chat-header {
    background: linear-gradient(135deg, #0066cc, #5856d6);
    color: #ffffff;
    padding: 20px 20px 16px;
    flex-shrink: 0;
}

.fleeks-chat-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

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

.fleeks-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.fleeks-chat-header-text h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
    color: #ffffff;
}

.fleeks-chat-header-text p {
    font-size: 12px;
    margin: 2px 0 0;
    opacity: 0.85;
    color: #ffffff;
}

.fleeks-chat-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    font-size: 18px;
}

.fleeks-chat-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Messages Area */
.fleeks-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
    max-height: 320px;
    scroll-behavior: smooth;
}

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

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

.fleeks-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 4px;
}

/* Message Bubbles */
.fleeks-msg {
    max-width: 85%;
    animation: fleeksMsgIn 0.3s ease;
}

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

.fleeks-msg.user {
    align-self: flex-end;
}

.fleeks-msg-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.fleeks-msg.bot .fleeks-msg-bubble {
    background: #f5f5f7;
    color: #1d1d1f;
    border-bottom-left-radius: 6px;
}

.fleeks-msg.user .fleeks-msg-bubble {
    background: linear-gradient(135deg, #0066cc, #5856d6);
    color: #ffffff;
    border-bottom-right-radius: 6px;
}

/* Options (Buttons) */
.fleeks-chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    animation: fleeksMsgIn 0.3s ease;
}

.fleeks-chat-option {
    background: #ffffff;
    border: 1.5px solid #0066cc;
    color: #0066cc;
    padding: 8px 16px;
    border-radius: 980px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Noto Sans JP', -apple-system, sans-serif;
}

.fleeks-chat-option:hover {
    background: #0066cc;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.25);
}

/* Typing Indicator */
.fleeks-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #f5f5f7;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    align-self: flex-start;
    max-width: 70px;
}

.fleeks-typing-dot {
    width: 6px;
    height: 6px;
    background: #6e6e73;
    border-radius: 50%;
    animation: fleeksTyping 1.4s infinite;
}

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

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

/* Input Area */
.fleeks-chat-input-area {
    display: none;
    padding: 12px 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: #ffffff;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.fleeks-chat-input-area.active {
    display: flex;
}

.fleeks-chat-input {
    flex: 1;
    border: 1.5px solid rgba(0, 0, 0, 0.1);
    border-radius: 980px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: 'Noto Sans JP', -apple-system, sans-serif;
    outline: none;
    transition: border-color 0.2s ease;
    color: #1d1d1f;
    background: #ffffff;
}

.fleeks-chat-input:focus {
    border-color: #0066cc;
}

.fleeks-chat-input::placeholder {
    color: #6e6e73;
}

.fleeks-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0066cc, #5856d6);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.fleeks-chat-send:hover {
    transform: scale(1.06);
}

.fleeks-chat-send svg {
    width: 18px;
    height: 18px;
}

/* CTA inside chat */
.fleeks-chat-cta {
    display: inline-block;
    background: linear-gradient(135deg, #0066cc, #5856d6);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 980px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    margin-top: 8px;
    transition: all 0.2s ease;
}

.fleeks-chat-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 102, 204, 0.3);
}

/* Powered by footer */
.fleeks-chat-footer {
    padding: 8px 16px;
    text-align: center;
    font-size: 11px;
    color: #6e6e73;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    flex-shrink: 0;
}

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

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

@keyframes fleeksTyping {

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

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

/* Prompt Banner */
.fleeks-chat-prompt {
    position: fixed;
    bottom: 96px;
    right: 28px;
    background: #ffffff;
    color: #1d1d1f;
    padding: 12px 20px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
    z-index: 9997;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: all 0.35s ease;
    max-width: 260px;
    font-family: 'Noto Sans JP', -apple-system, sans-serif;
}

.fleeks-chat-prompt.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    cursor: pointer;
}

.fleeks-chat-prompt-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    background: #6e6e73;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

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

    .fleeks-chat-bubble {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }

    .fleeks-chat-prompt {
        bottom: 84px;
        right: 20px;
        left: 20px;
        max-width: none;
    }

    .fleeks-chat-messages {
        max-height: 50vh;
    }
}