/* Chat UI - Garden Eight Style */

.chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-overlay);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: overlayFadeIn 0.3s ease;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Chat Container */
.chat-container {
    width: 92%;
    max-width: 420px;
    height: 70vh;
    max-height: 600px;
    background: var(--color-white);
    border-radius: var(--border-radius-xl);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: containerSlideUp 0.4s var(--ease-out-expo);
    overflow: hidden;
}

@keyframes containerSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Close Button */
.chat-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    font-size: 18px;
    color: var(--color-stone);
    background: var(--color-base);
    border: none;
    border-radius: var(--border-radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.chat-close:hover {
    background: var(--color-mist);
    color: var(--color-ink);
}

/* Messages Area */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 60px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* Message Bubble */
.message {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: var(--border-radius-lg);
    line-height: 1.6;
    font-size: var(--font-size-sm);
    animation: messageAppear 0.3s ease;
    position: relative;
}

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

.message.user {
    align-self: flex-end;
    background: var(--color-ink);
    color: var(--color-white);
    border-bottom-right-radius: var(--border-radius-sm);
}

.message.assistant {
    align-self: flex-start;
    background: var(--color-base);
    color: var(--color-ink);
    border-bottom-left-radius: var(--border-radius-sm);
}

.message.system {
    align-self: center;
    background: transparent;
    color: var(--color-stone);
    font-size: var(--font-size-xs);
    text-align: center;
    padding: 8px 16px;
    max-width: 100%;
}

/* Suggested Shops */
.suggested-shops {
    align-self: flex-start;
    max-width: 88%;
    margin-top: 8px;
    animation: messageAppear 0.3s ease;
}

.suggested-shops-label {
    font-size: var(--font-size-xs);
    color: var(--color-stone);
    margin-bottom: 10px;
    padding-left: 4px;
    letter-spacing: var(--letter-spacing-wide);
}

.suggested-shop-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.suggested-shop-item {
    padding: 12px 16px;
    background: var(--color-white);
    border: 1px solid var(--color-mist);
    border-radius: var(--border-radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.suggested-shop-item:hover {
    border-color: var(--color-ink);
    transform: translateX(4px);
}

.suggested-shop-name {
    font-family: var(--font-heading);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-ink);
    margin-bottom: 2px;
}

.suggested-shop-category {
    font-size: var(--font-size-xs);
    color: var(--color-stone);
}

/* Generate Map Button */
.chat-actions {
    padding: 16px 20px;
    background: transparent;
    display: flex;
    justify-content: center;
}

.chat-generate-map {
    width: 100%;
    padding: 16px 24px;
    background: var(--color-onsen);
    color: var(--color-white);
    border: none;
    border-radius: var(--border-radius-full);
    font-size: var(--font-size-sm);
    font-weight: 400;
    font-family: inherit;
    letter-spacing: var(--letter-spacing-wide);
    cursor: pointer;
    transition: all var(--transition-base);
}

.chat-generate-map:hover {
    background: var(--color-onsen-deep);
    transform: translateY(-2px);
}

.chat-generate-map:active {
    transform: translateY(0);
}

.chat-generate-map:disabled {
    background: var(--color-mist);
    color: var(--color-stone);
    cursor: not-allowed;
}

/* Input Area */
.chat-input-form {
    display: flex;
    gap: 12px;
    padding: 20px;
    background: var(--color-white);
    border-top: 1px solid var(--color-mist);
}

.chat-input {
    flex: 1;
    padding: 14px 20px;
    background: var(--color-base);
    border: 1px solid transparent;
    border-radius: var(--border-radius-full);
    font-size: var(--font-size-sm);
    font-family: inherit;
    color: var(--color-ink);
    transition: all var(--transition-fast);
}

.chat-input:focus {
    outline: none;
    border-color: var(--color-ink);
    background: var(--color-white);
}

.chat-input::placeholder {
    color: var(--color-stone);
}

.chat-submit {
    width: 48px;
    height: 48px;
    background: var(--color-ink);
    color: var(--color-white);
    border: none;
    border-radius: var(--border-radius-full);
    font-size: var(--font-size-base);
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-submit:hover {
    background: var(--color-ink-soft);
    transform: scale(1.05);
}

.chat-submit:active {
    transform: scale(0.95);
}

.chat-submit:disabled {
    background: var(--color-mist);
    color: var(--color-stone);
    cursor: not-allowed;
    transform: none;
}

/* Typing Indicator */
.typing-indicator {
    align-self: flex-start;
    padding: 16px 20px;
    background: var(--color-base);
    border-radius: var(--border-radius-lg);
    border-bottom-left-radius: var(--border-radius-sm);
    display: flex;
    gap: 6px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-stone);
    animation: typingPulse 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingPulse {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    30% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Scrollbar */
.messages::-webkit-scrollbar {
    width: 4px;
}

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

.messages::-webkit-scrollbar-thumb {
    background: var(--color-mist);
    border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: var(--color-stone);
}

/* Responsive */
@media (max-width: 768px) {
    .chat-container {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
    }

    .messages {
        padding-top: 70px;
    }

    .message {
        max-width: 85%;
    }

    .chat-input-form {
        padding: 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
}
