/* ==========================================================================
   MINEFOP dashboard - internal staff tool.

   Reuses the public site's design tokens (colours, fonts, spacing) from
   custom.css so the two feel like one product, but with its own compact
   chrome: a slim top bar instead of the public masthead/navbar/footer.
   ========================================================================== */

body.dashboard-body {
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  min-height: 100vh;
}

/* --------------------------------------------------------------------------
   Shell: a static sidebar column + content column at lg and up: below
   that, the sidebar becomes a Bootstrap offcanvas drawer (same markup,
   see adminpanel/base.html) opened from the slim top bar's toggle. One
   nav, two presentations - nothing to keep in sync between a "desktop"
   and "mobile" menu.
   -------------------------------------------------------------------------- */

.dashboard-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.dashboard-sidebar {
  --bs-offcanvas-width: 270px;
  /* !important: Bootstrap's own .offcanvas-lg responsive reset (applied at
     the lg breakpoint and up, to turn the offcanvas into a normal static
     column) forces background-color:transparent!important - without
     matching that here, the sidebar silently loses its background on
     desktop and the white nav text becomes unreadable against whatever
     is behind it. */
  background: var(--green-800) !important;
  color: #fff;
  border: 0;
}

@media (min-width: 992px) {
  .dashboard-sidebar {
    width: 270px;
    flex: 0 0 270px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }
}

.dashboard-sidebar .offcanvas-header {
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.dashboard-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  padding: 1.1rem 1.25rem;
}

.dashboard-side-nav {
  display: flex;
  flex-direction: column;
  padding: .25rem .75rem 1rem;
}

.dashboard-side-group-label {
  display: block;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #9fc2ac;
  padding: 1rem .5rem .35rem;
}

.dashboard-side-nav a {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #d9ebe1;
  text-decoration: none;
  padding: .5rem .5rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
}

.dashboard-side-nav a i {
  font-size: 1rem;
  width: 1.1rem;
  text-align: center;
  flex-shrink: 0;
}

.dashboard-side-nav a:hover,
.dashboard-side-nav a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.dashboard-side-nav a.active {
  box-shadow: inset 3px 0 0 var(--cm-yellow);
}

.dashboard-side-external {
  display: block;
  margin: 0 .75rem 1rem;
  padding: .6rem .75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #cfe2d7;
  text-decoration: none;
  font-size: .8rem;
  font-weight: 600;
  padding-top: 1rem;
}

.dashboard-content-col {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.dashboard-topbar {
  background: #fff;
  border-bottom: 1px solid var(--rule);
  padding: .65rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.dashboard-topbar .dashboard-brand {
  color: var(--ink);
  padding: 0;
}

/* .lang-switch (custom.css) is styled for a dark background everywhere
   else it appears (public navbar, formerly this topbar too) - this
   topbar is white now, so it needs its own light-background colours. */
.dashboard-topbar .lang-switch { border-color: var(--rule); }
.dashboard-topbar .lang-switch button { color: var(--muted); }
.dashboard-topbar .lang-switch button:hover { background: var(--green-050); color: var(--green-900); }
.dashboard-topbar .lang-switch button[aria-current="true"] { background: var(--cm-yellow); color: var(--green-900); }

.dashboard-sidebar-toggle {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius);
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dashboard-logout-btn {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: .35rem .75rem;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
}

.dashboard-logout-btn:hover {
  background: var(--green-050);
  border-color: var(--green-600);
}

.dashboard-main {
  padding: 1.75rem 1rem 3rem;
}

.dashboard-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--green-900), var(--green-700));
  padding: 1rem;
}

.dashboard-login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  height: 100%;
}

.stat-card .stat-value {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--green-700);
  line-height: 1;
}

.quick-action-card {
  display: flex;
  align-items: center;
  gap: .9rem;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  text-decoration: none;
  color: var(--ink);
  height: 100%;
  transition: box-shadow .15s ease, border-color .15s ease;
}

.quick-action-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--green-600);
  color: var(--ink);
}

.quick-action-card .icon {
  width: 44px;
  height: 44px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--green-050);
  color: var(--green-700);
  font-size: 1.25rem;
}

