:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

/* Warm background theme for front page */
body.warm-theme {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 45%, #ffedd5 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

body.warm-theme .card {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(251, 191, 36, 0.3);
    box-shadow: 0 20px 25px -5px rgba(217, 119, 6, 0.1), 0 8px 10px -6px rgba(217, 119, 6, 0.05);
}

.container {
    max-width: 600px;
    margin: 1.5rem auto;
    padding: 0 0.75rem;
}

.card {
    background: var(--card);
    padding: 1.75rem 1.25rem;
    border-radius: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    text-align: center;
}

h1 {
    font-size: 1.4rem;
    margin-bottom: 1.25rem;
    font-weight: 700;
}

.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

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

/* Target specific text inputs to prevent iOS Safari auto-zoom without breaking checkboxes */
select, input[type="text"], input[type="number"], input[type="password"], input[type="date"], input[type="time"], input[type="email"] {
    width: 100%;
    padding: 0.75rem 0.85rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.6rem;
    font-size: 15px !important;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2064748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 1.1em;
    padding-right: 2.5rem;
}

select:focus, input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus, input[type="date"]:focus, input[type="time"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* BUTTON BASE STYLES */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 1.25rem;
    border: 1px solid transparent;
    border-radius: 0.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    text-align: center;
    line-height: 1.3;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none !important;
    transform: none !important;
}

/* SMALL BUTTON (FOR TABLES, FILTERS & ACTION BARS) */
.btn-sm {
    width: auto !important;
    min-height: 36px !important;
    height: 36px !important;
    padding: 0.4rem 0.85rem !important;
    font-size: 0.825rem !important;
    font-weight: 600 !important;
    border-radius: 0.5rem !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* BUTTON VARIANTS */
.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.15);
}

.btn-primary:hover:not(:disabled), .btn-primary:active:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-secondary {
    background: #94a3b8;
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.15);
}

.btn-success:hover:not(:disabled), .btn-success:active:not(:disabled) {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-warning {
    background: var(--warning);
    color: white;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.15);
}

.btn-warning:hover:not(:disabled), .btn-warning:active:not(:disabled) {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.15);
}

.btn-danger:hover:not(:disabled), .btn-danger:active:not(:disabled) {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-outline-danger {
    background: #fff;
    color: var(--danger);
    border: 1px solid #fca5a5;
}

.btn-outline-danger:hover:not(:disabled) {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-outline-secondary {
    background: #fff;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

.btn-outline-secondary:hover:not(:disabled) {
    background: #f1f5f9;
    color: var(--text);
}

.btn-admin-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    background: #f1f5f9;
    color: var(--primary);
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid #e2e8f0;
}

.btn-admin-nav:hover, .btn-admin-nav:active {
    background: #e2e8f0;
    color: var(--primary-hover);
}

.status-badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 0.75rem;
    width: 100%;
    text-align: center;
}

.status-stuck {
    background: #fee2e2;
    color: #ef4444;
}

.status-ok {
    background: #dcfce7;
    color: #16a34a;
}

/* Custom Modern Toggle Switch */
.switch-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.switch-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-pill {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    background-color: #cbd5e1;
    border-radius: 9999px;
    transition: background-color 0.3s;
    flex-shrink: 0;
}

.slider-pill::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch-toggle input:checked + .slider-pill {
    background-color: #10b981;
}

.switch-toggle input:checked + .slider-pill::before {
    transform: translateX(20px);
}

.status-label-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.2s;
}

