/* Chat Interface Styles - Modern & Professional */
.chat-interface {
    max-width: 750px;
    margin: 0 auto;
    background: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: auto;
    overflow: visible;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Sembunyikan chat history/welcome message di awal agar clean seperti Lovable */
.chat-history {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    flex-direction: column;
    gap: 1.5rem;
    scroll-behavior: smooth;
}

.chat-message {
    display: flex;
    gap: 1rem;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.system {
    align-self: flex-start;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 2px;
}

.message-avatar svg {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
}

.message-avatar.user-avatar {
    background: linear-gradient(135deg, #84cc16 0%, #65a30d 100%);
    box-shadow: 0 2px 8px rgba(132, 204, 22, 0.25);
}

.message-avatar.ai-avatar {
    background: linear-gradient(135deg, #bae6fd 0%, #7dd3fc 100%);
    box-shadow: 0 2px 8px rgba(125, 211, 252, 0.35);
}

.message-content {
    padding: 1rem 1.5rem;
    border-radius: 18px;
    font-size: 1rem;
    line-height: 1.6;
    position: relative;
}

.chat-message.user .message-content {
    background: transparent;
    padding: 0;
    margin-top: 1rem;
    margin-bottom: 1rem;
    animation: fadeIn 0.5s ease;
}

.chat-message.results .message-content {
    background: transparent;
    border: none;
    padding: 0.5rem;
}

.no-results-banner {
    padding: 0.85rem 1.25rem;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #9a3412;
    font-weight: 500;
}

/* Chat Input Area - Initial State (Lovable Style) */
.chat-input-area {
    padding: 0;
    border-top: none;
    background: transparent;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
}

.chat-input-wrapper {
    flex: 1;
    position: relative;
}

#chat-input {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.9375rem;
    font-weight: 400;
    max-height: 200px;
    min-height: 80px;
    /* 3 rows height */
    height: 80px;
    resize: none;
    outline: none;
    transition: all 0.15s ease;
    background-color: #ffffff;
    color: #1a1a1a;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

#chat-input:focus {
    border-color: #b8b8b8;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

#chat-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* Hide send button - use Enter key instead */
.send-btn {
    display: none;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: bounce 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;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Input Suggestions (Floating Chips) */
.input-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    min-height: 0;
    transition: all 0.3s ease;
}

.suggestion-chip {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 0.875rem;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    animation: slideUp 0.3s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

.suggestion-chip:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2);
}

.suggestion-label {
    width: 100%;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Clarification Options in Chat (Legacy - can be removed later) */
.chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.chat-option-btn {
    padding: 0.5rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--primary);
    background: white;
    color: var(--primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-option-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(132, 204, 22, 0.2);
}

/* Smooth Hero Transition */
.hero-section {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 500px;
    opacity: 1;
    overflow: hidden;
    margin-bottom: 3rem;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-interface {
        border-radius: 16px;
        height: 75vh;
    }

    .chat-input-area {
        padding: 0;
    }

    #chat-input {
        font-size: 16px;
        /* Prevent zoom on iOS */
    }
}

/* --- CHAT MODE (Active State) --- */
/* Ini aktif setelah user mulai chat */
body.chat-mode .content-wrapper {
    max-width: 100%;
    padding: 0;
}

body.chat-mode .chat-interface {
    max-width: 1000px;
    margin: 0 auto;
    background: transparent;
    border: none;
    box-shadow: none;
    height: auto;
    min-height: auto;
    overflow: visible;
    display: block;
}

body.chat-mode .chat-history {
    display: flex;
    padding: 2rem 1rem 140px 1rem;
    overflow: visible;
    height: auto;
}

/* Input Area pindah ke bawah (Fixed) */
body.chat-mode .chat-input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, #fafafa 70%, rgba(250, 250, 250, 0));
    padding: 2rem 1rem 2rem 1rem;
    z-index: 100;
    display: flex;
    justify-content: center;
}

body.chat-mode .chat-input-wrapper {
    max-width: 1000px;
    width: 100%;
}

/* Reset input height in chat mode to be more compact */
body.chat-mode #chat-input {
    min-height: 40px;
    height: 40px;
}

/* Hide hero when in chat mode */
body.chat-mode .hero-section {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    overflow: hidden;
}