.dashboard-table {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.dashboard-table table {
  margin-bottom: 0;
}

.dashboard-table thead th {
  background: var(--surface-alt);
  border-bottom: 1px solid var(--rule);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}

.dashboard-table td,
.dashboard-table th {
  vertical-align: middle;
  padding: .75rem 1rem;
}

.dashboard-form-card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}

.lang-tabs {
  display: flex;
  gap: .25rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1.25rem;
}

.lang-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: .5rem 1rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.lang-tab-btn.active {
  color: var(--green-700);
  border-bottom-color: var(--green-700);
}

.lang-panel[hidden] {
  display: none;
}

/* Stacked bilingual sections (blog post / news form) - both languages
   always visible at once, unlike .lang-tabs above (still used by the
   event form) which hides one language behind a click. A left accent bar
   distinguishes the two blocks from one another at a glance. */
.lang-block {
  border-left: 3px solid var(--green-600);
  padding-left: 1rem;
  margin-bottom: 1.5rem;
}

.lang-block:last-child {
  margin-bottom: 0;
}

.lang-block-en {
  border-left-color: var(--cm-yellow);
}

.lang-block-heading {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 1rem;
}

/* CKEditor's own chrome (toolbar + editable area) dressed to match the
   dashboard's form-control look instead of its stock styling. */
.ck.ck-editor {
  margin-bottom: .25rem;
}

.ck.ck-editor__main > .ck-editor__editable {
  min-height: 220px;
  border-color: var(--rule) !important;
}

.ck.ck-toolbar {
  border-color: var(--rule) !important;
  background: var(--surface-alt) !important;
}

.attachment-row {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: .75rem;
  margin-bottom: .75rem;
  background: var(--surface-alt);
}

.mail-body-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-sans);
  font-size: .9rem;
  background: var(--surface-alt);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1rem;
  max-height: 60vh;
  overflow-y: auto;
}

/* Minister's message form (adminpanel/minister_message_form.html). */
.minister-photo-wrap {
  width: 140px;
  height: 140px;
  margin: 0 auto;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--green-100, var(--surface-alt));
  background: var(--surface-alt);
}

.minister-photo-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.minister-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--muted);
}

/* Contact message detail (adminpanel/message_detail.html). */
.message-meta-card {
  background: var(--surface-alt);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.message-meta-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .35rem 1rem;
  margin: 0;
}

