/* =========================================================
   ADMIN AREA — shared modern styles
   Relies on the CSS variables defined in css/style.css
   (both files are linked together on every admin page).
   ========================================================= */

body.admin-body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  background: var(--bg, #f3f5f8);
}

/* Login / users / change-password pages don't have a map to fill the
   screen — they should scroll normally instead of inheriting the
   fixed-height, overflow:hidden body used by the map pages. */
body.admin-simple {
  display: block;
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: auto;
}

/* =========================================================
   ADMIN STRIP (top nav bar shown on every admin page)
   ========================================================= */

.admin-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;

  background: linear-gradient(120deg, #0b1220, #111c33 60%, #0f2338);
  color: #fff;

  padding: 10px 20px;
  min-height: 44px;
  box-sizing: border-box;

  position: relative;
  z-index: 200;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.admin-strip .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 5px 12px;
  border-radius: 99px;
}

.admin-strip nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-strip a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.admin-strip a:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

.admin-strip a.public {
  color: #7dd3fc;
}

.admin-strip a.public:hover {
  background: rgba(56, 189, 248, 0.14);
}

.admin-strip a.logout {
  color: #fca5a5;
}

.admin-strip a.logout:hover {
  background: rgba(248, 113, 113, 0.14);
}

/* =========================================================
   SIMPLE ADMIN PAGES (login / users / change password)
   ========================================================= */

.wrap {
  max-width: 640px;
  margin: 32px auto;
  padding: 0 16px;
}

.wrap.narrow {
  max-width: 420px;
}

.card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e6eaf0);
  border-radius: var(--radius, 12px);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(15, 23, 42, 0.06));
  padding: 20px 22px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 14px;
  color: var(--text, #0f172a);
}

.wrap label,
.card label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 12px 0 6px;
  color: var(--text-muted, #64748b);
}

