/**
 * Chatbot Widget Styles
 * Floating AI chat widget for occur corporate site
 *
 * @package occur
 */

/* ========================================
   Chatbot Bubble (FAB)
   ======================================== */
.chatbot-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--color-white);
    color: var(--color-black);
    border: none;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s var(--ease-out-expo), box-shadow 0.3s var(--ease-out-expo);
}

.chatbot-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.5);
}

.chatbot-bubble svg {
    width: 28px;
    height: 28px;
    transition: opacity 0.2s ease;
}

.chatbot-bubble .chatbot-icon-close {
    display: none;
}

.chatbot-bubble.is-open .chatbot-icon-chat {
    display: none;
}

.chatbot-bubble.is-open .chatbot-icon-close {
    display: block;
}

/* ========================================
   Chatbot Window
   ======================================== */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: var(--color-dark);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    transition: opacity 0.3s var(--ease-out-expo), transform 0.3s var(--ease-out-expo);
}

.chatbot-window.is-visible {
    display: flex;
}

.chatbot-window.is-active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ========================================
   Header
   ======================================== */
.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-black);
    flex-shrink: 0;
}

.chatbot-header-title {
    font-family: var(--font-en);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-white);
    letter-spacing: 0.02em;
}

.chatbot-header-subtitle {
    font-family: var(--font-ja);
    font-size: 11px;
    color: var(--color-light-gray);
    margin-top: 2px;
}

.chatbot-header-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--color-light-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
}

.chatbot-header-close:hover {
    background: var(--color-gray);
    color: var(--color-white);
}

.chatbot-header-close svg {
    width: 18px;
    height: 18px;
}

/* ========================================
   Messages Area
   ======================================== */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--color-gray);
    border-radius: 2px;
}

/* Welcome message */
.chatbot-welcome {
    text-align: center;
    padding: 20px 12px;
}

.chatbot-welcome-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.chatbot-welcome-text {
    font-family: var(--font-ja);
    font-size: 14px;
    color: var(--color-off-white);
    line-height: 1.7;
    margin-bottom: 4px;
}

.chatbot-welcome-sub {
    font-family: var(--font-ja);
    font-size: 12px;
    color: var(--color-light-gray);
    line-height: 1.6;
}

/* Suggestion chips */
.chatbot-suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 4px;
    margin-top: 8px;
}

.chatbot-suggestion-btn {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: var(--color-dark-gray);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    color: var(--color-off-white);
    font-family: var(--font-ja);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    line-height: 1.5;
}

.chatbot-suggestion-btn:hover {
    background: var(--color-gray);
    border-color: var(--color-mid-gray);
}

/* Message bubbles */
.chatbot-msg {
    display: flex;
    gap: 8px;
    max-width: 100%;
}

.chatbot-msg--user {
    justify-content: flex-end;
}

.chatbot-msg--assistant {
    justify-content: flex-start;
}

.chatbot-msg-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-family: var(--font-ja);
    font-size: 13px;
    line-height: 1.7;
    word-break: break-word;
}

.chatbot-msg-bubble--user {
    background: var(--color-white);
    color: var(--color-black);
    border-bottom-right-radius: 4px;
}

.chatbot-msg-bubble--assistant {
    background: var(--color-dark-gray);
    color: var(--color-off-white);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 4px;
}

.chatbot-msg-bubble--assistant a {
    color: var(--color-white);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.chatbot-msg-bubble--assistant a:hover {
    color: var(--color-accent);
}

/* Typing indicator */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}

.chatbot-typing span {
    width: 6px;
    height: 6px;
    background: var(--color-mid-gray);
    border-radius: 50%;
    animation: chatbot-typing-dot 1.4s infinite both;
}

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

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

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

/* Error message */
.chatbot-msg-error {
    font-size: 12px;
    color: #e57373;
    text-align: center;
    padding: 8px;
}

/* ========================================
   Input Area
   ======================================== */
.chatbot-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
    background: var(--color-black);
    flex-shrink: 0;
}

.chatbot-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--color-dark-gray);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 4px 4px 4px 14px;
    transition: border-color 0.2s ease;
}

.chatbot-input-wrap:focus-within {
    border-color: var(--color-mid-gray);
}

.chatbot-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--color-off-white);
    font-family: var(--font-ja);
    font-size: 13px;
    line-height: 1.5;
    padding: 8px 0;
    resize: none;
    max-height: 80px;
    outline: none;
}

.chatbot-input::placeholder {
    color: var(--color-mid-gray);
}

.chatbot-send-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--color-white);
    color: var(--color-black);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
}

.chatbot-send-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.chatbot-send-btn svg {
    width: 16px;
    height: 16px;
}

/* ========================================
   Mobile: Full-screen mode
   ======================================== */
@media (max-width: 768px) {
    .chatbot-bubble {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
    }

    .chatbot-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        border: none;
    }

    .chatbot-window.is-active {
        transform: translateY(0) scale(1);
    }

    .chatbot-bubble.is-open {
        display: none;
    }
}
