/* ============================================================
   SDM App - Main Style Sheet
   ============================================================ */

/* Google Font Montserrat — now loaded via <link> in layouts */

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
  --rm-bg: #F5F5F5;
  --rm-surface: #ffffff;
  --rm-panel: #ffffff;
  --rm-panel-soft: #f8fafc;
  --rm-line: #e8e8e8;
  --rm-text: #222222;
  --rm-muted: #5a5a5a;
  --rm-accent: #f8c32e;
  --rm-accent-soft: rgba(248, 195, 46, .12);
  --rm-danger: #b42318;
  --rm-shadow: 0 24px 60px rgba(0, 0, 0, .08);
  --rm-radius: 22px;

  /* Layout */
  --sidebar-w: 210px;
  --sidebar-w-collapsed: 60px;
  --layout-gap: 16px;
  --layout-pad: 14px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 400;
  color: var(--rm-text);
  background: var(--rm-bg);
}

/* Mobile: when sidebar becomes a fixed drawer, allow the page to scroll */
@media (max-width: 760px) {
  html,
  body {
    height: auto;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Lock scroll only while the drawer is open */
  body.rm-nav-open {
    overflow: hidden;
  }
}

a {
  text-decoration: none;
  color: inherit;
}

ul,
li {
  list-style: none;
}

button {
  cursor: pointer;
  font-family: inherit;
}

input,
select,
textarea {
  font-family: inherit;
}

/* ============================================================
   SHELL LAYOUT
   ============================================================ */
.rm-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: var(--layout-gap);
  padding: var(--layout-pad);
  height: 100vh;
  overflow: visible;
}

.rm-shell:has(.rm-app-sidebar.is-collapsed) {
  grid-template-columns: var(--sidebar-w-collapsed) 1fr;
}

/* ============================================================
   CONTENT PANEL - white bg, border-radius
   ============================================================ */
.rm-content {
  background: var(--rm-panel);
  border-radius: 20px;
  overflow-y: auto;
  max-height: calc(100vh - (var(--layout-pad) * 2));
  overscroll-behavior: contain;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .06);
  padding: 18px;
}

/* ============================================================
   UTILITY
   ============================================================ */
.rm-hover-soft:hover {
  background: var(--rm-accent-soft);
}

.rm-hover-danger:hover {
  background: rgba(180, 35, 24, .08);
}

/* ============================================================
   PERSONIL LIST TABLE
   ============================================================ */
.rl-page {
  padding: 14px 6px;
}

.rl-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.rl-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.3;
  margin: 0;
}

.rl-meta {
  font-size: 12px;
  color: var(--rm-muted);
}

.rl-divider {
  border: none;
  margin: 12px 0 16px;
}

/* Active nav state */
.sidebar-nav__link.is-active {
  background: var(--rm-accent-soft);
  color: var(--rm-accent);
  font-weight: 700;
}

.sidebar-nav__link.is-active .sidebar-nav__icon {
  color: var(--rm-accent);
}

/* Messages */
.rl-msg {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 14px;
}

.rl-msg--ok {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.rl-msg--err {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.rl-msg-link {
  font-weight: 700;
  text-decoration: underline;
}

.rl-back-link {
  font-size: 12px;
  color: var(--rm-muted);
  text-decoration: none;
  font-weight: 600;
}

.rl-back-link:hover {
  color: var(--rm-accent);
}

/* Primary button */
.rl-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s ease;
}

.rl-btn--primary {
  background: var(--rm-accent);
  color: #000;
}

.rl-btn--primary:hover {
  box-shadow: 0 2px 12px rgba(255, 215, 0, .4);
}

.rl-btn--ghost {
  color: var(--rm-muted);
  border: 1px solid var(--rm-line);
}

.rl-btn--ghost:hover {
  background: var(--rm-accent-soft);
  color: var(--rm-text);
}

.rl-btn--ghost-sm {
  background: none;
  color: var(--rm-muted);
  border: 1px solid var(--rm-line);
  border-radius: 4px;
  cursor: pointer;
}

.rl-btn--ghost-sm:hover {
  background: var(--rm-accent-soft);
  color: var(--rm-text);
}

.rl-btn.rl-btn--success {
  background: #27ae60;
  color: #fff;
  border: none;
}

.rl-btn.rl-btn--success:hover {
  background: #219653;
  box-shadow: 0 2px 12px rgba(39, 174, 96, 0.4);
}

.rl-btn.rl-btn--success-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 7px 14px;
  border-radius: 8px;
  background: #27ae60;
  color: #fff;
  border: none;
  text-decoration: none;
}

