/* ===== KelasKu — komponen UI (tombol, form, modal, toast, dll) ===== */

/* Tombol */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--primary-border-strong); background: var(--th-bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-icon { padding: 6px 10px; font-size: 16px; line-height: 1; }

/* Form */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Blind eye: toggle lihat/sembunyikan password (profil & form lain) */
.pass-field { position: relative; }
.pass-field input { padding-right: 42px; }
.pass-eye {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  padding: 8px;
  font-size: 15px;
  border-radius: 6px;
}
.pass-eye:hover { color: var(--primary); }

/* Card & section */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h3 { font-size: 16px; margin-bottom: 12px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.section-head h3 { margin-bottom: 0; }

/* Modal */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
}
.modal {
  position: relative;
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.modal h3 { font-size: 17px; margin-bottom: 16px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* Dialog konfirmasi custom */
.modal-konfirmasi {
  text-align: center;
  padding: 4px 2px;
}
.modal-konfirmasi h3 {
  margin: 14px 0 8px;
}
.modal-konfirmasi .modal-actions {
  justify-content: center;
  margin-top: 22px;
}
.modal-konfirmasi-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 22px;
}
.modal-konfirmasi-icon-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Toast */
.toast-root {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease;
  max-width: 320px;
}
.toast-success { background: var(--success); border-color: var(--success); color: #fff; }
.toast-error { background: var(--danger); border-color: var(--danger); color: #fff; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Toolbar absensi */
.absen-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.absen-toolbar input[type="date"] {
  width: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
}
.absen-select,
.absen-ket {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
}

/* Draft absen harian: baris yang belum dikonfirmasi */
.absen-pending-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--warning);
  background: var(--warning-soft);
  padding: 4px 10px;
  border-radius: 999px;
}
.absen-row-pending td {
  background: var(--warning-soft);
}
.absen-row-pending td:first-child {
  border-left: 3px solid var(--warning);
}
.absen-pending-dot {
  color: var(--warning);
  margin-left: 6px;
  font-size: 12px;
}

/* Progress bar kas */
.progress {
  height: 10px;
  background: var(--primary-soft);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0 4px;
}
.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* ===== Matriks kas mingguan ===== */
.kas-matrix { min-width: 960px; }
.kas-matrix th {
  text-align: center;
  font-size: 10.5px;
  padding: 8px 4px;
  white-space: nowrap;
}
.kas-matrix td.kas-cell { text-align: center; padding: 6px 4px; }
.kas-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 11px;
}
.kas-lunas { background: var(--success-soft); color: var(--success); }
.kas-belum { background: var(--danger-soft); color: var(--danger); }
.kas-kosong { background: var(--th-bg); color: var(--text-muted); font-size: 12px; }
.kas-partial { font-size: 11.5px; color: var(--warning); font-weight: 700; white-space: nowrap; }
.kas-matrix td:first-child {
  position: sticky;
  left: 0;
  background: var(--surface);
  min-width: 180px;
  z-index: 1;
}

/* Impor cepat PR & tugas (tempel banyak baris) */
.impor-area {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
  min-height: 160px;
}
.modal code {
  background: var(--th-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
}

/* Toggle switch (mis. bagikan tugas ke pengingat) */
.switch-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
  margin-bottom: 14px;
}
.switch-field:hover { border-color: var(--primary-border-strong); }
.switch { position: relative; display: inline-block; flex: 0 0 auto; margin-top: 2px; }
.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.switch-track {
  display: block;
  position: relative;
  width: 40px;
  height: 23px;
  border-radius: 999px;
  background: var(--text-soft);
  transition: background 0.2s;
}
.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s;
}
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(17px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--primary-soft); }
.switch-info { display: flex; flex-direction: column; gap: 2px; }
.switch-info strong { font-size: 13.5px; }
.switch-info span { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* Tag status berbagi pada kartu PR */
.pr-share-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary-deep);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border-soft);
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.pr-share-off {
  color: var(--text-muted);
  background: var(--th-bg);
  border-color: var(--border);
}

/* Daftar cadangan data (halaman Profil) */
.cadangan-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 0;
  border-top: 1px solid var(--border);
}
.cadangan-item:first-of-type { border-top: none; }
.cadangan-item strong { display: block; font-size: 13.5px; }
.cadangan-item span { font-size: 12px; }

/* Utilitas teks */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); font-weight: 600; }
.text-danger { color: var(--danger); font-weight: 600; }
.text-warning { color: var(--warning); font-weight: 600; }
.mt-16 { margin-top: 16px; }

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}
