/* ==========================================================================
   1. Global Theme Variables
   ========================================================================== */
:root,
html[data-theme="light"],
body[data-theme="light"] {
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --border-color: #eef2f6;
    --input-bg: #ebf3fe; /* Soft blue tint from design */
    --input-focus-bg: #ffffff;
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --button-sec-bg: #f1f5f9;
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.04), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
}

html[data-theme="dark"],
body[data-theme="dark"] {
    --bg-body: #0b0f19;
    --bg-surface: #151c2c;
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #26334d;
    --input-bg: #0f172a;
    --input-focus-bg: #151c2c;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --button-sec-bg: #26334d;
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   2. Base & Reset Rules
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    min-height: 100vh;
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   3. Auth Page Layout (Centered Container)
   ========================================================================== */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    padding: 1.5rem;
    background-color: var(--bg-body);
}

.auth-container {
    width: 100%;
    max-width: 380px;
}

.auth-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.25rem 2rem;
    box-shadow: var(--card-shadow);
    width: 100%;
}

.auth-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.auth-header p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-link {
    display: block;
    text-align: center;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* ==========================================================================
   4. App Shell Layout (Dashboard)
   ========================================================================== */
.app-shell {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-body);
}

.sidebar {
    width: 240px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.main-panel {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-body);
}

.content-area {
    flex: 1;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover, 
.nav-link.active {
    background-color: var(--button-sec-bg);
    color: var(--text-primary);
    text-decoration: none;
}

/* ==========================================================================
   5. UI Components & Controls
   ========================================================================== */
.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.6rem;
}

.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--card-shadow);
}

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.form-field, 
.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.small, 
.eyebrow {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.input, 
select, 
textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
}

.input:focus, 
select:focus, 
textarea:focus {
    border-color: var(--primary-color);
    background-color: var(--input-focus-bg);
}

/* --- Remember Me & Checkbox --- */
.remember-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.2rem 0;
}

.remember-row span {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

/* --- Buttons --- */
.btn {
    width: 100%;
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 0.85rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn:hover {
    background-color: var(--primary-hover);
}

.btn-secondary,
.theme-pill, 
.user-chip {
    background-color: var(--button-sec-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
}

/* --- Auth Footer Links --- */
.auth-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
}

.auth-footer a {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-footer a:hover {
    color: var(--primary-color);
}

/* --- Status Messages --- */
.status {
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.status-error {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-success {
    background-color: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}