/* ============================================
   SETWAN DPRD Provinsi Jawa Barat
   Sistem Absensi Karyawan - Tema "SI ASAT" (dark/amber)
   ============================================ */

:root {
    --bg: #14100c;
    --bg-elevated: #1c1712;
    --panel: #1f1a15;
    --panel-2: #241e18;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);

    --accent: #c9833f;
    --accent-light: #e0a458;
    --accent-dark: #a06a2f;
    --accent-gradient: linear-gradient(135deg, #d99a52 0%, #b3742f 100%);

    --success: #3fae6a;
    --success-bg: rgba(63, 174, 106, 0.16);
    --danger: #e35b5b;
    --danger-bg: rgba(227, 91, 91, 0.16);
    --warning: #e0a458;
    --warning-bg: rgba(224, 164, 88, 0.16);
    --info: #5b9be3;
    --info-bg: rgba(91, 155, 227, 0.16);

    --text: #f3ece2;
    --text-muted: #ab9c8c;
    --text-faint: #7c705f;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --font-family: 'Segoe UI', 'Poppins', Tahoma, Geneva, Verdana, sans-serif;
    --transition: all 0.2s ease;
}

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

body {
    font-family: var(--font-family);
    background:
        radial-gradient(ellipse at 10% 0%, rgba(201, 131, 63, 0.08) 0%, transparent 45%),
        radial-gradient(ellipse at 90% 100%, rgba(201, 131, 63, 0.06) 0%, transparent 45%),
        var(--bg);
    min-height: 100vh;
    color: var(--text);
    line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* ===== HEADER ===== */
.app-header {
    background: var(--bg-elevated);
    color: var(--text);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.15rem;
}

.app-header .logo img { height: 40px; width: auto; }

.app-header .header-actions {
    display: flex;
    gap: 0.5rem;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ===== MENU GRID (halaman depan karyawan) ===== */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.menu-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.menu-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.menu-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.menu-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 0.35rem; color: var(--text); }
.menu-desc { color: var(--text-muted); font-size: 0.9rem; }

/* ===== CARD ===== */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card-header { margin-bottom: 1.25rem; }
.card-header h2 { font-size: 1.3rem; margin-bottom: 0.25rem; }
.card-header p { color: var(--text-muted); font-size: 0.9rem; }

/* ===== FORM ===== */
.form-group { margin-bottom: 1.15rem; }

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-faint); }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 131, 63, 0.18);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.15rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.4rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary,
.btn-secondary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled),
.btn-secondary:hover:not(:disabled) {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border-strong);
}

.btn-outline:hover { border-color: var(--accent); color: var(--accent-light); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }

.btn-warning { background: var(--warning); color: #241a0e; }

.btn-block { width: 100%; }
.btn-sm { padding: 0.5rem 0.9rem; font-size: 0.85rem; }

/* ===== ALERT ===== */
.alert {
    display: none;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert.show { display: block; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(63,174,106,0.35); }
.alert-error   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(227,91,91,0.35); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(224,164,88,0.35); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border: 1px solid rgba(91,155,227,0.35); }

/* ===== BADGE ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-secondary { background: rgba(255,255,255,0.08); color: var(--text-muted); }

/* ===== TABLE ===== */
.table-container { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }

thead th {
    background: var(--panel-2);
    color: var(--text);
    text-align: left;
    padding: 0.85rem 1rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
}

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

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    align-items: center;
}

.filter-bar input,
.filter-bar select {
    padding: 0.6rem 0.9rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
}

/* ===== CAMERA ===== */
.camera-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 auto 1rem;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    aspect-ratio: 4 / 3;
    border: 1px solid var(--border);
}

.camera-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

/* ===== STATUS LIST ===== */
.status-list { display: flex; flex-direction: column; gap: 0.5rem; margin: 1rem 0; }

.status-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    font-size: 0.9rem;
}

.status-item.success { border-color: rgba(63,174,106,0.4); color: var(--success); }
.status-item.error   { border-color: rgba(227,91,91,0.4);  color: var(--danger); }
.status-item.warning  { border-color: rgba(224,164,88,0.4); color: var(--warning); }
.status-item.pending { color: var(--text-muted); }

.identity-box {
    background: var(--success-bg);
    border: 1px solid rgba(63,174,106,0.4);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
}

