/* ============================================
   ABSEN RFID — MAIN STYLESHEET
   ============================================ */

:root {
    --bg: #0d0f14;
    --bg2: #13161e;
    --bg3: #1a1e2a;
    --border: #252a38;
    --text: #e8eaf0;
    --text-muted: #6b7280;
    --text-dim: #9ca3af;
    --accent: #4f8ef7;
    --accent-glow: rgba(79,142,247,0.2);
    --green: #22c55e;
    --green-bg: rgba(34,197,94,0.12);
    --yellow: #eab308;
    --yellow-bg: rgba(234,179,8,0.12);
    --red: #ef4444;
    --red-bg: rgba(239,68,68,0.12);
    --purple: #a855f7;
    --sidebar-w: 260px;
    --radius: 12px;
    --mono: 'Space Mono', monospace;
    --sans: 'Plus Jakarta Sans', sans-serif;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    display: flex;
    min-height: 100vh;
    font-size: 14px;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.brand-icon {
    width: 42px; height: 42px;
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}

.brand-title {
    display: block;
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.3px;
}

.brand-sub {
    display: block;
    font-size: 11px;
    color: var(--accent);
    font-family: var(--mono);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-group {
    margin-bottom: 24px;
}

.nav-group-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1.2px;
    padding: 0 8px;
    margin-bottom: 6px;
    font-family: var(--mono);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--bg3);
    color: var(--text);
}

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid rgba(79,142,247,0.3);
}