.rl-btn.rl-btn--success-sm:hover {
  background: #219653;
}


.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  /* added line */
  border: 0;
}

/* ============================================================
   Shared form field styles (af-*)
   ============================================================ */
.af-field-box {
  background: var(--rm-surface);
  border: 1px solid var(--rm-line);
  border-radius: 10px;
  padding: 6px 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.af-field-box:focus-within {
  border-color: var(--rm-accent);
  box-shadow: 0 0 0 3px var(--rm-accent-soft);
}

.af-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--rm-text);
  letter-spacing: .02em;
}

.af-input {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 0;
  width: 100%;
  border: none;
  background: var(--rm-surface);
  color: var(--rm-text);
  outline: none;
}

.af-input::placeholder {
  color: var(--rm-muted);
}

.af-select {
  cursor: pointer;
  appearance: auto;
}

.global-prompt-input {
  border: 1px solid var(--rm-line);
  border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.global-prompt-input:focus {
  border-color: var(--rm-accent);
  box-shadow: 0 0 0 3px var(--rm-accent-soft);
  outline: none;
}

/* Notification checkmark animation */
@keyframes notifCheckDraw {
  to {
    stroke-dashoffset: 0;
  }
}

/* ===== Global Modal (showAlert / showConfirm) ===== */
.global-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99998;
  opacity: 0;
  transition: opacity .2s;
}

.global-modal-overlay.is-open {
  opacity: 1;
}

.global-modal-overlay.is-closing {
  opacity: 0;
  transition: opacity .2s;
}

.global-modal-overlay.is-closing .global-modal-panel {
  transform: scale(.9);
  transition: transform .2s;
}

.global-modal-panel {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
  transform: scale(.95);
  transition: transform .2s;
}

.global-modal-overlay.is-open .global-modal-panel {
  transform: scale(1);
}

.global-modal-msg {
  margin: 0 0 20px;
  font-size: 14px;
  color: #1e293b;
  line-height: 1.5;
}

.global-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Tombol modal global — seragam dengan rm-btn (rounded 12px, accent kuning) */
.global-modal-batal,
.global-modal-ok {
  padding: 10px 14px;
  border: 1px solid var(--rm-line, #e8e8e8);
  border-radius: 12px;
  background: #fff;
  color: var(--rm-text, #374151);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: .18s ease;
}

.global-modal-batal:hover,
.global-modal-ok:hover {
  background: #f1f5f9;
}

.global-modal-confirm {
  padding: 10px 14px;
  border: none;
  border-radius: 12px;
  background: var(--rm-accent, #f8c32e);
  color: #222;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: .18s ease;
}

.global-modal-confirm:hover {
  background: #e5b220;
}

/* Mode destruktif (hapus, restore menimpa data) — merah */
.global-modal-confirm.is-danger {
  background: #dc2626;
  color: #fff;
}

.global-modal-confirm.is-danger:hover {
  background: #b91c1c;
}

/* ===== Global Toast ===== */
.global-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 10px;
  color: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .15);
  pointer-events: none;
  transition: bottom .25s cubic-bezier(.21,1.02,.73,1);
}

.global-toast--success {
  background: #16a34a;
}

.global-toast--error {
  background: #dc2626;
}

.global-toast--info {
  background: #2563eb;
}

.global-toast-hide {
  opacity: 0 !important;
  transform: translateY(12px) scale(.92) !important;
  transition: opacity .3s, transform .3s;
}

@keyframes toastIn {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(.92);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}