@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ================= GLOBAL ================= */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
body { background: #f1f5f9; color: #334155; font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: #2563eb; text-decoration: none; }

/* ================= LOGIN PAGE ================= */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1e40af, #3b82f6); padding: 20px; }
.login-box { background: #fff; padding: 40px 30px; border-radius: 16px; width: 100%; max-width: 400px; box-shadow: 0 20px 40px rgba(0,0,0,.2); }
.login-box h1 { color: #1e293b; font-size: 24px; font-weight: 700; margin-bottom: 5px; text-align: center; }
.login-box .subtitle { color: #64748b; font-size: 13px; margin-bottom: 30px; text-align: center; }
.login-box label { display: block; font-size: 13px; font-weight: 500; color: #475569; margin-bottom: 6px; }
.login-box input { width: 100%; padding: 12px 15px; border: 1.5px solid #e2e8f0; border-radius: 8px; font-size: 14px; transition: all 0.2s; margin-bottom: 15px; }
.login-box input:focus { border-color: #3b82f6; outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.btn-primary { background: #2563eb; color: #fff; border: none; cursor: pointer; transition: 0.2s; }
.login-box .btn-primary { width: 100%; padding: 12px; border-radius: 8px; font-weight: 600; font-size: 15px; }
.login-box .btn-primary:hover { background: #1d4ed8; }

/* ================= LAYOUT DESKTOP ================= */
.layout { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar { width: 260px; background: #0f172a; color: #e2e8f0; flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar-header { padding: 20px; border-bottom: 1px solid #1e293b; }
.sidebar h2 { color: #fff; font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.close-sidebar { display: none; background: transparent; border: none; color: #94a3b8; font-size: 20px; cursor: pointer; }
.sidebar .user { padding: 20px; background: #1e293b; font-size: 13px; border-bottom: 1px solid #334155; }
.sidebar a { display: block; padding: 14px 20px; color: #94a3b8; font-size: 14px; font-weight: 500; transition: 0.2s; border-left: 3px solid transparent; }
.sidebar a:hover, .sidebar a.active { background: #1e293b; color: #fff; border-left-color: #3b82f6; }

/* MAIN CONTENT */
.main { flex: 1; padding: 25px; width: calc(100% - 260px); overflow-x: hidden; }

/* SEMBUNYIKAN HEADER MOBILE DI DESKTOP */
.mobile-header { display: none; }
.sidebar-overlay { display: none; }

/* ================= TOPBAR ================= */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; gap: 15px; flex-wrap: wrap; background: #fff; padding: 20px; border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.topbar h1 { font-size: 20px; color: #1e293b; font-weight: 600; }
.topbar form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.topbar input, .topbar select { padding: 10px 14px; border: 1.5px solid #e2e8f0; border-radius: 8px; font-size: 13px; outline: none; }
.topbar input:focus { border-color: #3b82f6; }

/* ================= CARD & STATS ================= */
.card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); margin-bottom: 25px; overflow: hidden; }
.card h3 { font-size: 16px; color: #1e293b; margin-bottom: 20px; font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-bottom: 25px; }
.stat { background: #fff; padding: 20px; border-radius: 12px; border-left: 4px solid #3b82f6; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.stat h3 { font-size: 13px; color: #64748b; margin-bottom: 8px; font-weight: 500; }
.stat p { font-size: 24px; font-weight: 700; color: #1e293b; }
.stat.green  { border-color: #10b981; }
.stat.red    { border-color: #ef4444; }
.stat.orange { border-color: #f59e0b; }

/* ================= TABLE (RESPONSIVE) ================= */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 600px; }
th, td { padding: 12px 15px; border-bottom: 1px solid #f1f5f9; text-align: left; vertical-align: middle; white-space: nowrap; }
th { background: #f8fafc; color: #475569; font-weight: 600; }
tr:hover { background: #f8fafc; }

/* ================= BUTTONS ================= */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 9px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; border: none; cursor: pointer; transition: 0.2s; text-decoration: none; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: #10b981; color: #fff; }
.btn-danger  { background: #ef4444; color: #fff; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-secondary { background: #64748b; color: #fff; }

/* ================= FORMS ================= */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-bottom: 15px; }
.form-row label { display: block; font-size: 13px; font-weight: 500; color: #475569; margin-bottom: 6px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; padding: 10px 14px; border: 1.5px solid #e2e8f0; border-radius: 8px; font-size: 13px; transition: 0.2s; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: #3b82f6; outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.form-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ================= ALERTS & BADGES ================= */
.alert { padding: 14px 18px; border-radius: 10px; margin-bottom: 20px; font-size: 13px; font-weight: 500; line-height: 1.5; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-success { background: #ecfdf5; color: #065f46; }
.badge-danger  { background: #fef2f2; color: #991b1b; }
.badge-warning { background: #fffbeb; color: #92400e; }
.badge-info    { background: #eff6ff; color: #1e40af; }

/* ================= RESPONSIVE MOBILE (HP & TABLET) ================= */
@media (max-width: 768px) {
    /* Tampilkan Header Mobile */
    .mobile-header { display: flex; background: #0f172a; color: #fff; padding: 15px 20px; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 900; }
    .menu-toggle { background: transparent; border: none; color: #fff; font-size: 24px; cursor: pointer; }
    .mobile-brand { font-weight: 600; font-size: 15px; }
    
    /* Layout jadi blok vertikal */
    .layout { display: block; }
    .main { padding: 15px; width: 100%; }
    
    /* Sidebar disembunyikan, muncul dari kiri */
    .sidebar { position: fixed; left: -280px; top: 0; height: 100vh; overflow-y: auto; transition: left 0.3s ease; z-index: 1000; }
    .sidebar.active { left: 0; }
    .sidebar-header { display: flex; justify-content: space-between; align-items: center; }
    .close-sidebar { display: block; }
    
    /* Overlay gelap saat menu terbuka */
    .sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 999; opacity: 0; transition: 0.3s; }
    .sidebar-overlay.active { display: block; opacity: 1; }
    
    /* Topbar Mobile */
    .topbar { flex-direction: column; align-items: flex-start; padding: 15px; }
    .topbar form { width: 100%; flex-direction: column; }
    .topbar input, .topbar button { width: 100%; }
    
    /* Form 1 Kolom */
    .form-row { grid-template-columns: 1fr; }
    .btn { width: 100%; margin-bottom: 5px; }
    .form-actions { flex-direction: column; }
    
    /* Card padding */
    .card { padding: 15px; }
    
    /* Stat grid 2 kolom di HP */
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat { padding: 15px; }
    .stat p { font-size: 20px; }
}

/* ================= PRINT STYLE ================= */
@media print {
    .sidebar, .mobile-header, .sidebar-overlay, .no-print, .btn { display: none !important; }
    .layout { display: block; }
    .main { padding: 0; width: 100%; }
    body { background: #fff; font-size: 11px; }
    .card { box-shadow: none; border: 0; padding: 0; margin-bottom: 10px; }
    table { font-size: 11px; min-width: 100%; }
    th, td { padding: 5px; border-color: #999; }
}