/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f1f5f9; color: #1e293b; }

/* === Layout === */
.app-container { display: flex; min-height: 100vh; }

/* === Sidebar === */
.sidebar {
    width: 260px; background: #0f172a; color: #e2e8f0;
    display: flex; flex-direction: column; position: fixed;
    top: 0; left: 0; bottom: 0; z-index: 10;
}
.sidebar-header { padding: 24px 20px 16px; border-bottom: 1px solid #1e293b; }
.sidebar-header h2 { font-size: 1.2em; color: #fff; }
.badge { display: inline-block; background: #059669; color: #fff; font-size: 0.7em; padding: 2px 8px; border-radius: 4px; margin-top: 4px; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 20px; color: #94a3b8; text-decoration: none;
    font-size: 0.95em; transition: all 0.15s;
}
.nav-link:hover { background: #1e293b; color: #fff; }
.nav-link.active { background: #1e40af; color: #fff; }
.nav-icon { font-size: 1.1em; width: 20px; text-align: center; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid #1e293b; }
.user-info { margin-bottom: 12px; }
.user-info strong { display: block; color: #fff; font-size: 0.9em; }
.user-info small { color: #64748b; font-size: 0.8em; }
.sidebar-actions { display: flex; flex-direction: column; gap: 6px; }
.btn-link { color: #60a5fa; font-size: 0.8em; text-decoration: none; }
.btn-link:hover { text-decoration: underline; }
.btn-logout {
    background: #dc2626; color: #fff; border: none; padding: 8px 12px;
    border-radius: 6px; cursor: pointer; font-size: 0.85em;
}
.btn-logout:hover { background: #b91c1c; }

/* === Main === */
.main-content { margin-left: 260px; flex: 1; min-height: 100vh; }
.main-header { background: #fff; padding: 20px 32px; border-bottom: 1px solid #e2e8f0; }
.main-header h1 { font-size: 1.4em; color: #0f172a; }
.content-area { padding: 24px 32px; }

/* === Cards === */
.card {
    background: #fff; border-radius: 12px; padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 20px;
}
.card h3 { font-size: 1.1em; margin-bottom: 16px; color: #334155; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: #fff; border-radius: 10px; padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08); text-align: center;
}
.stat-card .stat-value { font-size: 1.8em; font-weight: 700; color: #1e40af; }
.stat-card .stat-label { font-size: 0.85em; color: #64748b; margin-top: 4px; }
.stat-card.success .stat-value { color: #059669; }
.stat-card.warning .stat-value { color: #d97706; }

/* === Forms === */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.9em; color: #475569; margin-bottom: 6px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 14px; border: 1px solid #cbd5e1;
    border-radius: 8px; font-size: 0.95em; transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus { border-color: #3b82f6; outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* === File upload === */
.file-upload {
    border: 2px dashed #cbd5e1; border-radius: 10px; padding: 32px;
    text-align: center; cursor: pointer; transition: all 0.2s;
}
.file-upload:hover { border-color: #3b82f6; background: #f8fafc; }
.file-upload.has-file { border-color: #059669; background: #f0fdf4; }
.file-upload input[type="file"] { display: none; }
.file-upload p { color: #64748b; font-size: 0.95em; }
.file-upload .file-name { color: #059669; font-weight: 600; margin-top: 8px; }

/* === Buttons === */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border: none; border-radius: 8px;
    font-size: 0.95em; font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.btn-primary { background: #1e40af; color: #fff; }
.btn-primary:hover { background: #1e3a8a; }
.btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }
.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: #e2e8f0; color: #334155; }
.btn-secondary:hover { background: #cbd5e1; }

/* === Results === */
.result-box {
    border-radius: 10px; padding: 20px; margin-top: 20px;
}
.result-box.success { background: #f0fdf4; border: 1px solid #86efac; }
.result-box.error { background: #fef2f2; border: 1px solid #fca5a5; }
.result-box.info { background: #eff6ff; border: 1px solid #93c5fd; }
.result-box h4 { margin-bottom: 10px; }
.result-box .detail { font-size: 0.9em; color: #475569; margin: 4px 0; }
.result-box a { color: #1e40af; font-weight: 500; }

/* === Table === */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #e2e8f0; }
th { background: #f8fafc; font-weight: 600; font-size: 0.85em; color: #64748b; text-transform: uppercase; }
td { font-size: 0.9em; }

/* === Loading === */
.loading-screen {
    position: fixed; inset: 0; background: #0f172a;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: #e2e8f0; z-index: 100;
}
.loading-spinner {
    width: 40px; height: 40px; border: 3px solid #334155;
    border-top-color: #3b82f6; border-radius: 50%;
    animation: spin 0.8s linear infinite; margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Alerts === */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.9em; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #059669; border: 1px solid #bbf7d0; }

/* === Login === */
.login-container {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
}
.login-card {
    background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-header h1 { font-size: 1.6em; color: #0f172a; margin-bottom: 4px; }
.login-header p { color: #64748b; font-size: 0.9em; }
.login-card .btn-block { width: 100%; justify-content: center; margin-top: 8px; }
.login-footer { text-align: center; margin-top: 24px; color: #94a3b8; }

/* === Responsive === */
@media (max-width: 768px) {
    .sidebar { width: 200px; }
    .main-content { margin-left: 200px; }
    .form-row { grid-template-columns: 1fr; }
    .card-grid { grid-template-columns: 1fr; }
    .login-card { margin: 16px; padding: 24px; }
}