.message-meta-card dt {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.message-meta-card dd {
  margin: 0;
  font-size: .875rem;
}

/* Mailbox list search bar (adminpanel/mailbox_list.html). */
.mailbox-search {
  max-width: 480px;
}
.mailbox-search .input-group-text {
  border-right: 0;
  color: var(--muted);
}
.mailbox-search input[type="search"] {
  border-left: 0;
}
.mailbox-search input[type="search"]:focus {
  box-shadow: none;
}

/* Statistics page */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--green-700);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}
.stat-card span { display: block; font-size: 0.75rem; color: var(--muted); line-height: 1.3; }
.stat-card strong { display: block; font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.stat-bars { display: flex; align-items: flex-end; gap: 3px; height: 9rem; }
.stat-bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.stat-bar-fill { display: block; width: 100%; background: var(--green-700); border-radius: 2px 2px 0 0; min-height: 2px; }
.stat-bar:hover .stat-bar-fill { background: var(--cm-yellow); }
.stat-bar small { font-size: 0.6rem; color: var(--muted); margin-top: 2px; }

/* Login page: webmail shortcut */
.login-extra {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  text-align: center;
}
.login-extra span { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem; }

/* Archive tabs, bulk bar, row actions */
.archive-tabs { list-style: none; display: flex; gap: 0.35rem; padding: 0; margin: 0 0 1rem; border-bottom: 1px solid var(--rule); }
.archive-tabs a {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.5rem 0.9rem; margin-bottom: -1px;
  border: 1px solid transparent; border-radius: var(--radius) var(--radius) 0 0;
  color: var(--muted); font-weight: 600; font-size: 0.9rem; text-decoration: none;
}
.archive-tabs a:hover { color: var(--green-700); }
.archive-tabs a.active { background: #fff; border-color: var(--rule); border-bottom-color: #fff; color: var(--green-900); }
.archive-tabs a span { background: var(--green-100); color: var(--green-900); border-radius: 999px; padding: 0 0.5rem; font-size: 0.72rem; }
.row-actions { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; justify-content: flex-end; }
.bulk-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  padding: 0.6rem 0.9rem; margin-bottom: 1rem;
  background: var(--green-050); border: 1px solid var(--rule); border-radius: var(--radius);
}

/* Gallery admin: grid, selection, uploader */
.photo-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: 0.9rem; }
.photo-admin-card { position: relative; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.photo-admin-card.is-draft img { opacity: 0.6; }
.photo-admin-card.is-selected { border-color: var(--green-700); box-shadow: 0 0 0 2px var(--green-700); }
.photo-admin-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo-check { position: absolute; top: 0.4rem; left: 0.4rem; background: rgba(255,255,255,0.9); border-radius: 4px; padding: 0.2rem 0.35rem; margin: 0; line-height: 1; }
.photo-meta { padding: 0.5rem 0.6rem 0.4rem; min-height: 3.2rem; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
  padding: 2.25rem 1rem; text-align: center; cursor: pointer;
  background: var(--green-050); border: 2px dashed var(--green-600); border-radius: var(--radius-lg);
  color: var(--ink); transition: background-color 0.15s ease, border-color 0.15s ease;
}
.dropzone i { font-size: 2.4rem; color: var(--green-700); }
.dropzone span { color: var(--muted); }
.dropzone small { color: var(--muted); }
.dropzone:hover, .dropzone:focus, .dropzone.is-over { background: var(--green-100); border-color: var(--green-900); outline: none; }
.upload-list { display: flex; flex-direction: column; gap: 0.5rem; }
.upload-row { display: flex; align-items: center; gap: 0.75rem; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.5rem 0.75rem; }
.upload-row img { width: 3.5rem; height: 3.5rem; object-fit: cover; border-radius: var(--radius); background: var(--surface-alt); flex: none; }
.upload-body { flex: 1; min-width: 0; }
.upload-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-bar { height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; margin: 0.3rem 0 0.2rem; }
.upload-bar span { display: block; height: 100%; width: 0; background: var(--green-700); transition: width 0.15s ease; }
.upload-status { font-size: 0.75rem; color: var(--muted); }
.upload-row[data-state="done"] { border-color: var(--green-600); }
.upload-row[data-state="done"] .upload-status { color: var(--green-700); font-weight: 600; }
.upload-row[data-state="error"] { border-color: #c0392b; }
.upload-row[data-state="error"] .upload-status { color: #c0392b; font-weight: 600; }
.upload-row[data-state="error"] .upload-bar span { background: #c0392b; width: 100%; }
.upload-summary { padding: 0.65rem 1rem; border-radius: var(--radius); font-weight: 600; margin-bottom: 0.75rem; }
.upload-summary.all-ok { background: var(--green-100); color: var(--green-900); }
.upload-summary.has-errors { background: #fdecea; color: #922b21; }

/* Dashboard cards */
a.stat-card { display: block; text-decoration: none; color: inherit; transition: box-shadow 0.15s ease, border-color 0.15s ease; }
a.stat-link:hover, a.stat-link:focus { box-shadow: var(--shadow-md); border-color: var(--green-600); }
.stat-sub { margin-top: 0.35rem; font-size: 0.75rem; color: var(--green-700); font-weight: 600; }
.stat-alert { border-left-color: #e6a700; }
.stat-alert .stat-value { color: #b57f00; }

.stat-robots { border-left-color: var(--muted); background: var(--surface-alt, #f3f5f3); }
.stat-robots strong { color: var(--muted); }

/* Sent replies shown under a message (permanent record) */
.sent-reply { background: #fff; border: 1px solid var(--rule); border-left: 4px solid var(--green-700); border-radius: var(--radius); margin-bottom: 0.9rem; overflow: hidden; }
.sent-reply > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 0.8rem 1rem; background: var(--green-050); border-bottom: 1px solid var(--rule); }
.sent-reply-lock { color: var(--green-700); font-size: 1.1rem; flex: none; }
.sent-reply-body { display: block; width: 100%; height: 22rem; border: 0; background: #fff; }
