/* Modern Enterprise Design System */
:root {
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;

    --text-main: #0f172a;
    --text-secondary: #64748b;
    --text-inverse: #ffffff;

    --border: #e2e8f0;
    --radius-sm: 6px;
    --radius-md: 10px;
    --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);
}

/* Light Mode Override */
body.light-mode {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --border: #e2e8f0;
    --text-main: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body.light-mode .sidebar {
    background: #ffffff;
    border-right: 1px solid var(--border);
    color: var(--text-main);
}

body.light-mode .sidebar-link {
    color: var(--text-secondary);
}

body.light-mode .sidebar-link:hover,
body.light-mode .sidebar-link.active {
    background: var(--bg-tertiary);
    color: var(--text-main);
}

body.light-mode .sidebar-footer {
    border-top-color: var(--border);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    height: 100vh;
    display: flex;
}

/* Typography */
h1, h2, h3 { font-weight: 600; letter-spacing: -0.025em; }
a { color: var(--accent); text-decoration: none; transition: 0.2s; }
a:hover { color: var(--accent-hover); }

/* Layout */
.app-container { display: flex; width: 100%; }

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: var(--text-inverse);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex-shrink: 0;
}

.sidebar-header { margin-bottom: 2.5rem; display: flex; align-items: center; gap: 0.75rem; }
.sidebar-header h2 { font-size: 1.25rem; }

.sidebar-nav { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.sidebar-link {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    transition: 0.2s;
    cursor: pointer;
}
.sidebar-link:hover, .sidebar-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-inverse);
}
.sidebar-link.active { background: var(--accent); }

.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 1.5rem; margin-top: auto; }
.user-profile { display: flex; align-items: center; gap: 0.75rem; }
.user-avatar { width: 40px; height: 40px; background: var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; color: white; }

.main-content { flex: 1; padding: 2rem; overflow-y: auto; }

/* Dashboard Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); margin: 0.5rem 0; }
.stat-label { color: var(--text-secondary); font-size: 0.875rem; font-weight: 500; }

/* Tables */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 1rem 1.5rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: #f8fafc; font-weight: 600; color: var(--text-secondary); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.data-table tr:hover { background: #f8fafc; }

/* Components */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: 0.2s;
    font-size: 0.9rem;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary { background: white; border: 1px solid var(--border); color: var(--text-main); }
.btn-secondary:hover { border-color: var(--text-secondary); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--danger); background: #fef2f2; }

/* Favorite Button */
.favorite-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.favorite-btn:hover {
    background: #f8fafc;
    color: var(--text-main);
}

.favorite-btn.active {
    color: #f59e0b;
    border-color: #f59e0b;
    background: #fffbeb;
}

.favorite-btn.active:hover {
    background: #fef3c7;
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-primary { background: #dbeafe; color: #1e40af; }
.badge-success { background: #d1fae5; color: #065f46; }

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.9rem; color: var(--text-main); }
.form-control {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    transition: 0.2s;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }

/* Modal */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(2px);
    z-index: 1000;
}
.modal.active { display: flex; }
.modal-content {
    background: var(--bg-card);
    width: 90%; max-width: 500px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    animation: slideIn 0.2s ease-out;
}
@keyframes slideIn { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; }}
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1.25rem 1.5rem; background: #f8fafc; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 0.75rem; }

/* Tab Sections */
.tab-section { display: none; animation: fadeIn 0.3s ease; }
.tab-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; }}

/* Toast */
.toast {
    position: fixed; bottom: 20px; right: 20px;
    background: var(--primary); color: white;
    padding: 1rem 1.5rem; border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    transform: translateY(100px); transition: 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    z-index: 2000;
}
.toast-error { background: var(--danger); }
.toast.show { transform: translateY(0); }
}
.modal.active { display: flex; }
.modal-content {
    background: var(--bg-card);
    width: 90%; max-width: 500px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    animation: slideIn 0.2s ease-out;
}
@keyframes slideIn { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; }}
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1.25rem 1.5rem; background: #f8fafc; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 0.75rem; }

/* Tab Sections */
.tab-section { display: none; animation: fadeIn 0.3s ease; }
.tab-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; }}

/* Toast */
.toast {
    position: fixed; bottom: 20px; right: 20px;
    background: var(--primary); color: white;
    padding: 1rem 1.5rem; border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    transform: translateY(100px); transition: 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    z-index: 2000;
}
.toast-error { background: var(--danger); }
.toast.show { transform: translateY(0); }

