/* ============================================================
   ZanGo Admin — self-contained theme
   Standalone admin frontend. No dependency on the public site.
   ============================================================ */

:root {
  --bg: #fff1df;
  --surface: #fff7ef;
  --surface-strong: #ffffff;
  --surface-dark: #a5431a;
  --ink: #351b12;
  --muted: #765142;
  --accent: #ff9f1c;
  --accent-deep: #e85d04;
  --line: rgba(53, 27, 18, 0.13);
  --shadow: 0 24px 70px rgba(120, 52, 16, 0.14);
}

[data-theme="dark"] {
  --bg: #110906;
  --surface: #1a100c;
  --surface-strong: #20130e;
  --surface-dark: #130c09;
  --ink: #fff7f0;
  --muted: #e3c8b9;
  --accent: #ffb15c;
  --accent-deep: #ff7a1a;
  --line: rgba(89, 55, 38, 0.78);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(255, 177, 92, 0.28), transparent 28rem),
    radial-gradient(circle at left top, rgba(232, 93, 4, 0.18), transparent 24rem),
    radial-gradient(circle at 20% 95%, rgba(0, 185, 212, 0.12), transparent 22rem),
    var(--bg);
  line-height: 1.55;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

button, input, select, textarea { font: inherit; }

button, a, input, select, textarea {
  -webkit-tap-highlight-color: rgba(232, 93, 4, 0.18);
}

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- Admin layout ---------- */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--surface-strong);
  border-right: 1px solid var(--line);
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar h3 { margin: 0 0 0.5rem; }

.sidebar a {
  color: var(--ink);
  text-decoration: none;
  padding: 0.5rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar a:hover, .sidebar a.active { background: var(--accent); color: var(--ink); }

.sidebar .role-badge {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  opacity: 0.8;
  text-transform: capitalize;
}

.main-content { flex: 1; padding: 2rem; }

/* ---------- Stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }

.stat-card {
  background: var(--surface-strong);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  text-align: center;
}

.stat-card h2 { margin: 0 0 0.3rem; color: var(--accent); font-size: 0.9rem; }
.stat-card p { font-size: 1.6rem; font-weight: 700; color: var(--ink); margin: 0; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { padding: 0.6rem; border-bottom: 1px solid var(--line); text-align: left; font-size: 0.9rem; }

/* ---------- Buttons ---------- */
.action-btn {
  background: var(--accent);
  border: none;
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  margin: 0.1rem;
  color: var(--ink);
}

.danger-btn { background: #e74c3c; color: white; }
.success-btn { background: #2ecc71; color: white; }

/* ---------- Forms ---------- */
input[type="text"], input[type="number"], input[type="date"], select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.3rem 0.6rem;
  color: var(--ink);
  margin: 0.2rem;
}

/* ---------- Misc ---------- */
.hidden { display: none !important; }
.log-entry { padding: 0.3rem 0; border-bottom: 1px solid var(--line); font-size: 0.85rem; }

#access-denied { text-align: center; margin-top: 5rem; display: none; }

.badge { padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.75rem; }
.badge.verified { background: #2ecc71; color: #fff; }
.badge.pending { background: #f1c40f; color: #000; }
.badge.rejected { background: #e74c3c; color: #fff; }
.badge.suspended { background: #e67e22; color: #fff; }
.badge.active { background: #2ecc71; color: #fff; }
.badge.inactive { background: #95a5a6; color: #fff; }

.filter-bar { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin: 0.5rem 0; }

.guide-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--surface-strong);
}

.guide-card h3 { margin: 0 0 0.3rem; }
.guide-card p { margin: 0.2rem 0; font-size: 0.9rem; opacity: 0.9; }

.toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: var(--accent);
  color: var(--ink);
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  display: none;
  z-index: 1000;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}

.modal {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 { margin: 0; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
  padding: 0 0.3rem;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
}

/* Guide detail rows */
.guide-detail { margin: 0.2rem 0; font-size: 0.9rem; }
.guide-detail strong { color: var(--accent); }

/* Document cards inside the modal */
.doc-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem;
  margin: 0.75rem 0;
  background: var(--surface);
}

.doc-card h4 { margin: 0 0 0.4rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.doc-preview {
  margin: 0.6rem 0;
  text-align: center;
  background: var(--bg);
  border-radius: 8px;
  padding: 0.5rem;
}

.doc-preview img {
  max-height: 260px;
  border-radius: 6px;
  cursor: zoom-in;
}

.doc-preview a {
  display: inline-block;
  color: var(--accent-deep);
  font-weight: 600;
  text-decoration: underline;
}

.doc-meta { font-size: 0.8rem; opacity: 0.85; margin: 0.3rem 0; }

.doc-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-top: 0.6rem; }

.doc-actions input[type="date"], .doc-actions input[type="text"] {
  flex: 1;
  min-width: 140px;
}

.doc-reason { width: 100%; margin-top: 0.4rem; }

/* Full-size image viewer */
.viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 1rem;
  cursor: zoom-out;
}

.viewer-overlay img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
}

.viewer-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}

.viewer-close:hover {
  background: rgba(255, 255, 255, 0.3);
}


/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1rem;
}

.page-btn {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.85rem;
}

.page-btn:hover:not(:disabled):not(.active) {
  border-color: var(--accent);
}

.page-btn.active {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #fff;
}

.page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.page-size {
  margin-left: auto;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 0.85rem;
}

/* ---------- Grouping ---------- */
.group-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  overflow: hidden;
  background: var(--surface);
}

.group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: none;
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font-size: 0.9rem;
}

.group-header:hover {
  background: var(--surface);
}

.group-title {
  font-weight: 600;
  text-transform: capitalize;
}

.group-count {
  margin-left: auto;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
}

.group-toggle {
  color: var(--muted);
  font-size: 0.8rem;
}

.group-body {
  padding: 0.6rem 0.9rem;
  border-top: 1px solid var(--line);
}

.group-body.collapsed {
  display: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {

  .admin-layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 1rem;
  }
  .sidebar h3, .sidebar .role-badge { width: 100%; }
  .main-content { padding: 1rem; }
}
