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

:root {
    --primary: #1a1a2e;
    --primary-dark: #0f0f1a;
    --secondary: #2d2d44;
    --accent: #5ce1e6;
    --accent-light: #7eeef2;
    --accent-dark: #3bc4c9;
    --accent-purple: #9b59b6;
    --accent-pink: #d35db3;
    --success: #10b981;
    --success-light: #34d399;
    --warning: #f59e0b;
    --danger: #ef4444;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: all 0.15s ease;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* LOGIN */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--secondary) 100%);
    padding: 20px;
}

.login-box {
    background: var(--white);
    padding: 48px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 440px;
}

.login-box h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--gray-900);
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-box .subtitle {
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 36px;
    font-size: 14px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.logo-img {
    max-width: 280px;
    height: auto;
}

.sidebar-logo {
    max-width: 180px;
    height: auto;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-purple) 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--white);
    box-shadow: 0 4px 14px rgba(92, 225, 230, 0.4);
}

/* FORMS */
.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 13px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--white);
    color: var(--gray-800);
}

.form-control:hover { border-color: var(--gray-300); }
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-purple) 100%);
    color: var(--white);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-dark) 0%, #7b4397 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(92, 225, 230, 0.4);
}

.btn-success { 
    background: linear-gradient(135deg, var(--accent) 0%, var(--success) 100%); 
    color: var(--white); 
}
.btn-success:hover { 
    background: linear-gradient(135deg, var(--accent-dark) 0%, #059669 100%); 
    transform: translateY(-1px); 
}

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); }

.btn-warning { background: var(--warning); color: var(--white); }
.btn-warning:hover { background: #d97706; transform: translateY(-1px); }

.btn-secondary { 
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 100%); 
    color: var(--white); 
}
.btn-secondary:hover { 
    background: linear-gradient(135deg, #7b4397 0%, #b34d9e 100%); 
    transform: translateY(-1px); 
}

.btn-sm { padding: 8px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }

.btn-full { width: 100%; }

.btn + .btn { margin-left: 8px; }
.btn + form { margin-left: 8px; }
form + .btn { margin-left: 8px; }
form + form { margin-left: 8px; }

/* ALERTS */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
}
.alert::before { font-size: 18px; }
.alert-danger { background: #fef2f2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-danger::before { content: "⚠"; }
.alert-success { background: #f0fdf4; color: #166534; border-left: 4px solid var(--success); }
.alert-success::before { content: "✓"; }

/* LAYOUT */
.wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    background: var(--primary-dark);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--gray-600); border-radius: 4px; }

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header .logo { justify-content: flex-start; margin-bottom: 0; }
.sidebar-header .logo-icon { width: 40px; height: 40px; font-size: 18px; }
.sidebar-header h2 { color: var(--white); font-size: 18px; font-weight: 700; }
.sidebar-header span { color: var(--gray-400); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }

.sidebar-menu { padding: 16px 0; }

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--gray-400);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-menu a .icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.sidebar-menu a:hover { background: rgba(255,255,255,0.05); color: var(--white); }
.sidebar-menu a.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--white);
    border-left-color: var(--accent);
}

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 12px 20px;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px 32px;
    min-height: 100vh;
}

/* PAGE HEADER */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.5px;
}

.page-header-actions { display: flex; gap: 12px; align-items: center; }

.breadcrumb {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 4px;
}

/* STATS CARDS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 16px;
}

.stat-card-icon.blue { background: rgba(59, 130, 246, 0.1); color: var(--accent); }
.stat-card-icon.green { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-card-icon.orange { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-card-icon.red { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.stat-card-icon.purple { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }

.stat-card-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.5px;
}

.stat-card-value.small { font-size: 22px; }

.stat-card-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 20px;
    margin-top: 12px;
}

.stat-card-change.positive { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-card-change.negative { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* CARDS */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 24px;
    overflow: hidden;
}

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

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h3 .icon { font-size: 18px; color: var(--accent); }

.card-body { padding: 24px; }
.card-body.no-padding { padding: 0; }

/* TABLES */
.data-table { overflow-x: auto; }

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

table th, table td {
    padding: 14px 16px;
    text-align: left;
    font-size: 13px;
}