.wrap input[type="text"],
.wrap input[type="password"],
.card input[type="text"],
.card input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: var(--radius-sm, 8px);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wrap input:focus,
.card input:focus {
  outline: none;
  border-color: var(--brand, #0d7a3d);
  box-shadow: 0 0 0 3px rgba(13, 122, 61, 0.15);
}

button.primary {
  margin-top: 14px;
  padding: 11px 18px;
  border: none;
  border-radius: var(--radius-sm, 8px);
  background: linear-gradient(120deg, var(--brand-dark, #095c2d), var(--brand, #0d7a3d));
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.08s ease;
}

button.primary:hover {
  filter: brightness(1.08);
}

button.primary:active {
  transform: scale(0.98);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 9px 6px;
  border-bottom: 1px solid var(--surface-2, #f1f5f9);
}

th {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint, #94a3b8);
}

.tag-you {
  font-size: 10px;
  font-weight: 700;
  background: #dbeafe;
  color: #1d4ed8;
  padding: 2px 7px;
  border-radius: 99px;
  margin-left: 6px;
}

form.inline {
  display: inline;
}

.del-btn {
  color: var(--danger, #dc2626);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
}

.del-btn:hover {
  background: #fee2e2;
}

.notice {
  background: #ecfdf5;
  color: #166534;
  border: 1px solid #bbf7d0;
  padding: 10px 14px;
  border-radius: var(--radius-sm, 8px);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

.err {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  padding: 10px 14px;
  border-radius: var(--radius-sm, 8px);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* =========================================================
   LOGIN PAGE
   ========================================================= */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(24px + env(safe-area-inset-top, 0px)) calc(24px + env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) calc(24px + env(safe-area-inset-left, 0px));
  background:
    radial-gradient(1200px 700px at 15% 10%, rgba(13, 122, 61, 0.35), transparent 60%),
    radial-gradient(900px 600px at 85% 90%, rgba(249, 115, 22, 0.22), transparent 55%),
    linear-gradient(150deg, #060b16, #0b1220 55%, #0f2338);
}

.login-box {
  width: min(380px, 100%);
  background: rgba(255, 255, 255, 0.98);
  padding: 30px 30px 26px;
  border-radius: var(--radius-lg, 18px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.login-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(120deg, var(--brand-dark, #095c2d), var(--brand, #0d7a3d));
  font-size: 24px;
  margin-bottom: 14px;
  box-shadow: 0 8px 20px rgba(13, 122, 61, 0.35);
}

.login-box h1 {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 2px;
  color: var(--text, #0f172a);
  letter-spacing: -0.01em;
}

.login-box .subtitle {
  font-size: 12.5px;
  color: var(--text-muted, #64748b);
  margin: 0 0 6px;
}

.login-box label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 14px 0 6px;
  color: var(--text-muted, #64748b);
}

.login-box input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 13px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: var(--radius-sm, 8px);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-box input:focus {
  outline: none;
  border-color: var(--brand, #0d7a3d);
  box-shadow: 0 0 0 3px rgba(13, 122, 61, 0.15);
}

.login-box button[type="submit"] {
  margin-top: 20px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm, 8px);
  background: linear-gradient(120deg, var(--brand-dark, #095c2d), var(--brand, #0d7a3d));
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.08s ease;
}

.login-box button[type="submit"]:hover {
  filter: brightness(1.08);
}

.login-box button[type="submit"]:active {
  transform: scale(0.98);
}

.login-box .err {
  margin-top: 14px;
  margin-bottom: 0;
}

.back-public {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border, #e6eaf0);
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  text-decoration: none;
  transition: color 0.15s ease;
}

.back-public:hover {
  color: var(--brand, #0d7a3d);
}

/* =========================================================
   ADMIN DASHBOARD SHELL (index.php: strip + topbar + map app)
   ========================================================= */

.admin-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.admin-shell .app {
  flex: 1;
  min-height: 0;
  height: auto !important;
}

.admin-strip .badge .lock {
  font-size: 13px;
}

/* ---- Layer kawasan card ---- */
.layer-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 10px;
  margin-bottom: 6px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e6eaf0);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.05);
  transition: box-shadow 0.15s ease;
}

.layer-row:last-child {
  margin-bottom: 0;
}

.layer-row:hover {
  box-shadow: 0 2px 8px rgba(15,23,42,0.10);
}

.layer-row-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.layer-row-top input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  accent-color: var(--brand, #0d7a3d);
  cursor: pointer;
}

.layer-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}

.layer-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text, #0f172a);
  line-height: 1.4;
  word-break: break-word;
}

.layer-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 22px; /* align with text after checkbox */
}

.layer-row .lihat {
  color: var(--brand, #0d7a3d);
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
  transition: background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.layer-row .lihat:hover {
  background: #dcfce7;
  border-color: #86efac;
}

.layer-row .lihat.active {
  background: #dcfce7;
  border-color: #4ade80;
  color: #166534;
}

.layer-row .del {
  color: var(--danger, #b91c1c);
  background: #fff1f2;
  border: 1px solid #fecdd3;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.layer-row .del:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.layer-row .publik {
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.layer-row .publik:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.layer-row .publik.active {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
}

.layer-row .publik:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.up-form input[type="text"],
.up-form input[type="file"] {
  width: 100%;
  box-sizing: border-box;
  margin: 5px 0;
  padding: 9px 10px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: var(--radius-sm, 8px);
  font-size: 13px;
  font-family: inherit;
}

.up-form button {
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  background: linear-gradient(120deg, var(--brand-dark, #095c2d), var(--brand, #0d7a3d));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
  font-weight: 700;
}

.up-form button:hover {
  filter: brightness(1.08);
}

.up-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: none;
}

.status-msg {
  font-size: 11.5px;
  margin-top: 6px;
  font-weight: 600;
}

.status-msg.ok {
  color: #166534;
}

.status-msg.err {
  color: #b91c1c;
}

.hint {
  font-size: 11px;
  color: var(--text-faint, #94a3b8);
  margin-top: 5px;
  line-height: 1.5;
}

@media (max-width: 780px) {
  .admin-strip {
    padding: 8px 12px;
  }

  .admin-strip .badge {
    font-size: 11px;
  }

  .admin-strip a {
    font-size: 11px;
    padding: 5px 9px;
  }
}

@media (max-width: 480px) {
  .login-box {
    padding: 24px 20px 22px;
  }

  .wrap {
    margin: 18px auto;
  }

  .card {
    padding: 16px 16px;
  }
}

/* =========================================================
   MENU SCROLL HALAMAN (js/admin-scroll.js)
   ========================================================= */

.scroll-menu {
  z-index: 520;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.scroll-menu[hidden] { display: none; }

.scroll-menu .sm-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border, #e6eaf0);
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.2);
  backdrop-filter: blur(8px);
}

.scroll-menu .sm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text, #0f172a);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.scroll-menu .sm-btn svg { width: 18px; height: 18px; pointer-events: none; }
.scroll-menu .sm-btn:hover:not(:disabled) { background: var(--surface-2, #f1f5f9); border: 0; }
.scroll-menu .sm-btn:active:not(:disabled) { transform: scale(0.92); }
.scroll-menu .sm-btn:disabled { opacity: 0.32; cursor: default; }
.scroll-menu .sm-btn.active { background: var(--brand, #0d7a3d); color: #fff; }
.scroll-menu .sm-btn.active:hover { background: var(--brand-dark, #095c2d); }
.scroll-menu .sm-btn:focus-visible { outline: 2px solid var(--brand, #0d7a3d); outline-offset: 1px; }

.scroll-menu .sm-list {
  width: 230px;
  max-width: calc(100vw - 28px);
  max-height: min(50vh, 340px);
  overflow-y: auto;
  margin-bottom: 8px;
  padding: 6px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e6eaf0);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
}

.scroll-menu .sm-list[hidden] { display: none; }

.scroll-menu .sm-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text, #0f172a);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  line-height: 1.35;
  cursor: pointer;
}

.scroll-menu .sm-item:hover { background: var(--surface-2, #f1f5f9); border: 0; }
.scroll-menu .sm-item.current { background: var(--brand-light, #e8f7ee); color: var(--brand-dark, #095c2d); }

/* ---- Halaman biasa: melayang di pojok kanan bawah ---- */
.scroll-menu.in-page {
  position: fixed;
  right: calc(14px + env(safe-area-inset-right, 0px));
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  align-items: flex-end;
}

/* ---- Dashboard: di tengah bawah sidebar ---- */
.app.sm-host { position: relative; }

.scroll-menu.in-sidebar {
  position: absolute;
  left: calc(var(--sidebar-w, 300px) / 2);
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 30;
}

.sidebar.sm-pad { padding-bottom: 72px; }

@media (max-width: 780px) {
  /* sidebar = laci geser; menu ikut laci dan hanya tampil saat laci terbuka */
  .scroll-menu.in-sidebar {
    position: fixed;
    left: calc(min(86vw, 340px) / 2);
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    z-index: 510;
  }
  .sidebar:not(.open) ~ .scroll-menu.in-sidebar { display: none; }
  .sidebar.sm-pad { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 420px) {
  .scroll-menu.in-sidebar { left: calc(90vw / 2); }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-menu .sm-btn { transition: none; }
}

/* Halaman admin non-peta: style.css mengunci html/body setinggi layar (untuk peta),
   sehingga halaman panjang tidak bisa di-scroll. Buka kuncinya untuk semua halaman ini. */
html.menu-page {
  height: auto;
  min-height: 100%;
  overflow-y: auto;
}

html.menu-page body.admin-simple {
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: visible;
}
