@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-heading: 'Outfit', sans-serif;
    
    /* Sleek Dark Mode Palette (Ensign College Green/Gold themed) */
    --bg-base: #09120e;
    --bg-surface: rgba(12, 28, 20, 0.65);
    --bg-surface-elevated: rgba(20, 44, 31, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    
    /* Text Colors */
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Branding & Accent Colors */
    --accent-green: #10b981;
    --accent-gold: #fbbf24;
    --accent-gradient: linear-gradient(135deg, #10b981 0%, #fbbf24 100%);
    
    /* Status Colors */
    --status-success: #10b981;
    --status-warning: #f59e0b;
    --status-danger: #ef4444;
    
    /* Transitions & Shadows */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 1px 1px 0 rgba(255, 255, 255, 0.05) inset;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 2rem 1.5rem;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(251, 191, 36, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
}

.app-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 90vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.system-status {
    display: flex;
    gap: 1rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dashboard-link {
    display: inline-flex;
    align-items: center;
    min-height: 2.25rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-smooth);
}

.dashboard-link:hover,
.dashboard-link:focus-visible {
    border-color: var(--accent-green);
    background: rgba(16, 185, 129, 0.1);
    outline: none;
}

.dashboard-link-top { margin-bottom: 0.75rem; }

@media (max-width: 680px) {
    header { align-items: flex-start; flex-direction: column; }
    .header-actions { flex-wrap: wrap; }
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.8rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--status-warning);
    box-shadow: 0 0 10px var(--status-warning);
}

.status-indicator.connected {
    background-color: var(--status-success);
    box-shadow: 0 0 10px var(--status-success);
}

.dashboard-grid {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
}

.chat-container {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow-premium);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.chat-history {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-history::-webkit-scrollbar {
    width: 8px;
}
.chat-history::-webkit-scrollbar-track {
    background: transparent;
}
.chat-history::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.message {
    display: flex;
    max-width: 80%;
}

.message.user-msg {
    align-self: flex-end;
}

.message.system-msg {
    align-self: flex-start;
}

.message-content {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.user-msg .message-content {
    background: var(--accent-gradient);
    color: white;
    border-bottom-right-radius: 2px;
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
    color: var(--text-primary);
    padding: 0 1rem;
}

.system-msg .message-content {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-bottom-left-radius: 2px;
}

/* Markdown styling inside messages */
.system-msg .message-content p { margin-bottom: 0.75rem; }
.system-msg .message-content p:last-child { margin-bottom: 0; }
.system-msg .message-content ul, .system-msg .message-content ol { padding-left: 1.5rem; margin-bottom: 0.75rem; }
.system-msg .message-content strong { color: var(--accent-gold); }
.system-msg .message-content code { background: rgba(0,0,0,0.3); padding: 0.2rem 0.4rem; border-radius: 4px; }

.chat-input-area {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.processing-indicator {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0.75rem 1.5rem 0;
    padding: 0.7rem 0.9rem;
    border: 1px solid rgba(16, 185, 129, 0.28);
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.08);
    color: var(--text-primary);
    font-size: 0.88rem;
}

.processing-indicator[hidden] { display: none; }

.processing-dot {
    width: 0.65rem;
    height: 0.65rem;
    flex: 0 0 0.65rem;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
    animation: processing-pulse 1.2s ease-in-out infinite;
}

@keyframes processing-pulse {
    50% { box-shadow: 0 0 0 0.45rem rgba(16, 185, 129, 0); }
}

textarea {
    flex-grow: 1;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    padding: 1rem;
    font-size: 1rem;
    font-family: var(--font-primary);
    transition: var(--transition-smooth);
    resize: none;
}

textarea:focus {
    border-color: var(--accent-green);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
    background-color: rgba(255, 255, 255, 0.05);
    outline: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.privacy-notice {
    padding: 0.5rem 1.5rem 1rem 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

.tip-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}
