/* ═══════════════════════════════════════════════════════════
   MasjidBD v13 — Reusable Components
   css/components.css
   Buttons, badges, inputs, modals, toasts, pills, etc.
   ═══════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 10px 20px;
  border-radius: var(--r);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  line-height: 1;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition:
    background var(--dur-base) var(--ease),
    color var(--dur-base) var(--ease),
    border-color var(--dur-base) var(--ease),
    box-shadow var(--dur-base) var(--ease),
    transform var(--dur-fast) var(--ease);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Solid green */
.btn-solid {
  background: var(--color-brand);
  color: white;
  border-color: var(--color-brand);
}
.btn-solid:hover {
  background: var(--color-brand-hover);
  border-color: var(--color-brand-hover);
  box-shadow: 0 4px 12px rgba(11,61,46,.25);
}

/* Gold / accent */
.btn-gold {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}
.btn-gold:hover {
  background: var(--color-accent-light);
  box-shadow: var(--shadow-gold);
}

/* Ghost / outline */
.btn-ghost {
  background: transparent;
  color: var(--color-brand);
  border-color: var(--color-brand);
}
.btn-ghost:hover {
  background: var(--color-brand-subtle);
}

/* White outline (on dark/forest backgrounds) */
.btn-outline-w {
  background: transparent;
  color: rgba(255,255,255,0.88);
  border-color: rgba(255,255,255,0.28);
}
.btn-outline-w:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.55);
  color: white;
}

/* Subtle / muted */
.btn-muted {
  background: var(--color-surface-3);
  color: var(--color-text-3);
  border-color: var(--color-border);
}
.btn-muted:hover {
  background: var(--color-sunken);
  color: var(--color-text);
}

/* Danger */
.btn-danger {
  background: var(--color-danger);
  color: white;
  border-color: var(--color-danger);
}
.btn-danger:hover {
  opacity: 0.88;
  box-shadow: 0 4px 12px rgba(192,57,43,.25);
}

/* Glass button */
[data-theme="glass"] .btn-solid {
  background: rgba(56,181,137,0.25);
  border-color: rgba(56,181,137,0.40);
  backdrop-filter: blur(8px);
}
[data-theme="glass"] .btn-solid:hover {
  background: rgba(56,181,137,0.38);
}
[data-theme="glass"] .btn-gold {
  background: rgba(212,176,94,0.22);
  border-color: rgba(212,176,94,0.40);
  backdrop-filter: blur(8px);
}

/* Size variants */
.btn-sm { padding: 7px 14px; font-size: var(--text-sm); border-radius: var(--r-sm); }
.btn-lg { padding: 13px 28px; font-size: var(--text-md); }
.btn-xl { padding: 16px 36px; font-size: var(--text-lg); }
.btn-block { width: 100%; }

/* ─────────────────────────────────────────────────────────
   INPUTS & FORM ELEMENTS
───────────────────────────────────────────────────────── */
.input, .select, .textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--r);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text);
  transition: border-color var(--dur-base) var(--ease),
              box-shadow var(--dur-base) var(--ease),
              background var(--dur-base) var(--ease);
}

.input::placeholder, .textarea::placeholder {
  color: var(--color-text-4);
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(11,61,46,.08);
  background: var(--color-surface);
}

[data-theme="glass"] .input,
[data-theme="glass"] .select,
[data-theme="glass"] .textarea {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
  color: var(--color-text);
}

[data-theme="glass"] .input:focus,
[data-theme="glass"] .select:focus,
[data-theme="glass"] .textarea:focus {
  background: rgba(255,255,255,0.10);
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(56,181,137,0.12);
}

.textarea { resize: vertical; min-height: 80px; line-height: var(--leading-relaxed); }
.select { cursor: pointer; }

.form-group { margin-bottom: var(--sp-4); }
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-2);
  margin-bottom: var(--sp-1);
}
.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-4);
  margin-top: var(--sp-1);
}
.form-error {
  font-size: var(--text-xs);
  color: var(--color-danger);
  margin-top: var(--sp-1);
}
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
@media (max-width: 600px) { .form-2col { grid-template-columns: 1fr; } }

/* ─────────────────────────────────────────────────────────
   BADGES & PILLS
───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  line-height: 1.6;
  letter-spacing: 0.02em;
}

.badge-green   { background: var(--color-success-bg); color: var(--color-success); }
.badge-gold    { background: var(--color-warning-bg); color: var(--c-gold-700); }
.badge-red     { background: var(--color-danger-bg);  color: var(--color-danger); }
.badge-blue    { background: var(--color-info-bg);    color: var(--color-info); }
.badge-muted   { background: var(--color-surface-3);  color: var(--color-text-3); }
.badge-brand   { background: var(--color-brand); color: white; }

/* Status dot */
.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}
.status-dot.green  { background: var(--color-success); }
.status-dot.gold   { background: var(--color-accent); }
.status-dot.red    { background: var(--color-danger); }
.status-dot.pulse  { animation: pulse 1.4s ease-in-out infinite; }

/* Pill selector (amount/filter rows) */
.pill {
  padding: 6px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--r-full);
  font-size: var(--text-sm);
  color: var(--color-text-3);
  cursor: pointer;
  background: var(--color-surface);
  transition: all var(--dur-base) var(--ease);
  font-weight: var(--weight-normal);
}
.pill:hover  { border-color: var(--color-brand); color: var(--color-brand); }
.pill.active { border-color: var(--color-brand); background: var(--color-brand-subtle); color: var(--color-brand); font-weight: var(--weight-medium); }