.nav-icon { font-size: 16px; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.clock {
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 2px;
}

.date-display {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================
   MAIN WRAPPER
   ============================================ */
.main-wrapper {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky; top: 0; z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.hamburger {
    background: none; border: none; color: var(--text);
    font-size: 20px; cursor: pointer; display: none;
}

.page-breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
    display: flex; align-items: center; gap: 8px;
}

.breadcrumb-sep { color: var(--border); }

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

.topbar-info {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--green);
    background: var(--green-bg);
    padding: 5px 12px; border-radius: 20px;
    border: 1px solid rgba(34,197,94,0.2);
}

.status-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%,100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.page-content {
    padding: 28px;
    flex: 1;
}

/* ============================================
   SCAN HERO
   ============================================ */
.scan-hero {
    background: linear-gradient(135deg, var(--bg2) 0%, #161b28 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.scan-hero::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 50% 50%, var(--accent-glow) 0%, transparent 60%);
    pointer-events: none;
}

.scan-icon-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: 12px;
}

.scan-pulse {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    width: 70px; height: 70px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    animation: scanpulse 2s infinite;
}

@keyframes scanpulse {
    0% { transform: translate(-50%,-50%) scale(1); opacity: 0.8; }
    100% { transform: translate(-50%,-50%) scale(2); opacity: 0; }
}

.scan-icon { font-size: 36px; position: relative; z-index: 1; }

.scan-hero h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.scan-hero p { color: var(--text-muted); margin-bottom: 20px; }

.scan-form {
    display: flex;
    gap: 10px;
    max-width: 520px;
    margin: 0 auto 10px;
}

.scan-form input {
    flex: 1;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.scan-form input:focus { border-color: var(--accent); }

.btn-scan {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 700;
    font-family: var(--sans);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-scan:hover { background: #3a7de8; transform: translateY(-1px); }

.scan-shortcuts { color: var(--text-muted); font-size: 12px; margin-bottom: 12px; }

.scan-result {
    max-width: 520px;
    margin: 12px auto 0;
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    text-align: left;
}

.scan-result.hidden { display: none; }
.scan-result.success { background: var(--green-bg); border: 1px solid rgba(34,197,94,0.3); color: var(--green); }
.scan-result.error { background: var(--red-bg); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }
.scan-result.warning { background: var(--yellow-bg); border: 1px solid rgba(234,179,8,0.3); color: var(--yellow); }
.scan-result.loading { background: var(--bg3); border: 1px solid var(--border); color: var(--text-muted); }

/* ============================================
   STATS GRID
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s;
}

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

.stat-icon { font-size: 28px; }

.stat-num {
    display: block;
    font-size: 28px;
    font-weight: 800;
    font-family: var(--mono);
    line-height: 1;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-card.hadir .stat-num { color: var(--green); }
.stat-card.terlambat .stat-num { color: var(--yellow); }
.stat-card.absen .stat-num { color: var(--red); }
.stat-card.total .stat-num { color: var(--accent); }

/* Progress */
.progress-section {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.progress-bar {
    height: 10px;
    background: var(--bg3);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    position: absolute;
    top: 0;
    border-radius: 10px;
    transition: width 1s ease;
}

.hadir-fill { background: var(--green); left: 0; }
.telat-fill { background: var(--yellow); }

.progress-legend { display: flex; gap: 20px; font-size: 12px; }
.leg { display: flex; align-items: center; gap: 6px; }
.leg.hadir { color: var(--green); }
.leg.terlambat { color: var(--yellow); }
.leg.absen { color: var(--text-muted); }

/* ============================================
   TABLES
   ============================================ */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.table-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

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

.table-header h3 { font-size: 15px; font-weight: 700; }

.badge {
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid rgba(79,142,247,0.3);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--mono);
}

.badge.danger {
    background: var(--red-bg);
    color: var(--red);
    border-color: rgba(239,68,68,0.3);
}

.table-scroll { max-height: 360px; overflow-y: auto; }

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

th {
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    background: var(--bg3);
    position: sticky; top: 0;
}

td {
    padding: 11px 16px;
    border-bottom: 1px solid rgba(37,42,56,0.5);
    font-size: 13px;
    color: var(--text);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

.empty-row { text-align: center; color: var(--text-muted); padding: 30px 16px; }

.badge-status {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.badge-status.hadir {
    background: var(--green-bg);
    color: var(--green);
}

.badge-status.terlambat {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.badge-status.tidak_hadir {
    background: var(--red-bg);
    color: var(--red);
}

.uid-code {
    font-family: var(--mono);
    font-size: 11px;
    background: var(--bg3);
    border: 1px solid var(--border);
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s;
    color: var(--accent);
}

.uid-code:hover { border-color: var(--accent); }

/* ============================================
   PAGE TITLES & FORMS
   ============================================ */
.page-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--accent); }

.form-group select option { background: var(--bg2); }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    font-family: var(--sans);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #3a7de8; }
.btn-danger { background: var(--red-bg); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: var(--red); color: white; }
.btn-success { background: var(--green-bg); color: var(--green); border: 1px solid rgba(34,197,94,0.3); }
.btn-success:hover { background: var(--green); color: white; }

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-success { background: var(--green-bg); border: 1px solid rgba(34,197,94,0.3); color: var(--green); }
.alert-error { background: var(--red-bg); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }
.alert-warning { background: var(--yellow-bg); border: 1px solid rgba(234,179,8,0.3); color: var(--yellow); }
.alert-info { background: var(--accent-glow); border: 1px solid rgba(79,142,247,0.3); color: var(--accent); }

.filter-bar {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-bar .form-group { margin: 0; flex: 1; min-width: 150px; }
.filter-bar .form-group label { margin-bottom: 5px; }

.full-table .table-card { border-radius: var(--radius); }

/* ============================================
   REKAP & STATISTIK
   ============================================ */
.rekap-day {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.rekap-day:hover { border-color: var(--accent); }

.rekap-day-left { display: flex; align-items: center; gap: 16px; }
.rekap-day-date { font-weight: 700; font-family: var(--mono); color: var(--text-dim); }
.rekap-day-name { font-weight: 600; }

.rekap-mini-bar {
    display: flex;
    gap: 6px;
    align-items: center;
}

.rekap-mini-pill {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
}

.pill-hadir { background: var(--green-bg); color: var(--green); }
.pill-terlambat { background: var(--yellow-bg); color: var(--yellow); }
.pill-absen { background: var(--red-bg); color: var(--red); }

.pct-bar {
    width: 100px;
    height: 6px;
    background: var(--bg3);
    border-radius: 6px;
    overflow: hidden;
}

.pct-fill { height: 100%; background: var(--green); border-radius: 6px; }

/* Pengaturan */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .two-col { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .hamburger { display: block; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .page-content { padding: 16px; }
    .scan-form { flex-direction: column; }
    .form-row { grid-template-columns: 1fr; }
}

.fade-in { animation: fadein 0.4s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
