/* ============================================================
   TASKFLOW — Style Sheet
   Rekap Hafalan & Muroja'ah
   ============================================================ */

:root {
  /* Warna utama: hijau islami + aksen emas */
  --primary: #0f766e;
  --primary-light: #14b8a6;
  --primary-dark: #115e59;
  --accent: #d4a017;
  --accent-light: #eab308;

  /* Warna netral */
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --success: #16a34a;

  /* Efek */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .08);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, .12);
  --radius: 12px;
  --radius-lg: 20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   HALAMAN LOGIN
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 10% 20%, rgba(20, 184, 166, .08), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(212, 160, 23, .06), transparent 40%),
    var(--bg);
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 920px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  min-height: 560px;
}

/* --- Panel kiri: branding --- */
.login-brand {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary), var(--primary-light));
  color: #fff;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-brand::before {
  content: "";
  position: absolute;
  top: -80px;
  right: -80px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(255, 255, 255, .15), transparent 70%);
  border-radius: 50%;
}

.login-brand::after {
  content: "";
  position: absolute;
  bottom: -60px;
  left: -60px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(212, 160, 23, .25), transparent 70%);
  border-radius: 50%;
}

.brand-icon {
  font-size: 3rem;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.login-brand h1 {
  font-size: 1.75rem;
  line-height: 1.25;
  margin-bottom: 16px;
  font-weight: 700;
  letter-spacing: -.02em;
  position: relative;
  z-index: 1;
}

.brand-desc {
  font-size: .95rem;
  line-height: 1.6;
  opacity: .9;
  margin-bottom: 32px;
  position: relative;
  z-index: 1;
}

.brand-quote {
  padding: 20px;
  border-left: 3px solid var(--accent);
  background: rgba(255, 255, 255, .08);
  border-radius: 0 var(--radius) var(--radius) 0;
  position: relative;
  z-index: 1;
}

.brand-quote p {
  font-size: .9rem;
  line-height: 1.6;
  font-style: italic;
  margin-bottom: 8px;
}

.brand-quote span {
  font-size: .8rem;
  opacity: .8;
  font-weight: 600;
}

/* --- Panel kanan: form --- */
.login-form-panel {
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-header {
  margin-bottom: 32px;
}

.login-header h2 {
  font-size: 1.6rem;
  margin-bottom: 6px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.login-header p {
  color: var(--text-muted);
  font-size: .92rem;
}

/* --- Form --- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 13px 16px;
  font-size: .95rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
  font-family: inherit;
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, .12);
}

.form-group input::placeholder {
  color: var(--text-muted);
  opacity: .7;
}

/* --- Error box --- */
.login-error {
  padding: 12px 16px;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  font-size: .88rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* --- Tombol --- */
.btn-primary {
  width: 100%;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform .15s, filter .2s, opacity .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn-primary:active:not(:disabled) {
  transform: scale(.98);
}

.btn-primary:disabled {
  opacity: .65;
  cursor: not-allowed;
}

/* --- Footer kontak --- */
.login-footer {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.contact-title {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 4px;
}

.contact-name {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.contact-links {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--primary);
  background: rgba(15, 118, 110, .08);
  border-radius: 999px;
  text-decoration: none;
  transition: background .2s;
}

.contact-links a:hover {
  background: rgba(15, 118, 110, .16);
}

/* ============================================================
   RESPONSIVE — Mobile
   ============================================================ */

@media (max-width: 720px) {
  .login-container {
    grid-template-columns: 1fr;
    max-width: 440px;
    min-height: auto;
  }

  .login-brand {
    padding: 32px 28px;
  }

  .login-brand h1 {
    font-size: 1.4rem;
  }

  .brand-desc {
    margin-bottom: 20px;
    font-size: .88rem;
  }

  .brand-quote {
    padding: 14px 16px;
  }

  .brand-quote p {
    font-size: .82rem;
  }

  .login-form-panel {
    padding: 32px 28px;
  }

  .login-header h2 {
    font-size: 1.35rem;
  }
}

@media (max-width: 400px) {
  .login-page { padding: 12px; }
  .login-brand, .login-form-panel { padding: 24px 20px; }
}


/* ============================================================
   DASHBOARD (Guru & Siswa)
   ============================================================ */

.dashboard-page {
  background: var(--bg);
  min-height: 100vh;
}

/* --- Topbar --- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary-dark);
}

.logo-icon { font-size: 1.4rem; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-info {
  text-align: right;
  line-height: 1.3;
}

.user-role {
  display: block;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--primary);
  font-weight: 700;
}

.user-name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
}

.btn-logout {
  padding: 8px 14px;
  font-size: .85rem;
  font-weight: 600;
  background: transparent;
  color: var(--danger);
  border: 1.5px solid #fecaca;
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s;
  font-family: inherit;
}

.btn-logout:hover { background: var(--danger-bg); }

/* --- Container --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}

.subtitle {
  font-size: .9rem;
  color: var(--text-muted);
}

.btn-add {
  padding: 11px 20px;
  font-size: .9rem;
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-add span {
  font-size: 1.2rem;
  line-height: 1;
}

/* --- Loading --- */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 14px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- Grid Siswa --- */
.siswa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.siswa-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s, border-color .2s;
}

.siswa-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.siswa-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.siswa-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.siswa-nama {
  font-weight: 600;
  font-size: .98rem;
  margin-bottom: 2px;
  line-height: 1.3;
}

.siswa-username {
  font-size: .8rem;
  color: var(--text-muted);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.siswa-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-box {
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 8px;
  text-align: center;
}

.stat-number {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1;
}

.stat-label {
  font-size: .72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 4px;
  font-weight: 600;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: .6;
}

.empty-state h3 {
  color: var(--text);
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.empty-state p { font-size: .88rem; }

/* ============================================================
   MODAL
   ============================================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(2px);
  animation: fadeIn .15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
  position: relative;
  background: var(--card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s ease;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
  padding: 22px 24px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

.modal-header-success h2 {
  color: var(--success);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  border-radius: 6px;
  transition: background .2s;
}

.modal-close:hover { background: var(--bg); }

.modal-body {
  padding: 8px 24px 20px;
}

.modal-desc {
  font-size: .9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.modal-footer {
  padding: 12px 24px 22px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* --- Tombol Secondary --- */
.btn-secondary {
  padding: 12px 20px;
  font-size: .92rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  transition: background .2s;
}

.btn-secondary:hover { background: var(--border); }

/* --- Form hint --- */
.form-hint {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* --- Info box (hasil) --- */
.info-box {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  gap: 12px;
  font-size: .9rem;
}

.info-row + .info-row {
  border-top: 1px solid var(--border);
}

.info-label {
  color: var(--text-muted);
  font-weight: 500;
}

.info-value {
  font-weight: 600;
  color: var(--text);
  text-align: right;
  word-break: break-all;
}

.info-value.mono {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.info-value.big {
  font-size: 1.5rem;
  color: var(--primary-dark);
  letter-spacing: .1em;
}

.info-row.highlight {
  background: rgba(212, 160, 23, .1);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 4px -12px 0;
  border-top: none !important;
}

.warning-text {
  font-size: .82rem;
  color: #b45309;
  background: #fffbeb;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #fde68a;
  line-height: 1.5;
}

/* ============================================================
   RESPONSIVE — Dashboard Mobile
   ============================================================ */

@media (max-width: 640px) {
  .topbar-inner { padding: 12px 16px; }
  .logo-text { display: none; }
  .user-role { display: none; }
  .container { padding: 20px 16px 40px; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header h1 { font-size: 1.35rem; }
  .btn-add { width: 100%; justify-content: center; }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn-primary,
  .modal-footer .btn-secondary { width: 100%; }
}