.identity-box .name { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.15rem; }
.identity-box .nip,
.identity-box .position { font-size: 0.85rem; color: var(--text-muted); }
.identity-box .receipt { margin-top: 0.6rem; text-align: left; }
.identity-box .receipt-row {
    display: flex; justify-content: space-between; gap: 1rem;
    padding: 0.4rem 0; border-top: 1px solid rgba(63,174,106,0.25); font-size: 0.9rem;
}
.identity-box .receipt-row span { color: var(--text-muted); }
.identity-box .receipt-row strong { text-align: right; word-break: break-word; }
.identity-box .status-badge {
    display: inline-block; margin-top: 0.5rem; font-size: 0.8rem;
    color: var(--success); font-weight: 600;
}

/* ===== POPUP HASIL ABSEN (di tengah layar) ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 8, 6, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.active { display: flex; }
.modal-card {
    background: var(--panel);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 380px;
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.18s ease-out;
}
.modal-card h3 { font-size: 1.25rem; margin-bottom: 0.25rem; }
.modal-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }
.modal-card .receipt { text-align: left; margin-bottom: 1.25rem; }
.modal-icon {
    width: 64px; height: 64px; margin: 0 auto 0.75rem;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 700;
}
.modal-icon.success { background: var(--success-bg); color: var(--success); }
.modal-icon.error { background: var(--danger-bg); color: var(--danger); }
.modal-icon.info { background: var(--info-bg); color: var(--info); }
.modal-card .receipt-row {
    display: flex; justify-content: space-between; gap: 1rem;
    padding: 0.45rem 0; border-top: 1px solid var(--border); font-size: 0.92rem;
}
.modal-card .receipt-row span { color: var(--text-muted); }
.modal-card .receipt-row strong { text-align: right; word-break: break-word; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }

/* ===== LOADING OVERLAY =====
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 8, 6, 0.75);
    z-index: 999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    color: var(--text);
}

.loading-overlay.active { display: flex; }

.loading-spinner {
    width: 42px; height: 42px;
    border: 4px solid rgba(255,255,255,0.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(10,8,6,0.7);
    align-items: center; justify-content: center;
    z-index: 900;
}
.modal-overlay.active { display: flex; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; max-width: 480px; width: 90%; }

/* ===== STAT CARDS (dashboard) ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 1.1rem 1.25rem;
}

.stat-card.success { border-left-color: var(--success); }
.stat-card.warning  { border-left-color: var(--warning); }
.stat-card.danger   { border-left-color: var(--danger); }
.stat-card.info     { border-left-color: var(--info); }

.stat-value { font-size: 1.7rem; font-weight: 800; }
.stat-label { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.15rem; }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 1rem; opacity: 0.6; }
.empty-state h3 { color: var(--text); margin-bottom: 0.4rem; }
.empty-state p { font-size: 0.9rem; margin-bottom: 1.25rem; }

/* ===== ADMIN SHELL (sidebar layout) ===== */
.admin-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1.1rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand { display: flex; align-items: center; gap: 0.7rem; padding: 0.25rem 0.4rem 1.5rem; }
.sidebar-brand .brand-mark {
    width: 42px; height: 42px; border-radius: 12px;
    background: var(--accent-gradient);
    flex-shrink: 0;
}
.sidebar-brand .brand-name { font-weight: 800; font-size: 1.05rem; line-height: 1.1; }
.sidebar-brand .brand-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }

.sidebar-section-title {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    text-transform: uppercase;
    margin: 1rem 0 0.5rem 0.5rem;
    font-weight: 700;
}

.sidebar-nav { list-style: none; display: flex; flex-direction: column; gap: 0.2rem; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 0.6rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    border-left: 3px solid transparent;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.sidebar-link:hover { background: rgba(255,255,255,0.04); color: var(--text); }

.sidebar-link.active {
    color: var(--text);
    background: rgba(201, 131, 63, 0.12);
    border-left-color: var(--accent);
}

.sidebar-link.cta {
    background: var(--accent-gradient);
    color: #fff;
    border-left: none;
    margin: 0.5rem 0 0.25rem;
    justify-content: center;
}
.sidebar-link.cta:hover { filter: brightness(1.08); color: #fff; }

.sidebar-footer { margin-top: auto; padding-top: 1rem; }

/* ===== TOPBAR (dalam admin shell) ===== */
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 1rem 1.75rem;
    border-bottom: 1px solid var(--border);
}

.topbar-user { display: flex; align-items: center; gap: 0.5rem; color: var(--text); font-weight: 600; font-size: 0.92rem; }

.admin-content { padding: 1.75rem; flex: 1; }

/* ===== TABS / PANES ===== */
.tab-pane { display: none; }
.tab-pane.active { display: block; }

@media (max-width: 880px) {
    .admin-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; }
}
