:root {
    --primary: #4F46E5; /* Indigo 600 */
    --primary-dark: #4338CA;
    --primary-light: #818CF8;
    --secondary: #1F2937; /* Gray 800 */
    --light: #F3F4F6; /* Gray 100 */
    --white: #FFFFFF;
    --dark: #111827;
    --text-color: #374151;
    --border-radius: 12px;
    --box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@500;700&display=swap');

body {
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    background-color: var(--light);
    color: var(--text-color);
    line-height: 1.6;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    margin-top: 0;
}

header {
    background: linear-gradient(135deg, var(--secondary) 0%, #111827 100%);
    color: white;
    padding: 1.25rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

header a {
    color: var(--white);
    text-decoration: none;
    margin-left: 1.5rem;
    font-weight: 500;
    transition: opacity 0.2s;
}

header a:hover {
    opacity: 0.8;
}

/* Auth Buttons in Header */
.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    margin-left: 1rem;
}
.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
}

.container {
    max-width: 1024px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.card {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-top: 3rem;
    border: 1px solid rgba(0,0,0,0.05);
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--secondary);
}

input {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: var(--font-body);
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

button.btn {
    background-color: var(--primary);
    color: white;
    padding: 0.85rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    transition: background-color 0.2s, transform 0.1s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

button.btn:hover {
    background-color: var(--primary-dark);
}

button.btn:active {
    transform: scale(0.98);
}

button.btn:disabled {
    background-color: #9CA3AF;
    cursor: not-allowed;
    transform: none;
}

.alert {
    padding: 1rem;
    background-color: #FEF2F2;
    border: 1px solid #FECACA;
    color: #991B1B;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: none;
    font-size: 0.95rem;
}

/* Dashboard Specific */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr 2fr;
    }
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #E5E7EB;
    padding: 1rem;
    border-radius: 8px;
    background: #F9FAFB;
}

/* Loaders */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    display: none; /* Hidden by default */
}

/* When helper class 'loading' is added to button */
button.btn.loading .spinner {
    display: inline-block;
}
button.btn.loading span {
    display: none; /* Hide text */
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

pre {
    background: #111827;
    color: #E5E7EB;
    padding: 1.25rem;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.9rem;
    font-family: 'Menlo', 'Monaco', monospace;
    line-height: 1.5;
}

code {
    background: #E5E7EB;
    color: #1F2937;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Menlo', 'Monaco', monospace;
    font-size: 0.9em;
}

/* Tabs */
.tabs { display: flex; border-bottom: 2px solid #e5e7eb; margin-bottom: 2rem; }
.tab-btn { background: none; border: none; padding: 1rem 1.5rem; font-size: 1rem; font-weight: 500; color: #6b7280; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab-btn.active { border-bottom-color: var(--primary); color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Chat Console */
.chat-console { display: grid; grid-template-columns: 300px 1fr; gap: 0; border: 1px solid #e5e7eb; border-radius: 8px; height: 600px; overflow: hidden; background: white; }
.chat-list { border-right: 1px solid #e5e7eb; overflow-y: auto; background: #f9fafb; }
.chat-item { padding: 1rem; border-bottom: 1px solid #e5e7eb; cursor: pointer; transition: background 0.2s; }
.chat-item:hover, .chat-item.active { background: #fff; border-left: 3px solid var(--primary); }
.chat-status { font-size: 0.75rem; text-transform: uppercase; font-weight: 700; color: #9ca3af; }
.chat-status.active { color: #10b981; }

.chat-window { display: flex; flex-direction: column; height: 100%; }
.chat-header { padding: 1rem; border-bottom: 1px solid #e5e7eb; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1.5rem; background: #fff; display: flex; flex-direction: column; gap: 0.5rem; }
.chat-input-area { padding: 1rem; border-top: 1px solid #e5e7eb; background: #f9fafb; display: flex; gap: 0.5rem; }
.chat-input-area input { flex: 1; padding: 0.75rem; border: 1px solid #d1d5db; border-radius: 6px; }

.msg { max-width: 70%; padding: 0.75rem 1rem; border-radius: 12px; font-size: 0.95rem; line-height: 1.4; }
.msg.user { align-self: flex-start; background: #e5e7eb; color: #1f2937; border-bottom-left-radius: 2px; }
.msg.agent { align-self: flex-end; background: var(--primary); color: white; border-bottom-right-radius: 2px; }
