/* Modern Admin Design System */
:root {
    /* Colors - Brand Lonicera */
    --brand-primary: #1e3a8a; /* Deep Navy */
    --brand-secondary: #d97706; /* Gold/Amber */
    
    /* Neutrals */
    --bg-body: #f3f4f6;
    --bg-surface: #ffffff;
    --border-color: #e5e7eb;
    
    /* Text */
    --text-main: #111827;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    
    /* Functional */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Spacing & Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    
    /* Header */
    --header-height: 64px;
}

/* Dark Mode Variables */
.dark {
    --brand-primary: #3b82f6;
    --brand-secondary: #fbbf24;
    --bg-body: #111827;
    --bg-surface: #1f2937;
    --border-color: #374151;
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
}

a { text-decoration: none; color: inherit; }
button, input, select, textarea { font-family: inherit; font-size: 100%; }

/* Layout Utilities */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

.page-wrapper {
    padding-top: calc(var(--header-height) + 2rem);
    padding-bottom: 2rem;
}

/* Header / Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.brand img { height: 32px; width: auto; }
.dark .brand { color: var(--brand-secondary); }

.nav-links { display: flex; gap: 1rem; align-items: center; }
.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.nav-link:hover { background: var(--bg-body); color: var(--text-main); }
.nav-link.active { background: var(--brand-primary); color: #fff; }
.nav-link.active:hover { background: var(--brand-primary); opacity: 0.9; }

/* Cards */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header h2 { margin: 0; font-size: 1.125rem; font-weight: 600; }

.card-body { padding: 1.5rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    gap: 0.5rem;
}

.btn-primary { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-secondary { background: var(--bg-body); color: var(--text-main); border-color: var(--border-color); }
.btn-secondary:hover { background: var(--border-color); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }

.btn-outline { background: transparent; border-color: var(--border-color); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--text-muted); color: var(--text-main); }

.btn-sm { padding: 0.25rem 0.75rem; font-size: 0.75rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--text-main);
}
.form-control {
    width: 100%;
    padding: 0.625rem;
    font-size: 0.875rem;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.dark .form-control:focus { box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); }

/* Grid Filters */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.filters-actions {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

/* Tables */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th, .table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.table th {
    background: var(--bg-body);
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
.table tbody tr:hover { background: var(--bg-body); }
.table-actions { display: flex; gap: 0.5rem; }

/* Badges */
.badge {
    display: inline-flex;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25;
}
.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-info { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.badge-neutral { background: var(--bg-body); color: var(--text-muted); }

/* Login Page Specfic */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-body) 0%, var(--border-color) 100%);
}
.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}
.auth-brand {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-brand img { height: 48px; margin-bottom: 1rem; }
.auth-brand h1 { margin: 0; font-size: 1.5rem; color: var(--brand-primary); }

/* Utilities */
.text-right { text-align: right; }
.mt-4 { margin-top: 1rem; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }

/* Theme Toggle */
.theme-toggle-btn {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    font-size: 1.25rem;
}
/* Chat View */
.chat-history { display: flex; flex-direction: column; gap: 1rem; padding: 1rem; }
.chat-message { display: flex; max-width: 80%; margin-bottom: 1rem; }
.chat-message.user { align-self: flex-end; justify-content: flex-end; }
.chat-message.ai { align-self: flex-start; justify-content: flex-start; }
.message-bubble { padding: 1rem; border-radius: 1rem; position: relative; box-shadow: var(--shadow-sm); line-height: 1.5; }
.chat-message.user .message-bubble { background: var(--brand-primary); color: #fff; border-bottom-right-radius: 0.25rem; }
.chat-message.ai .message-bubble { background: var(--bg-body); color: var(--text-main); border: 1px solid var(--border-color); border-bottom-left-radius: 0.25rem; }
.message-time { display: block; font-size: 0.75rem; margin-top: 0.5rem; opacity: 0.8; text-align: right; }
.chat-message.ai .message-time { color: var(--text-muted); }