.status-label-active {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.status-label-inactive {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* Status Badges for Attendance Report */
.badge-status {
    display: inline-block;
    padding: 0.25rem 0.55rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-ok {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-late {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.badge-early {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.badge-overtime {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.badge-shift {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* Luxury Professional Footer */
.app-footer {
    margin-top: 2rem;
    padding: 1.5rem 1rem;
    border-top: 1px solid rgba(251, 191, 36, 0.3);
    text-align: center;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(254, 243, 199, 0.4) 100%);
    border-radius: 1rem;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.02em;
}

.footer-dev {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.dev-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #f8fafc !important;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.8rem;
    text-decoration: none !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dev-link:hover, .dev-link:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.25);
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.footer-copy {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.2rem;
}

/* Dashboard Table & Layout */
.dashboard-container {
    max-width: 1150px;
    margin: 1.5rem auto;
    padding: 0 0.75rem;
}

.tab-nav {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
}

.tab-nav::-webkit-scrollbar {
    display: none;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: #fff;
    border-radius: 0.5rem;
    overflow: hidden;
}

th, td {
    padding: 0.75rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

th {
    background: #f8fafc;
    font-weight: 600;
}

.filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
    background: #f8fafc;
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
}

.filters .form-group {
    flex: 1;
    min-width: 150px;
}

@media (max-width: 640px) {
    .container { margin: 0.75rem auto; }
    .card { padding: 1.25rem 1rem; }
    th, td { padding: 0.6rem 0.5rem; font-size: 0.8rem; }
    .filters { flex-direction: column; align-items: stretch; }
    .filters .form-group { width: 100%; }
}

@media print {
    .filters, .btn-print, .no-print, .btn-admin-nav, .app-footer {
        display: none !important;
    }
    body {
        background: white;
    }
    .dashboard-container {
        max-width: 100%;
        margin: 0;
    }
}

/* ============================================================
   UTILITAS SEMBUNYIKAN
   Kelas ditulis ganda (.is-hidden.is-hidden) secara sengaja.
   Alasannya: .btn-sm memakai "display: inline-flex !important",
   yang mengalahkan atribut style="display:none" pada elemen.
   Menggandakan kelas menaikkan spesifisitas menjadi (0,2,0)
   sehingga aturan ini selalu menang tanpa bergantung pada urutan.
   ============================================================ */
.is-hidden.is-hidden {
    display: none !important;
}

/* ============================================================
   TOMBOL IKON
   Aksi tabel memakai ikon persegi agar muat sejajar dalam satu
   baris. Keterangan disampaikan lewat atribut title (tooltip
   bawaan browser) — tooltip berbasis CSS akan terpotong oleh
   pembungkus tabel yang ber-overflow.
   ============================================================ */
.btn-icon.btn-icon {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    font-size: 0.95rem;
    line-height: 1;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.aksi-grup {
    display: flex;
    gap: 0.35rem;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
}

/* ============================================================
   PERANGKAT TABEL STANDAR (cari / urut / paginasi)
   ============================================================ */
.tabel-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.tabel-cari {
    position: relative;
    flex: 1 1 240px;
    max-width: 360px;
}

.tabel-cari-ikon {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    opacity: 0.55;
    pointer-events: none;
}

.tabel-cari input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.1rem;
    font-size: 0.85rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #fff;
}

.tabel-toolbar-kanan select {
    padding: 0.5rem 0.65rem;
    font-size: 0.82rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #fff;
    width: auto;
}

th.th-urut {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.5rem !important;
}

th.th-urut::after {
    content: '⇅';
    position: absolute;
    right: 0.5rem;
    opacity: 0.25;
    font-size: 0.8rem;
}

th.th-urut:hover::after { opacity: 0.6; }
th.urut-naik::after  { content: '↑'; opacity: 1; color: var(--primary); }
th.urut-turun::after { content: '↓'; opacity: 1; color: var(--primary); }

.tabel-kaki {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.85rem;
}

.tabel-info {
    font-size: 0.8rem;
    color: #64748b;
}

.tabel-nav {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-wrap: wrap;
}

.tabel-hal {
    min-width: 34px;
    height: 34px;
    padding: 0 0.55rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: var(--text);
    border-radius: 0.45rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.tabel-hal:hover:not(:disabled):not(.aktif) { border-color: var(--primary); color: var(--primary); }
.tabel-hal.aktif { background: var(--primary); border-color: var(--primary); color: #fff; cursor: default; }
.tabel-hal:disabled { opacity: 0.4; cursor: not-allowed; }
.tabel-hal-jeda { padding: 0 0.15rem; color: #94a3b8; font-size: 0.82rem; }

@media (max-width: 640px) {
    .tabel-toolbar, .tabel-kaki { flex-direction: column; align-items: stretch; }
    .tabel-cari { max-width: none; }
    .tabel-nav { justify-content: center; }
}
