/* ============================================================
   ABRA INTERNAL — Mobile-First CSS
   ============================================================ */

:root {
    --primary: #2C3E50;
    --accent:  #E67E22;
    --green:   #27AE60;
    --blue:    #2980B9;
    --purple:  #8E44AD;
    --red:     #E74C3C;
    --yellow:  #F39C12;
    --bg:      #F0F2F5;
    --white:   #FFFFFF;
    --gray:    #7F8C8D;
    --text:    #2C3E50;
    --border:  #E5E7EB;
    --shadow:  0 2px 12px rgba(0,0,0,0.08);
    --radius:  12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { font-size: 16px; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 70px; /* space for bottom nav */
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    background: var(--primary);
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.topbar-title { font-weight: 700; font-size: 1.05rem; }
.topbar-sub   { font-size: 0.72rem; color: rgba(255,255,255,0.7); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--accent); color: white;
    font-weight: 700; font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ============================================================
   BOTTOM NAVIGATION
   ============================================================ */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: white;
    display: flex; justify-content: space-around; align-items: center;
    height: 64px;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
    z-index: 100;
    border-top: 1px solid var(--border);
}
.nav-item {
    display: flex; flex-direction: column; align-items: center;
    gap: 3px; padding: 8px 12px;
    color: var(--gray); text-decoration: none;
    font-size: 0.65rem; font-weight: 600;
    flex: 1; transition: color 0.2s;
}
.nav-item.active { color: var(--primary); }
.nav-item .nav-icon { font-size: 1.4rem; }
.nav-badge {
    background: var(--red); color: white;
    border-radius: 10px; padding: 1px 6px;
    font-size: 0.6rem; font-weight: 700;
    position: absolute; top: 6px; right: calc(50% - 20px);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main { padding: 16px; max-width: 600px; margin: 0 auto; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: white; border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden;
    margin-bottom: 14px;
}
.card-header {
    padding: 14px 16px;
    font-weight: 700; font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 16px; }

/* ============================================================
   STAT CARDS (dashboard)
   ============================================================ */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}
.stat-card {
    background: white; border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px; position: relative; overflow: hidden;
}
.stat-card::before {
    content: ''; position: absolute;
    top: -20px; right: -20px;
    width: 70px; height: 70px;
    border-radius: 50%; opacity: 0.1;
    background: currentColor;
}
.stat-icon { font-size: 1.6rem; margin-bottom: 6px; }
.stat-val  { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.stat-lbl  { font-size: 0.72rem; color: var(--gray); margin-top: 4px; }
.stat-card.green { color: var(--green); }
.stat-card.blue  { color: var(--blue);  }
.stat-card.orange{ color: var(--accent);}
.stat-card.purple{ color: var(--purple);}
.stat-card.red   { color: var(--red);   }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group { margin-bottom: 14px; }
.form-label {
    display: block; font-size: 0.8rem;
    font-weight: 600; color: var(--gray);
    margin-bottom: 6px;
}
.form-control {
    width: 100%; padding: 12px 14px;
    border: 1.5px solid var(--border); border-radius: 10px;
    font-size: 1rem; font-family: inherit; color: var(--text);
    background: white; transition: border-color 0.2s;
    -webkit-appearance: none;
}
.form-control:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(44,62,80,0.1); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { appearance: auto; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 20px; border-radius: 10px;
    font-weight: 700; font-size: 0.95rem; font-family: inherit;
    border: none; cursor: pointer; transition: all 0.2s;
    text-decoration: none; line-height: 1;
}
.btn:active { transform: scale(0.97); }
.btn-primary  { background: var(--primary); color: white; }
.btn-accent   { background: var(--accent);  color: white; }
.btn-green    { background: var(--green);   color: white; }
.btn-blue     { background: var(--blue);    color: white; }
.btn-red      { background: var(--red);     color: white; }
.btn-outline  { background: white; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-sm       { padding: 8px 14px; font-size: 0.8rem; border-radius: 8px; }
.btn-block    { width: 100%; }
.btn-lg       { padding: 16px; font-size: 1.05rem; border-radius: 12px; }
.btn-disabled { background: #BDC3C7; color: white; cursor: not-allowed; }

/* ============================================================
   LIST ITEMS
   ============================================================ */
.list-item {
    display: flex; align-items: center;
    padding: 14px 16px; gap: 12px;
    border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-avatar {
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--primary); color: white;
    font-weight: 700; font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.list-info { flex: 1; min-width: 0; }
.list-name { font-weight: 600; font-size: 0.9rem; }
.list-sub  { font-size: 0.75rem; color: var(--gray); margin-top: 2px; }
.list-right{ text-align: right; flex-shrink: 0; }

/* ============================================================
   BADGES / PILLS
   ============================================================ */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 0.72rem; font-weight: 700;
}
.badge-green  { background: #D5F5E3; color: #1E8449; }
.badge-blue   { background: #D6EAF8; color: #1A5276; }
.badge-orange { background: #FDEBD0; color: #784212; }
.badge-red    { background: #FADBD8; color: #922B21; }
.badge-purple { background: #E8DAEF; color: #6C3483; }
.badge-gray   { background: #F2F3F4; color: #555; }
.badge-yellow { background: #FEF9E7; color: #7D6608; }

/* ============================================================
   ABSENSI / KAMERA
   ============================================================ */
.camera-wrapper {
    position: relative; width: 100%;
    background: #000; border-radius: 12px;
    overflow: hidden; aspect-ratio: 3/4;
    max-height: 380px;
}
#videoPreview {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transform: scaleX(-1); /* mirror selfie */
}
#capturedPhoto {
    width: 100%; height: 100%;
    object-fit: cover; display: none;
}
.camera-overlay {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    justify-content: flex-end; padding: 16px;
    background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 60%);
}
.btn-capture {
    width: 68px; height: 68px; border-radius: 50%;
    background: white; border: 4px solid rgba(255,255,255,0.5);
    cursor: pointer; margin: 0 auto;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; transition: 0.2s;
}
.btn-capture:active { transform: scale(0.9); }

/* ============================================================
   ALERT / NOTIF
   ============================================================ */
.alert {
    padding: 12px 14px; border-radius: 10px;
    font-size: 0.85rem; font-weight: 600; margin-bottom: 14px;
}
.alert-success { background: #D5F5E3; color: #1E8449; }
.alert-error   { background: #FADBD8; color: #922B21; }
.alert-info    { background: #D6EAF8; color: #1A5276; }
.alert-warning { background: #FEF9E7; color: #7D6608; }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; min-width: 400px; }
table th { background: #F8F9FA; padding: 10px; text-align: left; font-size: 0.75rem; color: var(--gray); font-weight: 700; text-transform: uppercase; }
table td { padding: 10px; border-bottom: 1px solid var(--border); }
table tr:last-child td { border-bottom: none; }

/* ============================================================
   SECTION TITLE
   ============================================================ */
.section-title {
    font-size: 0.75rem; font-weight: 700;
    color: var(--gray); text-transform: uppercase;
    letter-spacing: 0.5px; margin-bottom: 10px; margin-top: 4px;
}

/* ============================================================
   DIVIDER
   ============================================================ */
.divider { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center; padding: 40px 20px; color: var(--gray);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.88rem; }

/* ============================================================
   FLOATING ACTION BUTTON
   ============================================================ */
.fab {
    position: fixed; bottom: 78px; right: 16px;
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--accent); color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; box-shadow: 0 4px 15px rgba(230,126,34,0.4);
    cursor: pointer; border: none; text-decoration: none;
    transition: 0.2s; z-index: 90;
}
.fab:active { transform: scale(0.9); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh; background: var(--primary);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 24px;
}
.login-card {
    background: white; border-radius: 20px;
    padding: 28px 24px; width: 100%;
    max-width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.login-logo {
    text-align: center; margin-bottom: 24px;
}
.login-logo .logo-icon { font-size: 3rem; }
.login-logo h1 { font-size: 1.5rem; font-weight: 800; color: var(--primary); margin-top: 8px; }
.login-logo p  { font-size: 0.8rem; color: var(--gray); margin-top: 4px; }

/* ============================================================
   CHIP / TAG
   ============================================================ */
.chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 20px;
    font-size: 0.72rem; font-weight: 600;
    background: var(--bg); color: var(--gray);
}

/* ============================================================
   PAGE HEADER (inside pages)
   ============================================================ */
.page-header {
    background: white; border-radius: var(--radius);
    padding: 16px; margin-bottom: 14px;
    box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 12px;
}
.page-header-icon { font-size: 2rem; }
.page-header h2 { font-size: 1.05rem; font-weight: 700; }
.page-header p  { font-size: 0.78rem; color: var(--gray); margin-top: 2px; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress { background: #ECF0F1; border-radius: 10px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 10px; background: var(--green); transition: width 0.4s; }

/* ============================================================
   CLOCK DISPLAY
   ============================================================ */
.clock-display {
    text-align: center; padding: 20px;
    font-size: 2.5rem; font-weight: 800; color: var(--primary);
    font-variant-numeric: tabular-nums;
}
.clock-date { font-size: 0.9rem; color: var(--gray); font-weight: 400; }

/* ============================================================
   RESPONSIVE DESKTOP
   ============================================================ */
@media (min-width: 600px) {
    body { padding-bottom: 0; }
    .main { padding: 20px 24px; max-width: 900px; }
    .stat-grid { grid-template-columns: repeat(4, 1fr); }
    .bottom-nav { display: none; }
    .desktop-sidebar {
        display: flex; width: 220px;
        background: var(--primary); min-height: 100vh;
        flex-direction: column; position: fixed; top: 0; left: 0;
    }
    .desktop-main { margin-left: 220px; }
    .fab { bottom: 20px; }
}
