/* ==========================================================================
   HMCS Admin Panel — Shared Theme
   Palette: green, white, black — nothing else. Loaded after Bootstrap +
   site CSS to override.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,500;8..60,600;8..60,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Core palette — green, white, black. That's it. */
  --green-700: #0e5c2f;   /* deep institutional green — headers, brand */
  --green-600: #14803f;   /* primary action green */
  --green-500: #1c9a4c;   /* hover state */
  --green-50:  #eaf6ee;   /* faint tint for success/alert backgrounds only */

  --black: #14151a;
  --white: #ffffff;

  /* Grays are shades of black, used only for structure (borders/muted text) */
  --gray-900: #1c1d22;
  --gray-600: #55575f;
  --gray-300: #d8d9dd;
  --gray-100: #f0f0f2;

  --bg: var(--white);
  --surface: var(--white);
  --border: var(--gray-300);
  --border-strong: var(--gray-600);
  --text-900: var(--black);
  --text-600: var(--gray-600);

  /* Status reuses the same green for success; red kept minimal, only for errors */
  --danger: #a8221f;
  --danger-bg: #fbeceb;
  --success: var(--green-700);
  --success-bg: var(--green-50);

  --radius: 8px;
  --radius-sm: 5px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 1px rgba(0, 0, 0, 0.04);
  --shadow-raised: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);

  --font-display: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  background: var(--bg);
  font-family: var(--font-ui);
  color: var(--text-900);
}

/* ---- Top bar --------------------------------------------------------- */

.admin-topbar {
  background: var(--white);
  border-bottom: 3px solid var(--green-600);
  padding: 18px 32px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-brand-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.admin-brand-text .eyebrow {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green-700);
  display: block;
  line-height: 1.4;
}

.admin-brand-text .title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-900);
  line-height: 1.2;
}

.admin-user {
  color: var(--text-600);
  font-size: 14px;
}

.admin-user strong {
  color: var(--text-900);
  font-weight: 600;
}

/* ---- Buttons ----------------------------------------------------------- */

.btn-green {
  background: var(--green-600);
  border: 1px solid var(--green-600);
  color: #ffffff;
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 0.01em;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.btn-green:hover {
  background: var(--green-700);
  border-color: var(--green-700);
  color: #ffffff;
}

.btn-green:active {
  transform: translateY(1px);
}

.btn-outline-dark2 {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-600);
  font-weight: 500;
  font-size: 14px;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-outline-dark2:hover {
  background: var(--gray-100);
  border-color: var(--green-600);
  color: var(--green-700);
}

/* ---- Cards --------------------------------------------------------------- */

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

/* ---- Dashboard module grid ------------------------------------------------ */

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.module-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--text-900);
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.module-card:hover {
  border-left-color: var(--green-500);
  box-shadow: var(--shadow-raised);
  transform: translateY(-2px);
  color: var(--text-900);
}

.module-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--green-50);
  border: 1px solid #cdeed9;
  color: var(--green-700);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.module-card:hover .module-icon {
  background: var(--green-600);
  border-color: var(--green-600);
  color: #ffffff;
}

.module-icon svg {
  width: 22px;
  height: 22px;
}

.module-body .module-title {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 15.5px;
  color: var(--text-900);
  margin-bottom: 3px;
}

.module-body .module-desc {
  font-size: 13px;
  color: var(--text-600);
  line-height: 1.4;
}

/* ---- Login page ----------------------------------------------------------- */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(160deg, var(--black) 0%, var(--gray-900) 55%, var(--green-700) 160%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-raised);
  overflow: hidden;
}

.login-card-header {
  background: var(--black);
  padding: 32px 32px 24px;
  text-align: center;
  border-bottom: 3px solid var(--green-500);
}

.login-crest {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
}

.login-card-header .eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--green-500);
  margin-bottom: 4px;
}

.login-card-header h1 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
}

.login-card-body {
  padding: 32px;
}

.form-label-admin {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-600);
  letter-spacing: 0.01em;
  margin-bottom: 6px;
}

.form-control-admin {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14.5px;
  font-family: var(--font-ui);
  color: var(--text-900);
  background: #fbfcfd;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control-admin:focus {
  outline: none;
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(20, 128, 63, 0.15);
  background: #ffffff;
}

.alert-admin {
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13.5px;
  margin-bottom: 18px;
  border: 1px solid transparent;
}

.alert-admin-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #f0cfcc;
}

.alert-admin-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: #c9e5d5;
}

.login-footer {
  text-align: center;
  font-size: 12px;
  color: var(--gray-300);
  margin-top: 20px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gray-300);
  font-size: 13.5px;
  text-decoration: none;
}

.back-link:hover {
  color: #ffffff;
}

/* ---- Inner page header (used on every manage_* page) ---------------------- */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  color: var(--text-900);
  margin: 0;
}

.crumb-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-600);
  text-decoration: none;
  margin-bottom: 10px;
}

.crumb-back:hover {
  color: var(--black);
}

.crumb-back svg {
  width: 15px;
  height: 15px;
}

.count-pill {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--green-700);
  background: var(--green-50);
  border: 1px solid #cdeed9;
  border-radius: 999px;
  padding: 4px 12px;
}

/* ---- Upload / form panel ---------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 26px;
  margin-bottom: 32px;
}

.panel-title {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 15px;
  color: var(--text-900);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title svg {
  width: 17px;
  height: 17px;
  color: var(--green-600);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.section-heading {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-600);
  margin: 0 0 14px;
}

/* ---- Data table --------------------------------------------------------- */

.admin-table {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

.admin-table thead th {
  background: var(--gray-100);
  color: var(--text-600);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.admin-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-900);
  vertical-align: middle;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr:hover {
  background: var(--gray-100);
}

.row-title {
  font-weight: 600;
}

.row-sub {
  color: var(--text-600);
  font-size: 12.5px;
  margin-top: 2px;
}

/* ---- Action links / icon buttons --------------------------------------- */

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-600);
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.icon-action svg {
  width: 15px;
  height: 15px;
}

.icon-action:hover {
  border-color: var(--green-600);
  color: var(--green-700);
  background: var(--green-50);
}

.icon-action.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-bg);
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--green-700);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.file-chip:hover {
  border-bottom-color: var(--green-700);
}

.file-chip svg {
  width: 15px;
  height: 15px;
}

.deadline-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}

.deadline-open {
  background: var(--green-50);
  color: var(--green-700);
}

.deadline-closed {
  background: var(--gray-100);
  color: var(--text-600);
}

/* ---- Media grid (gallery / news thumbnails) ----------------------------- */

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}

.media-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.15s ease, transform 0.12s ease;
}

.media-card:hover {
  box-shadow: var(--shadow-raised);
  transform: translateY(-2px);
}

.media-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--gray-100);
  display: block;
}

.media-body {
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.media-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-900);
  line-height: 1.3;
}

.media-date {
  font-size: 11.5px;
  color: var(--text-600);
  margin-top: 3px;
}

/* ---- News card (with content excerpt) ----------------------------------- */

.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.news-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--gray-100);
}

.news-card-body {
  padding: 16px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.news-card-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-900);
  margin-bottom: 6px;
}

.news-card-excerpt {
  font-size: 13px;
  color: var(--text-600);
  line-height: 1.5;
  flex: 1;
}

.news-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

/* ---- Empty state --------------------------------------------------------- */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-600);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--gray-100);
}

.empty-state svg {
  width: 32px;
  height: 32px;
  color: var(--text-600);
  margin-bottom: 10px;
}

.empty-state p {
  margin: 0;
  font-size: 14px;
}
