/* --- 1. MODERN THEME & VARIABLES --- */
:root {
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --background: #111827; /* Dark navy blue */
    --surface: #1F2937;    /* Slightly lighter surface */
    --primary: #4f46e5;    /* A modern indigo */
    --primary-light: #6366f1;
    --text-primary: #F9FAFB;
    --text-secondary: #9CA3AF;
    --border-color: #374151;
    --user-msg-bg: linear-gradient(135deg, #4f46e5 0%, #a855f7 100%);
}

body.light-mode {
    --background: #F9FAFB;
    --surface: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #4B5563;
    --border-color: #E5E7EB;
    --user-msg-bg: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
}

/* --- 2. BASE & LAYOUT --- */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.app-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 100vh;
    padding: 0 16px;
}

/* --- 3. NAVIGATION --- */
.top-nav {
    width: 100%;
    background: rgba(17, 24, 39, 0.5); /* Semi-transparent dark bg */
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

body.light-mode .top-nav {
    background: rgba(255, 255, 255, 0.7);
}

.nav-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.nav-logo {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.nav-right {
    display: flex;
    gap: 24px;
}

.nav-right a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-right a:hover {
    color: var(--text-primary);
}


/* --- 4. CHAT CONTAINER & HEADER --- */
.chat-container {
    width: 100%;
    max-width: 840px;
    height: calc(100vh - 100px); /* Adjust height based on nav and padding */
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    transition: border-color 0.3s ease;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 36px;
    height: 36px;
}

.chat-header h1 {
    font-size: 18px;
    margin: 0;
    font-weight: 600;
    color: var(--text-primary);
}

.subtitle {
    font-size: 13px;
    margin: 0;
    color: var(--text-secondary);
}

.icon-button {
    background: transparent;
    border: none;
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.icon-button:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

/* --- 5. CHAT AREA & MESSAGES --- */
#chat-section {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
}

#chat-box {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Welcome Screen */
#welcome-screen {
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.welcome-logo {
    width: 60px;
    height: 60px;
    margin-bottom: 16px;
}

#welcome-screen h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 24px 0;
    color: var(--text-primary);
}

.suggestion-chips {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.chip {
    background: var(--surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.message {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    font-size: 15px;
    line-height: 1.5;
    animation: fadeIn 0.4s ease;
}

.user {
    align-self: flex-end;
    background: var(--user-msg-bg);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.bot {
    align-self: flex-start;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}
body.light-mode .bot {
    background: #f0f2f5;
}

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

/* --- 6. CHAT INPUT AREA --- */
.chat-input-area {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    transition: border-color 0.3s ease;
}

.chat-input {
    display: flex;
    align-items: center;
    background-color: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 4px 4px 4px 16px;
    transition: border-color 0.2s, background-color 0.3s ease;
}

.chat-input:focus-within {
    border-color: var(--primary);
}

#user-input {
    flex-grow: 1;
    border: none;
    background: transparent;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    padding: 10px 0;
}

#user-input::placeholder {
    color: var(--text-secondary);
}

#send-btn {
    background: var(--primary);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

#send-btn:hover {
    background: var(--primary-light);
}

.disclaimer {
    font-size: 12px;
    text-align: center;
    color: var(--text-secondary);
    margin: 12px 0 0 0;
}

/* --- 7. SCROLLBAR --- */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #4B5563;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #6B7280;
}

/* --- 6. CHAT INPUT AREA --- */

/* ... (keep the existing styles for .chat-input-area, .chat-input, etc.) ... */

/* ADD THIS NEW CODE BLOCK */
.footer-legal {
    font-size: 12px;
    text-align: center;
    color: var(--text-secondary);
    margin: 12px 0 0 0;
    padding: 0 10px; /* Adds space on small screens */
    line-height: 1.5;
}

.footer-legal a {
    color: var(--text-secondary);
    text-decoration: underline;
    transition: color 0.2s;
}

.footer-legal a:hover {
    color: var(--text-primary);
}
/* --- 8. RESPONSIVENESS --- */
@media (max-width: 768px) {
    .app-wrapper {
        padding: 0;
    }
    .chat-container {
        height: 100vh;
        width: 100%;
        margin: 0;
        border-radius: 0;
        border: none;
    }
    .top-nav {
        display: none; /* Hide top nav on mobile for a full-app feel */
    }
    .chat-header h1 {
        font-size: 16px;
    }
    .logo {
        width: 32px; height: 32px;
    }
    #chat-section, .chat-input-area {
        padding: 16px;
    }
}