/* =====================================================================
   Legal Aid Forum - website admin
   One stylesheet for every admin page (replaces the per-page CSS).
   Colours come from the LAF seal: ink navy, justice green, seal gold.
   ===================================================================== */

:root {
  --ink: #14284B;          /* navy: sidebar, titles */
  --ink-2: #1D3763;
  --ink-soft: #E8EDF5;
  --green: #1F7A4D;        /* primary actions */
  --green-dark: #17603C;
  --green-soft: #E6F2EB;
  --gold: #C9A227;         /* active marker, drafts */
  --gold-soft: #FBF3D9;
  --gold-text: #6E5200;
  --red: #B42318;
  --red-soft: #FDECEA;
  --blue-soft: #E7F0FA;
  --blue-text: #1C4F86;
  --paper: #F5F6F2;        /* page background */
  --surface: #FFFFFF;
  --line: #DDE2DA;
  --line-soft: #ECEFEA;
  --text: #1E2633;
  --muted: #5B6676;
  --faint: #8A94A3;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;

  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 248px;
  --header-h: 56px;

  /* names used in inline styles inside the existing pages */
  --primary: var(--green);
  --primary-dark: var(--green-dark);
  --primary-light: #4F9A73;
  --primary-soft: var(--green-soft);
  --success: var(--green);
  --danger: var(--red);
  --warning: var(--gold);
  --info: var(--blue-text);
  --gray-50: #F8F9F6;
  --gray-100: #F1F3EF;
  --gray-200: var(--line);
  --gray-300: #C5CCC2;
  --gray-400: #A2AAB4;
  --gray-500: var(--faint);
  --gray-600: var(--muted);
  --gray-700: #3B4554;
  --gray-800: var(--text);
  --gray-900: var(--ink);

  /* Bootstrap */
  --bs-body-font-family: var(--font-sans);
  --bs-body-color: var(--text);
  --bs-body-bg: var(--paper);
  --bs-primary: var(--ink);
  --bs-primary-rgb: 20, 40, 75;
  --bs-success-rgb: 31, 122, 77;
  --bs-warning-rgb: 201, 162, 39;
  --bs-danger-rgb: 180, 35, 24;
  --bs-link-color: var(--green);
  --bs-link-hover-color: var(--green-dark);
  --bs-border-color: var(--line);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--paper);
}
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); }
h1, h2, h3, h4, h5, h6 { color: var(--ink); font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--line); opacity: 1; margin: 24px 0; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.text-muted { color: var(--muted) !important; }
.text-primary { color: var(--ink) !important; }
.text-success { color: var(--green) !important; }
.text-warning { color: var(--gold-text) !important; }
.text-danger { color: var(--red) !important; }
.bg-primary { background-color: var(--ink) !important; }
.bg-success { background-color: var(--green) !important; }
.badge.bg-primary { background: var(--ink-soft) !important; color: var(--ink); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- header (top bar) ---------- */
#header.header {
  position: fixed; top: 0; right: 0; left: var(--sidebar-w);
  height: var(--header-h);
  z-index: 996;
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  background: rgba(245, 246, 242, .92);
  backdrop-filter: saturate(1.4) blur(6px);
  border-bottom: 1px solid var(--line);
}
.header .toggle-sidebar-btn {
  display: none;
  border: 0; background: none; padding: 6px; margin-left: -6px;
  font-size: 26px; line-height: 1; color: var(--ink); cursor: pointer;
}
.header .header-title { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header .header-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.header .header-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--muted);
}
.header .header-link:hover { background: #E9ECE6; color: var(--ink); }
.header .nav-profile {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 4px; border-radius: 999px;
  border: 1px solid transparent; background: none; color: var(--ink); font-size: 14px; font-weight: 600;
}
.header .nav-profile:hover, .header .nav-profile[aria-expanded="true"] { border-color: var(--line); background: var(--surface); }
.header .nav-profile img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--ink-soft); }
.header .dropdown-menu { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(20, 40, 75, .10); padding: 6px; min-width: 220px; }
.header .dropdown-header { padding: 8px 10px 10px; }
.header .dropdown-header strong { display: block; color: var(--ink); font-size: 14px; }
.header .dropdown-header span { color: var(--muted); font-size: 13px; }
.header .dropdown-item { border-radius: var(--radius-sm); padding: 8px 10px; font-size: 14px; display: flex; align-items: center; gap: 10px; color: var(--text); }
.header .dropdown-item:hover { background: var(--paper); color: var(--ink); }
.header .dropdown-item i { color: var(--muted); }