table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-200);
}

table td { border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }
table tbody tr { transition: var(--transition); }
table tbody tr:hover { background: var(--gray-50); }
table tbody tr:last-child td { border-bottom: none; }

tfoot td {
    background: var(--gray-50) !important;
    font-weight: 600 !important;
    color: var(--gray-800) !important;
    border-top: 2px solid var(--gray-200) !important;
}

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-info { background: rgba(59, 130, 246, 0.1); color: var(--accent); }
.badge-purple { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* ACTIONS */
.actions { 
    display: flex; 
    gap: 10px; 
    flex-wrap: wrap; 
    align-items: center;
}

.actions form { margin: 0; }
.actions .btn { margin: 0; }

/* FILTER BAR */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
    background: var(--white);
    padding: 16px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-xs);
}

.filter-bar .form-control {
    max-width: 180px;
    padding: 10px 14px;
    font-size: 13px;
}

/* MODALS */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlide 0.2s ease;
}

@keyframes modalSlide {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
}

.modal-close:hover { background: var(--gray-200); color: var(--gray-700); }

.modal-body { padding: 24px; }

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text { font-size: 14px; color: var(--gray-500); }

/* VALUE COLORS */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--gray-500) !important; }
.font-bold { font-weight: 600 !important; }

/* USER INFO */
.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

.user-name { font-weight: 500; color: var(--gray-700); font-size: 13px; }

/* RESPONSIVE */
@media (max-width: 1024px) {
    .sidebar { width: 220px; }
    .main-content { margin-left: 220px; padding: 20px; }
}

@media (max-width: 768px) {
    .sidebar { width: 100%; height: auto; position: relative; }
    .main-content { margin-left: 0; padding: 16px; }
    .wrapper { flex-direction: column; }
    .filter-bar .form-control { max-width: 100%; flex: 1; min-width: 140px; }
    .page-header { flex-direction: column; gap: 16px; align-items: flex-start; }
    .stats-grid { grid-template-columns: 1fr; }
}

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes progressFill {
    from { width: 0; }
}

.animate-fade-up { animation: fadeInUp 0.6s ease forwards; opacity: 0; }
.animate-fade-scale { animation: fadeInScale 0.5s ease forwards; opacity: 0; }
.animate-slide-left { animation: slideInLeft 0.5s ease forwards; opacity: 0; }

.stats-grid .stat-card { animation: fadeInUp 0.5s ease forwards; opacity: 0; }
.stats-grid .stat-card:nth-child(1) { animation-delay: 0.1s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: 0.2s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: 0.3s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: 0.4s; }

.charts-grid .card { animation: fadeInScale 0.6s ease forwards; opacity: 0; }
.charts-grid .card:nth-child(1) { animation-delay: 0.3s; }
.charts-grid .card:nth-child(2) { animation-delay: 0.5s; }

.data-table { animation: fadeInUp 0.6s ease forwards; animation-delay: 0.6s; opacity: 0; }

.page-header { animation: slideInLeft 0.5s ease forwards; }
.filter-bar { animation: fadeInUp 0.4s ease forwards; animation-delay: 0.1s; opacity: 0; }

.stat-card-value { animation: countUp 0.5s ease forwards; animation-delay: 0.5s; }

.progress-bar { animation: progressFill 1s ease forwards; animation-delay: 0.8s; }

/* Charts and Visualization */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 24px; }
@media (max-width: 768px) { .charts-grid { grid-template-columns: 1fr; } }

.tabs-header { display: flex; gap: 4px; background: var(--gray-100); padding: 4px; border-radius: 8px; }
.tab-btn { padding: 10px 20px; border: none; background: transparent; cursor: pointer; border-radius: 6px; font-weight: 500; color: var(--gray-600); transition: all 0.2s; }
.tab-btn:hover { background: var(--gray-200); }
.tab-btn.active { background: white; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.progress-bar-container { width: 80px; height: 8px; background: var(--gray-200); border-radius: 4px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 8px; }
.progress-bar { height: 100%; border-radius: 4px; transition: width 0.3s; }
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }
.progress-text { font-size: 12px; font-weight: 600; }
