/* Base Reset and Fonts */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html, body {
    height: 100%;
    height: 100dvh; /* Mobile dynamic viewport height fix */
    margin: 0;
    padding: 0;
    background-color: #ffffff;
    color: #0d0d0d;
    overflow: hidden;
}

.chat-container {
    display: flex;
    height: 100%;
    width: 100vw;
}

/* =========================================================================
   Sidebar (Clean Light Gray)
   ========================================================================= */
.sidebar {
    width: 280px;
    background-color: #f9f9f9;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid #e5e5e5;
}

.sidebar h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0d0d0d;
    margin-bottom: 16px;
}

.sidebar-btn {
    width: 100%;
    background-color: #ffffff;
    border: 1px solid #e5e5e5;
    color: #0d0d0d;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: background-color 0.2s, border-color 0.2s;
}

.sidebar-btn:hover {
    background-color: #f0f0f0;
    border-color: #d1d5db;
}

.sidebar-info {
    font-size: 0.82rem;
    color: #4b5563;
    line-height: 1.7;
    background-color: #ffffff;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
}

.info-badge {
    display: inline-block;
    background-color: #d1fae5;
    color: #065f46;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    margin-bottom: 8px;
}

/* =========================================================================
   Main Chat Container (Crisp White)
   ========================================================================= */
.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    position: relative;
    height: 100%;
}

.chat-header {
    height: 60px;
    padding: 0 24px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #059669;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
}

/* Language Switcher */
.lang-switch-container {
    display: flex;
    align-items: center;
    background-color: #f3f4f6;
    border-radius: 20px;
    padding: 3px 6px;
    border: 1px solid #e5e5e5;
}

.lang-btn {
    background: none;
    border: none;
    padding: 3px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    border-radius: 14px;
    transition: all 0.2s;
}

.lang-btn.active {
    background-color: #ffffff;
    color: #0d0d0d;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.lang-divider {
    color: #d1d5db;
    font-size: 0.75rem;
}

/* =========================================================================
   Messages Layout
   ========================================================================= */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px 18%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    display: flex;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 12px;
    line-height: 1.65;
    font-size: 0.95rem;
    max-width: 88%;
    word-break: break-word;
}

.message .avatar {
    font-size: 1.2rem;
    user-select: none;
    line-height: 1.5;
}

.message.user {
    align-self: flex-end;
    background-color: #f4f4f4;
    color: #0d0d0d;
    flex-direction: row-reverse;
}

.message.assistant {
    align-self: flex-start;
    background-color: #ffffff;
    color: #1f2937;
    border: 1px solid #e5e5e5;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.message.assistant .content hr {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 12px 0;
}

.message.assistant .content ul {
    margin-left: 20px;
    margin-top: 6px;
}

/* =========================================================================
   Input Form (Floating Light Card)
   ========================================================================= */
.input-area {
    padding: 12px 18% 20px;
    background-color: #ffffff;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}

#chat-form {
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border-radius: 24px;
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: border-color 0.2s, box-shadow 0.2s;
}

#chat-form:focus-within {
    border-color: #0d0d0d;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#user-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #0d0d0d;
    font-size: 0.95rem;
    padding: 8px 6px;
}

#user-input::placeholder {
    color: #9ca3af;
}

#send-btn {
    background-color: #0d0d0d;
    border: none;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 18px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: opacity 0.2s;
}

#send-btn:hover {
    opacity: 0.85;
}

#send-btn:disabled {
    background-color: #e5e5e5;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 1;
}

.disclaimer {
    text-align: center;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 10px;
}

/* =========================================================================
   Mobile View Adjustments
   ========================================================================= */
@media (max-width: 820px) {
    .sidebar {
        display: none;
    }
    .messages-container {
        padding-left: 14px;
        padding-right: 14px;
        padding-top: 16px;
    }
    .input-area {
        padding-left: 14px;
        padding-right: 14px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}