/* ---------- sidebar ---------- */
#sidebar.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0;
  width: var(--sidebar-w);
  z-index: 997;
  display: flex; flex-direction: column;
  background: var(--ink);
  color: #C9D3E3;
  overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: #2C4675 transparent;
}
.sb-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sb-brand img { width: 44px; height: 44px; border-radius: 50%; background: #fff; padding: 2px; flex: none; }
.sb-brand span { font-family: var(--font-serif); font-size: 18px; line-height: 1.15; color: #fff; font-weight: 600; }
.sb-brand small { display: block; margin-top: 2px; font-family: var(--font-sans); font-size: 12px; font-weight: 400; color: #9FB0CB; }
.sb-nav { list-style: none; margin: 0; padding: 10px 10px 16px; }
.sb-group { padding: 18px 10px 6px; font-size: 12px; font-weight: 600; color: #8597B6; letter-spacing: .02em; }
.sb-link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; margin: 1px 0;
  border-radius: var(--radius-sm);
  font-size: 14.5px; color: #D5DDEA;
}
.sb-link i { font-size: 17px; color: #8FA2C2; width: 18px; text-align: center; }
.sb-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sb-link:hover i { color: #C9D3E3; }
.sb-link.active { background: var(--ink-2); color: #fff; font-weight: 600; }
.sb-link.active i { color: var(--gold); }
.sb-link.active::before {
  content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--gold);
}
.sb-foot { margin-top: auto; padding: 14px 20px 18px; font-size: 12px; color: #7F91B0; border-top: 1px solid rgba(255, 255, 255, .08); }
.sb-foot a { color: #C9D3E3; }
.sb-backdrop { display: none; }

/* ---------- main area ---------- */
#main.main {
  margin-left: var(--sidebar-w);
  padding: calc(var(--header-h) + 28px) 32px 32px;
  min-height: 100vh;
}
#main.main > * { max-width: none; }
#footer.footer {
  margin-left: var(--sidebar-w);
  padding: 18px 32px 28px;
  font-size: 13px; color: var(--faint);
  border-top: 0;
}
.back-to-top { display: none !important; }

@media (max-width: 1199px) {
  #header.header { left: 0; }
  .header .toggle-sidebar-btn { display: inline-block; }
  #sidebar.sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
  body.toggle-sidebar #sidebar.sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  body.toggle-sidebar .sb-backdrop { display: block; position: fixed; inset: 0; z-index: 996; background: rgba(20, 40, 75, .35); }
  #main.main, #footer.footer { margin-left: 0; }
}
@media (max-width: 640px) {
  #main.main { padding: calc(var(--header-h) + 20px) 16px 24px; }
  #footer.footer { padding: 16px; }
  #header.header { padding: 0 16px; }
  .header .header-link span, .header .nav-profile span { display: none; }
}

/* ---------- page titles ---------- */
.pagetitle-modern, .pagetitle, .page-header { margin-bottom: 22px; }
.pagetitle-modern h1, .pagetitle h1, .page-header h1, .page-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 30px; line-height: 1.2; font-weight: 600;
  color: var(--ink);
  display: flex; align-items: center; gap: 10px;
}
.pagetitle-modern h1 > i, .pagetitle h1 > i, .page-header h1 > i, .page-title > i, .page-icon { display: none; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-header-left { display: flex; align-items: center; gap: 12px; }
.page-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.breadcrumb, .breadcrumb-modern {
  display: flex; flex-wrap: wrap; list-style: none;
  margin: 6px 0 0; padding: 0; background: none;
  font-size: 13px;
}
.breadcrumb-item, .breadcrumb-modern li { color: var(--faint); }
.breadcrumb-item a { color: var(--muted); }
.breadcrumb-item a:hover { color: var(--green); }
.breadcrumb-item + .breadcrumb-item::before { content: "/"; padding: 0 8px; color: var(--gray-300); }
.breadcrumb-item.active { color: var(--muted); }
.sep { color: var(--gray-300); padding: 0 6px; }
.section-title { font-size: 16px; font-weight: 600; color: var(--ink); margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.section-title > i { color: var(--faint); margin-right: 6px; }

/* ---------- panels (cards) ---------- */
.card, .card-modern, .form-card-modern, .form-card, .table-card, .image-card, .image-card-modern,
.profile-card-modern, .image-preview-card, .filter-section, .profile-sidebar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(20, 40, 75, .04);
  overflow: hidden;
  margin-bottom: 24px;
}
.card { --bs-card-border-color: var(--line); }
.card-header-modern, .form-card-header, .table-card .card-header, .card > .card-header, .image-card-modern .card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
}
.card-header-modern h5, .form-card-header h5, .table-card .card-header h5, .card > .card-header h5, .form-card-header h3, .card-header-modern h3 {
  margin: 0; font-size: 16px; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.card-header-modern h5 > i, .form-card-header h5 > i, .table-card .card-header h5 > i, .card > .card-header h5 > i { color: var(--faint); font-size: 16px; }
.form-card-body { padding: 24px; }
.card-body { padding: 22px; }
.card-modern .card-body.p-0, .table-card .card-body.p-0 { padding: 0; }
.form-section { margin-bottom: 24px; }
.field-group { margin-bottom: 18px; }

/* ---------- buttons ---------- */
.btn-publish, .btn-primary-modern, .btn-submit-modern, .btn-update, .btn-update-modern, .btn-modern,
.btn-upload, .btn-add, .btn-add-modern, .btn-change-image, .btn-change-media,
.btn-draft, .btn-cancel-modern, .btn-ghost-modern, .btn-back, .btn-view-pdf, .quick-action-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: 600 14px/1.2 var(--font-sans);
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn-publish, .btn-primary-modern, .btn-submit-modern, .btn-update, .btn-update-modern, .btn-modern,
.btn-upload, .btn-add, .btn-add-modern, .btn-change-image, .btn-change-media {
  background: var(--green); color: #fff; border-color: var(--green);
}
.btn-publish:hover, .btn-primary-modern:hover, .btn-submit-modern:hover, .btn-update:hover, .btn-update-modern:hover, .btn-modern:hover,
.btn-upload:hover, .btn-add:hover, .btn-add-modern:hover, .btn-change-image:hover, .btn-change-media:hover {
  background: var(--green-dark); border-color: var(--green-dark); color: #fff;
}
.btn-draft { background: var(--surface); color: var(--ink); border-color: var(--gray-300); }
.btn-draft:hover { border-color: var(--gold); background: var(--gold-soft); color: var(--gold-text); }
.btn-cancel-modern, .btn-ghost-modern, .btn-back { background: transparent; color: var(--muted); border-color: transparent; }
.btn-cancel-modern:hover, .btn-ghost-modern:hover, .btn-back:hover { background: #E9ECE6; color: var(--ink); }
.btn-view-pdf, .quick-action-btn { background: var(--surface); color: var(--ink); border-color: var(--line); min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn-view-pdf:hover, .quick-action-btn:hover { border-color: var(--green); color: var(--green); }
.is-submitting { opacity: .65; pointer-events: none; }

.btn { border-radius: var(--radius-sm); font-weight: 600; font-size: 14px; }
.btn-primary { --bs-btn-bg: var(--green); --bs-btn-border-color: var(--green); --bs-btn-hover-bg: var(--green-dark); --bs-btn-hover-border-color: var(--green-dark); --bs-btn-active-bg: var(--green-dark); --bs-btn-active-border-color: var(--green-dark); --bs-btn-disabled-bg: var(--green); --bs-btn-disabled-border-color: var(--green); }
.btn-outline-primary { --bs-btn-color: var(--ink); --bs-btn-border-color: var(--line); --bs-btn-hover-bg: var(--ink); --bs-btn-hover-border-color: var(--ink); }
.btn-success { --bs-btn-bg: var(--green); --bs-btn-border-color: var(--green); --bs-btn-hover-bg: var(--green-dark); --bs-btn-hover-border-color: var(--green-dark); }

/* actions inside table rows */
.action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap;
}
.action-btn:hover { border-color: var(--green); color: var(--green); }
.action-btn.danger { color: var(--red); }
.action-btn.danger:hover { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.action-buttons { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* bottom row of a form */
.action-bar {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 20px; border-top: 1px solid var(--line-soft);
}
.action-bar-info { margin-right: auto; color: var(--muted); font-size: 13px; }
form .text-center.d-flex.justify-content-center { justify-content: flex-end !important; }

/* ---------- forms ---------- */
.form-label, .form-label-modern, label.label {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 6px;
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.form-label-modern > i.bi, .form-label > i.bi { display: none; }
.required, .req { color: var(--red); font-weight: 600; }
.form-control, .form-control-modern, .form-select {
  display: block; width: 100%;
  min-height: 42px; padding: 9px 12px;
  font: 15px/1.4 var(--font-sans); color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea.form-control, textarea.form-control-modern { min-height: 96px; resize: vertical; }
.form-control::placeholder, .form-control-modern::placeholder { color: var(--faint); }
.form-control:focus, .form-control-modern:focus, .form-select:focus {
  border-color: var(--green); outline: 0;
  box-shadow: 0 0 0 3px rgba(31, 122, 77, .15);
}
select.form-control, select.form-control-modern {
  appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%235B6676' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 14px 10px;
}
.field-hint, .file-hint, .form-text, .file-info, .size-warning { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); }
.size-warning { display: none; color: var(--red); font-weight: 600; }
.char-counter { display: block; margin-top: 4px; text-align: right; font-size: 12px; color: var(--faint); }

/* validation messages only appear after a save attempt */
.invalid-feedback { display: none; margin-top: 6px; font-size: 13px; color: var(--red); }
.was-validated .form-control:invalid, .was-validated .form-control-modern:invalid, .was-validated .form-select:invalid {
  border-color: var(--red); background-image: none;
}
.was-validated .form-control:invalid ~ .invalid-feedback,
.was-validated .form-control-modern:invalid ~ .invalid-feedback,
.was-validated .form-select:invalid ~ .invalid-feedback { display: block; }
.was-validated .form-control:valid, .was-validated .form-control-modern:valid { border-color: var(--gray-300); background-image: none; }
/* hidden file inputs: show the error on the upload box itself */
.was-validated .upload-area-modern:has(input[type=file]:invalid),
.was-validated .upload-area:has(input[type=file]:invalid),
.was-validated .pdf-upload-area:has(input[type=file]:invalid) { border-color: var(--red); background: var(--red-soft); }
.was-validated .upload-area-modern:has(input[type=file]:invalid) ~ .invalid-feedback,
.was-validated .upload-area:has(input[type=file]:invalid) ~ .invalid-feedback,
.was-validated .pdf-upload-area:has(input[type=file]:invalid) ~ .invalid-feedback,
.was-validated .upload-area-modern:has(input[type=file]:invalid) .invalid-feedback,
.was-validated .pdf-upload-area:has(input[type=file]:invalid) .invalid-feedback { display: block; }
.form-check-input:checked { background-color: var(--green); border-color: var(--green); }

/* ---------- upload boxes ---------- */
.upload-area-modern, .upload-area, .pdf-upload-area, .file-input-label, .image-preview-area {
  position: relative;
  display: block;
  padding: 26px 20px;
  text-align: center;
  background: #FAFBF8;
  border: 1.5px dashed var(--gray-300);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.upload-area-modern:hover, .upload-area:hover, .pdf-upload-area:hover, .file-input-label:hover,
.upload-area-modern.dragover, .upload-area.dragover { border-color: var(--green); background: var(--green-soft); }
.upload-area-modern p, .upload-area p, .pdf-upload-area p { margin: 0; }
.upload-area-modern .fw-medium, .upload-area .fw-medium { color: var(--ink); font-weight: 600; }
.upload-icon-circle, .upload-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; margin-bottom: 10px;
  border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 22px;
}
.file-input-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.image-preview, .file-preview { display: none; margin-top: 14px; }
.image-preview img, .file-preview img { max-height: 220px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.selected-file-info, .file-name, .selected-filename {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px;
  font-size: 13px; color: var(--green); font-weight: 600; word-break: break-all;
}

/* current image / PDF on edit pages */
.current-image-section, .image-preview-section { margin-bottom: 18px; }
.current-image-wrapper, .image-wrapper, .image-preview-box, .media-preview-box {
  position: relative; display: inline-block;
  padding: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.current-image-wrapper img, .image-wrapper img, .image-preview-box img, .media-preview-box img {
  display: block; max-width: 100%; max-height: 260px; border-radius: var(--radius-sm); object-fit: cover;
}
.image-badge {
  position: absolute; top: 12px; left: 12px;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(20, 40, 75, .85); color: #fff; font-size: 12px;
}
.image-path-info, .image-preview-info { margin-top: 8px; font-size: 13px; color: var(--muted); word-break: break-all; }
.current-pdf-box, .pdf-preview {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #FAFBF8;
}
.current-pdf-box > i, .pdf-preview > i { font-size: 26px; color: var(--red); }
.pdf-info { flex: 1; min-width: 160px; }
.pdf-name { font-weight: 600; color: var(--ink); word-break: break-all; }
.pdf-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.remove-pdf-check { font-size: 13px; color: var(--red); }
.member-info-box {
  padding: 12px 14px; margin-bottom: 18px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #FAFBF8;
}
.user-name-badge, .staff-name-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--ink-soft); color: var(--ink); font-size: 13px; font-weight: 600;
}
.info-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.info-row:last-child { border-bottom: 0; }
.info-label { color: var(--muted); }
.info-value { color: var(--text); font-weight: 600; text-align: right; word-break: break-word; }
.meta-info { font-size: 13px; color: var(--muted); }

/* ---------- alerts ---------- */
.alert-modern {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; margin-bottom: 20px;
  border-radius: var(--radius-sm);
  border: 1px solid; border-left-width: 4px;
  font-size: 14px;
}
.alert-modern.alert-success { background: var(--green-soft); border-color: #B9DBC8; border-left-color: var(--green); color: #134A30; }
.alert-modern.alert-danger { background: var(--red-soft); border-color: #F3C3BE; border-left-color: var(--red); color: #7A1810; }
.alert-modern .alert-icon, .alert-modern > i { font-size: 18px; line-height: 1.2; }
.alert-modern strong { font-weight: 600; }
.alert { border-radius: var(--radius-sm); }

/* ---------- tables ---------- */
.table-responsive { overflow-x: auto; }
.table-modern, .table-card table, .card-modern table { width: 100%; border-collapse: collapse; margin: 0; font-size: 14px; }
.table-modern thead th, .table-card table thead th {
  padding: 11px 16px;
  background: #F8F9F6;
  border-bottom: 1px solid var(--line);
  text-align: left; white-space: nowrap;
  font-size: 13px; font-weight: 600; color: var(--muted);
  text-transform: none; letter-spacing: 0;
}
.table-modern tbody td, .table-card table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle; color: var(--text);
}
.table-modern tbody tr:last-child td { border-bottom: 0; }
.table-modern tbody tr:hover td { background: #FAFBF8; }
.title-cell, .name-cell { font-weight: 600; color: var(--ink); max-width: 320px; }
.summary-cell { color: var(--muted); max-width: 320px; }
.table-modern td.fw-semibold:first-child { color: var(--faint); font-weight: 500 !important; width: 48px; }
.table { --bs-table-hover-bg: #FAFBF8; }

/* simple-datatables */
.dataTable-wrapper .dataTable-top, .dataTable-wrapper .dataTable-bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px;
}
.dataTable-wrapper .dataTable-bottom { border-top: 1px solid var(--line-soft); font-size: 13px; color: var(--muted); }
.dataTable-wrapper .dataTable-top::after, .dataTable-wrapper .dataTable-bottom::after { display: none; }
.dataTable-top > div, .dataTable-bottom > div, .dataTable-top > nav, .dataTable-bottom > nav { float: none !important; margin: 0 !important; }
.dataTable-selector { min-height: 34px; padding: 4px 8px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); background: var(--surface); margin-right: 6px; }
.dataTable-dropdown label { font-size: 13px; color: var(--muted); }
.dataTable-wrapper .dataTable-input, .dataTable-input {
  min-height: 36px; width: 260px; max-width: 100%;
  padding: 6px 12px 6px 34px;
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  background: var(--surface) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%238A94A3'%3e%3cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.415l-3.868-3.833zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3e%3c/svg%3e") no-repeat 11px center / 14px;
  font-size: 14px;
}
.dataTable-input:focus { outline: 0; border-color: var(--green); box-shadow: 0 0 0 3px rgba(31, 122, 77, .15); }
.dataTable-container { border-bottom: 0 !important; }
.dataTable-table > thead > tr > th { vertical-align: middle; border-bottom: 1px solid var(--line) !important; }
.dataTable-sorter::before, .dataTable-sorter::after { opacity: .35; }
.dataTable-pagination ul { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.dataTable-pagination li { float: none; }
.dataTable-pagination a {
  display: block; min-width: 32px; padding: 5px 9px; margin: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  text-align: center; color: var(--ink); font-size: 13px;
}
.dataTable-pagination a:hover { background: var(--paper); border-color: var(--gray-300); }
.dataTable-pagination .active a, .dataTable-pagination .active a:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.dataTable-pagination .disabled a { opacity: .45; }
.dataTable-empty { padding: 32px !important; text-align: center; color: var(--muted); }

/* ---------- badges ---------- */
.badge-status, .badge-category, .status-badge, .badge-type, .category-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; line-height: 1.4; white-space: nowrap;
  background: var(--gray-100); color: var(--muted);
}
.badge-status > i, .badge-category > i, .status-badge > i, .badge-type > i, .category-badge > i { font-size: 11px; }
.badge-published, .badge-active, .status-active, .status-badge.published, .status-badge.active, .badge-status.active { background: var(--green-soft); color: #145234; }
.badge-draft, .status-badge.draft, .badge-status.draft { background: var(--gold-soft); color: var(--gold-text); }
.badge-inactive, .status-inactive, .badge-closed, .status-badge.inactive, .status-badge.closed { background: var(--red-soft); color: #8A1C13; }
.badge-news { background: var(--ink-soft); color: var(--ink); }
.badge-story { background: var(--blue-soft); color: var(--blue-text); }
.badge-neutral { background: var(--gray-100); color: var(--muted); }
.badge-type { background: var(--blue-soft); color: var(--blue-text); }

/* ---------- empty states ---------- */
.empty-state, .empty-state-table { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty-state > i, .empty-state-icon, .empty-state-table > i { display: block; margin-bottom: 10px; font-size: 34px !important; color: var(--gray-300) !important; }
.empty-state h6, .empty-state h5 { color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.empty-state p { margin: 0 0 14px; }

/* ---------- dashboard ---------- */
.stat-card {
  display: block; height: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color .15s ease;
}
a.stat-card:hover { border-color: var(--green); color: var(--text); }
.stat-card .card-body { padding: 18px 18px 14px; }
.stat-number, .stat-value {
  font-family: var(--font-serif);
  font-size: 32px; line-height: 1.05; font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums lining-nums;
}
.stat-label, .stat-label-sm { margin-top: 4px; font-size: 13.5px; color: var(--muted); text-transform: none !important; letter-spacing: 0 !important; font-weight: 500; }
.stat-icon, .stat-icon-sm {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 8px;
  font-size: 18px;
  background: var(--ink-soft); color: var(--ink);
  box-shadow: none;
}
.stat-icon-sm { width: 30px; height: 30px; font-size: 14px; border-radius: 7px; }
.stat-icon.primary, .stat-icon-sm.primary, .stat-icon.purple, .stat-icon-sm.purple { background: var(--ink-soft); color: var(--ink); }
.stat-icon.success, .stat-icon-sm.success { background: var(--green-soft); color: var(--green); }
.stat-icon.info, .stat-icon-sm.info { background: var(--blue-soft); color: var(--blue-text); }
.stat-icon.warning, .stat-icon-sm.warning { background: var(--gold-soft); color: var(--gold-text); }
.stat-icon.danger, .stat-icon-sm.danger { background: var(--red-soft); color: var(--red); }
.stat-footer {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px; color: var(--muted);
}
.click-hint { color: var(--muted); }
a.stat-card:hover .click-hint { color: var(--green); }
.stat-card-mini, .visitor-stat-item {
  display: flex; align-items: center; gap: 10px;
  height: 100%; padding: 12px;
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: #FAFBF8;
}
.visitor-stat-item .stat-value, .stat-card-mini .stat-value { font-size: 20px; }
.popular-post-item, .news-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line-soft);
}
.popular-post-item:last-child, .news-item:last-child { border-bottom: 0; }
.post-info { flex: 1; min-width: 0; }
.post-title { font-weight: 600; color: var(--ink); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-views { font-size: 13px; color: var(--muted); white-space: nowrap; }
.device-icon { color: var(--muted); }
.status-indicator { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.status-indicator .dot, .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gray-300); }
.status-indicator.online .dot, .dot.online { background: var(--green); }
.custom-date-range { display: none; }
.filter-section { padding: 18px 20px; }
.filter-section .form-label { font-size: 13px; }
.dashboard .table-card .card-body .border-bottom { border-color: var(--line-soft) !important; }
.dashboard .table-card .badge.rounded-pill { background: var(--ink-soft) !important; color: var(--ink); font-variant-numeric: tabular-nums; }
.apexcharts-tooltip { box-shadow: 0 6px 18px rgba(20, 40, 75, .12) !important; }

/* ---------- profile ---------- */
.profile-card-modern { text-align: center; padding: 28px 22px; }
.profile-avatar {
  width: 96px; height: 96px; border-radius: 50%;
  object-fit: cover; margin: 0 auto 12px; display: block;
  border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line);
}
.profile-name { font-family: var(--font-serif); font-size: 22px; color: var(--ink); margin: 0; }
.profile-email, .profile-phone { color: var(--muted); font-size: 14px; }

/* ---------- editor ---------- */
.tox.tox-tinymce { border: 1px solid var(--gray-300) !important; border-radius: var(--radius-sm) !important; }
.tox .tox-promotion, .tox .tox-statusbar__branding { display: none !important; }

/* ---------- login & standalone pages ---------- */
.auth-body { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 44%) 1fr; background: var(--paper); }
.auth-side {
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 40px 48px; background: var(--ink); color: #C9D3E3;
}
.auth-side .seal { width: 84px; height: 84px; border-radius: 50%; background: #fff; padding: 3px; }
.auth-side h1 { margin: 28px 0 10px; font-family: var(--font-serif); font-size: 38px; line-height: 1.12; color: #fff; font-weight: 600; max-width: 15ch; }
.auth-side p { max-width: 38ch; color: #A9B8D0; font-size: 15px; margin: 0; }
.auth-side .auth-foot { font-size: 13px; color: #7F91B0; }
.auth-side .rule { width: 48px; height: 3px; background: var(--gold); border-radius: 3px; margin-top: 22px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-family: var(--font-serif); font-size: 28px; margin: 0 0 6px; }
.auth-card .auth-sub { color: var(--muted); margin: 0 0 26px; }
.auth-card .form-control { min-height: 46px; }
.auth-card .btn-publish { width: 100%; min-height: 46px; font-size: 15px; }
.auth-card .auth-help { margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth-alert { padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 14px; border: 1px solid; }
.auth-alert.error { background: var(--red-soft); border-color: #F3C3BE; color: #7A1810; }
.auth-alert.info { background: var(--blue-soft); border-color: #C5D9EF; color: var(--blue-text); }
@media (max-width: 860px) {
  .auth-body { grid-template-columns: 1fr; }
  .auth-side { padding: 24px; flex-direction: row; align-items: center; gap: 14px; justify-content: flex-start; }
  .auth-side .seal { width: 52px; height: 52px; }
  .auth-side h1 { margin: 0; font-size: 22px; max-width: none; }
  .auth-side p, .auth-side .auth-foot, .auth-side .rule { display: none; }
}

/* ---------- dashboard details ---------- */
.click-hint { display: none; }
.news-item img { flex: none; width: 56px; height: 56px; border-radius: var(--radius-sm); object-fit: cover; border: 1px solid var(--line); background: var(--gray-100); }
.news-item h4 { margin: 0 0 2px; font-size: 14px; font-weight: 600; line-height: 1.35; }
.news-item h4 a { color: var(--ink); }
.news-item h4 a:hover { color: var(--green); }
.news-item p { margin: 0; font-size: 12.5px; color: var(--muted); }
.dashboard .bg-light.rounded-3 { background: #FAFBF8 !important; border: 1px solid var(--line-soft); border-radius: var(--radius-sm) !important; }
.dashboard a.bg-light.rounded-3:hover { border-color: var(--green); }
.dashboard a.bg-light.rounded-3 .small { font-weight: 600; color: var(--ink); }
.dashboard a.bg-light.rounded-3 i { color: var(--green) !important; }
.stat-card .d-flex > div:first-child { min-width: 0; }

.form-title { margin: 0 0 18px; font-size: 18px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.form-title > i { display: none; }

/* wide tables scroll sideways on small screens instead of squeezing */
.dataTable-wrapper .dataTable-container { overflow-x: auto; }
@media (max-width: 900px) {
  .table-modern, .table-card table.datatable { min-width: 760px; }
  .card-header-modern, .form-card-header { padding: 14px 16px; }
  .card-body, .form-card-body { padding: 16px; }
  .pagetitle-modern h1, .pagetitle h1, .page-header h1, .page-title { font-size: 26px; }
}

/* ---------- pop-up forms (admin users) ---------- */
.form-group { margin-bottom: 14px; }
.modal-content { border: 1px solid var(--line); border-radius: var(--radius); }
.modal-header { border-bottom: 1px solid var(--line-soft); padding: 16px 20px; }
.modal-title { font-size: 17px; font-weight: 600; color: var(--ink); }
.modal-body { padding: 20px; }
.modal-body .card-body { padding: 0; }
