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

:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --secondary-color: #10B981;
    --bg-color: #F3F4F6;
    --card-bg: #FFFFFF;
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --sidebar-bg: #111827;
    --sidebar-text: #D1D5DB;
    --sidebar-hover: #1F2937;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
}

[data-theme="dark"] {
    --bg-color: #111827;
    --card-bg: #1F2937;
    --text-main: #F9FAFB;
    --text-muted: #9CA3AF;
    --border-color: #374151;
    --sidebar-bg: #030712;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header i {
    font-size: 24px;
    color: var(--primary-color);
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    gap: 12px;
}

.sidebar-menu li a:hover, .sidebar-menu li.active a {
    background-color: var(--sidebar-hover);
    color: #fff;
    border-left: 4px solid var(--primary-color);
}

.sidebar-menu li a i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-wrapper {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background-color: var(--card-bg);
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-left h3 {
    font-weight: 600;
    color: var(--text-main);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}
.theme-toggle:hover { color: var(--primary-color); }

.content-area {
    padding: 30px;
    flex: 1;
}

/* Cards & Dashboards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 20px;
}

.stat-icon.primary { background-color: rgba(79, 70, 229, 0.1); color: var(--primary-color); }
.stat-icon.success { background-color: rgba(16, 185, 129, 0.1); color: var(--secondary-color); }
.stat-icon.warning { background-color: rgba(245, 158, 11, 0.1); color: #F59E0B; }
.stat-icon.danger { background-color: rgba(239, 68, 68, 0.1); color: #EF4444; }

.stat-details h4 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 5px;
    font-weight: 500;
}

.stat-details h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Tables */
.card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 30px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    background-color: rgba(0,0,0,0.02);
}

.table tbody tr:hover {
    background-color: rgba(0,0,0,0.01);
}
[data-theme="dark"] .table tbody tr:hover {
    background-color: rgba(255,255,255,0.02);
}

/* Forms & Buttons */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: inherit;
    transition: all 0.2s;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    font-size: 0.9rem;
}

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

.btn-secondary { background-color: var(--text-muted); color: white; }
.btn-secondary:hover { background-color: #4B5563; }

.btn-success { background-color: var(--secondary-color); color: white; }
.btn-danger { background-color: #EF4444; color: white; }
.btn-warning { background-color: #F59E0B; color: white; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-success { background-color: rgba(16, 185, 129, 0.1); color: var(--secondary-color); }
.badge-danger { background-color: rgba(239, 68, 68, 0.1); color: #EF4444; }
.badge-primary { background-color: rgba(79, 70, 229, 0.1); color: var(--primary-color); }

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background-color: rgba(16, 185, 129, 0.1); color: var(--secondary-color); border: 1px solid rgba(16, 185, 129, 0.2); }
.alert-error { background-color: rgba(239, 68, 68, 0.1); color: #EF4444; border: 1px solid rgba(239, 68, 68, 0.2); }

/* Layout Grids */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: -10px;
}
.col-md-6 { width: 50%; padding: 10px; }
.col-md-4 { width: 33.333%; padding: 10px; }
.col-md-12 { width: 100%; padding: 10px; }

/* Profile Detail */
.profile-header {
    display: flex;
    gap: 30px;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}
.profile-img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--card-bg);
    box-shadow: var(--shadow-md);
}
.profile-info h2 { margin-bottom: 10px; }
.profile-info p { color: var(--text-muted); margin-bottom: 5px; }

.detail-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 15px 20px;
    margin-bottom: 15px;
}
.detail-label {
    font-weight: 600;
    color: var(--text-muted);
}
.detail-value {
    font-weight: 500;
}

/* Image preview */
.img-preview-container {
    width: 150px;
    height: 150px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-color);
}
.img-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Responsive */
@media(max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-wrapper { margin-left: 0; }
    .col-md-6, .col-md-4 { width: 100%; }
    .profile-header { flex-direction: column; text-align: center; }
    .detail-grid { grid-template-columns: 1fr; gap: 5px; }
}
