:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: radial-gradient(circle at top left, #1e1b4b, #0f172a);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 500px;
    padding: 2rem;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 2rem;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent, var(--primary), transparent 30%);
    animation: rotate 10s linear infinite;
    z-index: -1;
    opacity: 0.2;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

h1 {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
    line-height: 1;
}

h1 .sub-title {
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 6px;
    color: var(--text-muted);
    -webkit-text-fill-color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.3rem;
    margin-left: 6px;
    /* mengimbangi letter spacing agar tetap di tengah */
}

@media (min-width: 480px) {
    h1 {
        margin-bottom: 1.5rem;
    }

    h1 .sub-title {
        font-size: 1.1rem;
        letter-spacing: 8px;
        margin-left: 8px;
    }
}

/* Tambahkan styling khusus untuk teks DIGITAL agar tetap gradient */
h1 .main-title {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.clock {
    font-size: 3.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin: 1.5rem 0;
    color: var(--text-main);
    text-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

.date {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 2rem;
}

.status-valid {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-invalid {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

input[type="text"] {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 1.2rem;
    color: white;
    font-size: 1.2rem;
    text-align: center;
    transition: all 0.3s;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

.manual-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 1rem;
}

.manual-toggle:hover {
    color: var(--text-main);
}

.btn {
    width: 100%;
    padding: 1.2rem;
    border-radius: 1rem;
    border: none;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.4);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(79, 70, 229, 0.5);
}

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

.btn-small {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    border-radius: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s;
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn-camera-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--primary);
    color: var(--primary);
    font-size: 1rem;
    cursor: pointer;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-camera-icon:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

.mobile-toggle {
    display: none;
    position: fixed;
    top: 1.3rem;
    /* Turunkan sedikit agar sejajar tengah dengan 2 baris header */
    left: 1rem;
    z-index: 1002;
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.7rem;
    border-radius: 0.5rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .mobile-toggle {
        display: block;
    }
}

/* Modal Styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-dark);
    padding: 2.5rem;
    border-radius: 2rem;
    max-width: 400px;
    width: 90%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--warning);
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    background: #0f172a;
    width: 100%;
    overflow-x: hidden;
    /* Mencegah geser kanan-kiri yang merusak layout */
}

.sidebar {
    width: 220px;
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
    z-index: 1001;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        height: 100vh;
        background: #0f172a;
    }

    .sidebar.open {
        left: 0;
    }

    .main-content {
        padding: 1.2rem;
        padding-top: 5rem;
        width: 100%;
        min-width: 0;
        /* Penting agar kontainer bisa mengecil di flexbox */
        box-sizing: border-box;
    }

    .main-content header {
        margin-left: 2.5rem;
        /* Memberi ruang agar tidak tertutup tombol menu */
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
        justify-items: center;
    }

    .stats-card {
        width: 100%;
        /* Memastikan kartu memenuhi kolomnya */
    }

    .stats-card .value {
        font-size: 1.2rem;
    }

    .modern-table th,
    .modern-table td {
        padding: 0.5rem;
        font-size: 0.75rem;
    }

    .user-avatar {
        width: 24px;
        height: 24px;
        font-size: 0.6rem;
    }

    .badge-manual,
    .badge-success {
        padding: 0.2rem 0.4rem;
        font-size: 0.6rem;
    }
}

.sidebar-logo {
    font-weight: 800;
    font-size: 1.5rem;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 3rem;
}

.nav-item {
    padding: 1rem;
    border-radius: 1rem;
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s;
    margin-bottom: 0.5rem;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.main-content {
    flex: 1;
    padding: 1.2rem;
    overflow-y: auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.stats-card {
    background: none;
    padding: 0.4rem 0.6rem;
    border-left: 2px solid rgba(255, 255, 255, 0.05);
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.stats-card .label {
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stats-card .value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
}

@media (max-width: 768px) {
    .stats-card .label {
        font-size: 0.65rem;
        margin-bottom: 0.1rem;
    }

    .stats-card .value {
        font-size: 1.2rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hide-on-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .hide-on-desktop {
        display: none !important;
    }
}

/* Filter Section – compact on mobile */
.filter-section {
    background: rgba(255, 255, 255, 0.02);
    padding: 0.2rem 0.3rem;
    border-radius: 0.3rem;
    margin-bottom: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    align-items: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 60px;
}

.filter-group label {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-bottom: 0.1rem;
    text-transform: uppercase;
}

/* Dashboard Header & Inline Filter */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    gap: 1rem;
    min-height: 70px;
}
.header-title h2 {
    margin-bottom: 0.1rem;
    font-size: 1.3rem;
}
.header-title p {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: monospace;
}
.header-filter {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.filter-input-header {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 0.3rem 0.5rem;
    border-radius: 0.3rem;
    font-size: 0.75rem;
}
.filter-reset {
    font-size: 0.7rem;
    color: var(--danger);
    text-decoration: none;
    padding-left: 0.2rem;
}

.filter-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 0.15rem 0.3rem;
    border-radius: 0.25rem;
    font-size: 0.65rem;
    min-width: 70px;
}

.btn-filter {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.65rem;
    font-weight: 600;
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-header {
        flex-wrap: nowrap;
        gap: 0.3rem;
    }
    .header-title h2 { font-size: 1rem; }
    .header-title p { font-size: 0.65rem; }
    .header-filter { gap: 0.2rem; }
    .filter-input-header {
        padding: 0.2rem;
        font-size: 0.65rem;
    }
    .filter-input-header[type="date"] { max-width: 90px; }
    .filter-input-header[name="f_loc"] { max-width: 65px; }

    .filter-section {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
    }

    .filter-input {
        width: 100%;
    }

    .btn-filter {
        width: 100%;
        margin-top: 0.4rem;
    }
}

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

.data-table-container {
    background: none;
    border: none;
    padding: 0;
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 250px);
}

.modern-table td,
.modern-table th {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}


.modern-table th {
    text-align: left;
    padding: 1rem 0.75rem;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: sticky;
    top: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    z-index: 10;
}

@media (max-width: 768px) {
    .modern-table th {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
}

.modern-table td {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
}

/* Switch Toggle */
.switch { position: relative; display: inline-block; width: 40px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.1); transition: .4s; border-radius: 20px; border: 1px solid rgba(255,255,255,0.1); }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 2px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #fbbf24; border-color: #fbbf24; }
input:checked + .slider:before { transform: translateX(20px); }