[data-theme="glass"] .pill {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.10);
  color: var(--color-text-3);
}
[data-theme="glass"] .pill.active {
  background: rgba(56,181,137,0.15);
  border-color: rgba(56,181,137,0.35);
  color: var(--color-brand);
}

/* ─────────────────────────────────────────────────────────
   CHIP (small filter)
───────────────────────────────────────────────────────── */
.chip {
  padding: 4px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-text-3);
  cursor: pointer;
  background: var(--color-surface);
  transition: all var(--dur-base) var(--ease);
  white-space: nowrap;
}
.chip:hover  { border-color: var(--color-border-2); color: var(--color-brand); }
.chip.active { border-color: var(--color-brand); background: var(--color-brand-subtle); color: var(--color-brand); }

/* ─────────────────────────────────────────────────────────
   MODAL
───────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-overlay.open { display: flex; animation: fadeIn var(--dur-base) var(--ease); }

.modal-box {
  background: var(--color-surface);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  max-width: 440px;
  width: 100%;
  position: relative;
  box-shadow: var(--shadow-xl);
  animation: scaleIn var(--dur-slow) var(--ease-spring);
}

[data-theme="glass"] .modal-box {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-xl), var(--glass-shadow);
}

.modal-close {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--color-text-3);
  font-size: 18px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.modal-close:hover { background: var(--color-surface-3); color: var(--color-text); }

.modal-title {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  color: var(--color-brand);
  margin-bottom: var(--sp-1);
}
.modal-sub {
  font-size: var(--text-base);
  color: var(--color-text-3);
  margin-bottom: var(--sp-6);
  font-weight: var(--weight-light);
}

/* Divider */
.divider-or {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--text-sm);
  color: var(--color-text-4);
  margin: var(--sp-4) 0;
}
.divider-or::before, .divider-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ─────────────────────────────────────────────────────────
   TOAST
───────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--sp-6);
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--color-brand);
  color: white;
  padding: 11px 22px;
  border-radius: var(--r-full);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  z-index: var(--z-toast);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all var(--dur-slow) var(--ease);
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.toast-error { background: var(--color-danger); }
.toast.toast-warn  { background: var(--color-accent); }

[data-theme="glass"] .toast {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--color-text);
}

/* ─────────────────────────────────────────────────────────
   TABLE
───────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; border-radius: var(--r-lg); box-shadow: var(--shadow); }
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
  background: var(--color-surface);
}
.tbl thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-3);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.tbl tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-2);
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: var(--color-surface-2); }

[data-theme="glass"] .tbl {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
[data-theme="glass"] .tbl tbody tr:hover td {
  background: rgba(255,255,255,0.05);
}

/* ─────────────────────────────────────────────────────────
   PROGRESS BAR
───────────────────────────────────────────────────────── */
.progress-track {
  height: 7px;
  background: var(--color-border);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--color-brand);
  border-radius: var(--r-full);
  transition: width var(--dur-slower) var(--ease);
}
.progress-fill.gold    { background: var(--color-accent); }
.progress-fill.danger  { background: var(--color-danger); }

/* ─────────────────────────────────────────────────────────
   KPI CARD (dashboard stats)
───────────────────────────────────────────────────────── */
.kpi-card {
  background: var(--color-surface-3);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  transition: background var(--dur-base) var(--ease);
}
.kpi-card:hover { background: var(--color-sunken); }

[data-theme="glass"] .kpi-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}
[data-theme="glass"] .kpi-card:hover {
  background: rgba(255,255,255,0.09);
}

.kpi-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--sp-2);
}
.kpi-value {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  color: var(--color-brand);
  line-height: 1;
  margin-bottom: var(--sp-1);
}
.kpi-sub { font-size: var(--text-sm); color: var(--color-text-3); }

/* ─────────────────────────────────────────────────────────
   TIMELINE (registration steps etc.)
───────────────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 32px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 9px; top: 6px; bottom: 6px;
  width: 1.5px;
  background: var(--color-border);
}
.timeline-item { position: relative; margin-bottom: var(--sp-5); }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -24px; top: 2px;
  width: 20px; height: 20px;
  border-radius: var(--r-full);
  background: var(--color-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: var(--weight-bold);
  color: white;
}
.timeline-title { font-weight: var(--weight-medium); color: var(--color-brand); font-size: var(--text-base); margin-bottom: var(--sp-1); }
.timeline-desc  { font-size: var(--text-sm); color: var(--color-text-3); line-height: var(--leading-relaxed); font-weight: var(--weight-light); }

/* ─────────────────────────────────────────────────────────
   SUCCESS STATE
───────────────────────────────────────────────────────── */
.success-state {
  display: none;
  text-align: center;
  padding: var(--sp-4) 0 var(--sp-2);
}
.success-state .icon  { font-size: 44px; margin-bottom: var(--sp-3); }
.success-state .title { font-family: var(--font-serif); font-size: var(--text-2xl); color: var(--color-brand); margin-bottom: var(--sp-2); }
.success-state .body  { font-size: var(--text-base); color: var(--color-text-3); line-height: var(--leading-relaxed); font-weight: var(--weight-light); }
