/* ==========================================================================
   MINEFOP Mail - child skin for Roundcube Elastic.

   Palette pulled directly from the Django site's own design tokens at
   /srv/minefop-django/static/css/custom.css (:root, lines 16-70) - not
   approximated. See the migration report for the source of each value.
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url('../fonts/source-serif-4-latin.woff2') format('woff2');
}

:root {
  /* National colours (flag & coat of arms). */
  --cm-green: #04502c;
  --cm-red: #ce1126;
  --cm-yellow: #fcd116;

  /* Institutional palette derived from the national green. */
  --green-900: #012414;
  --green-800: #023018;
  --green-700: #04502c;
  --green-600: #0a6b3c;
  --green-100: #e4efe9;
  --green-050: #f1f7f3;

  /* Gold rule / focus colour. */
  --gold: #c8a951;
  --gold-dark: #9b7f30;

  /* Warm supporting accent (distinct from the green/gold pair) - used for
     unread indicators, avatar variety, and small highlights so the UI
     doesn't read as flatly single-tone. */
  --terracotta: #b8541f;
  --terracotta-dark: #8f3f16;
  --unread-dot: #0a6b3c;

  /* Neutrals. */
  --ink: #14231e;
  --ink-soft: #40514a;
  --muted: #66776f;
  --rule: #d9e2dd;
  --surface: #f4f7f5;
  --surface-alt: #eef3f0;

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Source Serif 4', 'Merriweather', Georgia, serif;
}

/* --------------------------------------------------------------------------
   1. Global type & links
   -------------------------------------------------------------------------- */

body {
  font-family: var(--font-sans) !important;
  color: var(--ink);
}

a { color: var(--green-700); }
a:hover, a:focus { color: var(--green-900); }

/* Visible, high-contrast focus ring everywhere - matches the public site. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.btn:focus-visible {
  outline: 3px solid var(--gold) !important;
  outline-offset: 1px;
}

/* --------------------------------------------------------------------------
   2. Buttons
   -------------------------------------------------------------------------- */

.btn-primary {
  background-color: var(--green-700) !important;
  border-color: var(--green-700) !important;
  color: #fff !important;
  font-weight: 600;
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--green-900) !important;
  border-color: var(--green-900) !important;
}
.btn-secondary {
  color: var(--green-700) !important;
  border-color: var(--green-700) !important;
}
.btn-secondary:hover {
  background-color: var(--green-050) !important;
  color: var(--green-900) !important;
}

/* --------------------------------------------------------------------------
   3. Login page
   -------------------------------------------------------------------------- */

html.task-login,
body.task-login {
  background: linear-gradient(160deg, var(--green-900) 0%, var(--green-700) 55%, var(--green-600) 100%) !important;
  min-height: 100vh;
  font-family: var(--font-sans);
}
.task-login #layout-content {
  text-align: center;
  /* elastic gives #layout-content an opaque white background for the
     normal 3-pane mail view; on the login page that covers our gradient
     almost entirely, leaving only a thin sliver visible at the edges. */
  background-color: transparent !important;
}

/* Crest-only mark (the full wordmark is illegible at the height this slot
   allows) - overrides elastic's `top: 16vh; max-height: 100px`. */
.task-login #logo {
  position: relative;
  top: 6vh;
  max-height: 110px;
  width: auto;
  display: inline-block;
  filter: drop-shadow(0 4px 10px rgba(1, 36, 20, 0.35));
}
#login-brand {
  position: relative;
  top: 6vh;
  margin-top: 0.6rem;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.01em;
  color: #fff;
  text-shadow: 0 2px 8px rgba(1, 36, 20, 0.4);
}

/* Language switcher - French is the configured default (Cameroon is
   officially bilingual); this lets a visitor switch to English before
   ever logging in, which stock Roundcube has no control for. */
#login-langswitch {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
}
#login-langswitch a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
}
#login-langswitch a:hover {
  color: #fff;
  text-decoration: underline;
}
#login-langswitch .active {
  color: #fff;
}
#login-langswitch .sep {
  color: rgba(255, 255, 255, 0.4);
  margin: 0 0.3em;
}

/* The actual card: elastic gives #login-form no background of its own. */
#login-form {
  top: 9vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(1, 36, 20, 0.35);
  padding: 2rem 1.75rem 1.5rem;
}
#login-form table.propform td.title {
  text-align: left;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.85rem;
  padding-bottom: 0.2rem;
}
#login-form input.form-control {
  background: #fff !important;
  color: var(--ink) !important;
  border: 1px solid var(--rule) !important;
  border-radius: 6px !important;
  padding: 0.55rem 0.75rem !important;
}
#login-form input.form-control:focus {
  border-color: var(--green-600) !important;
  box-shadow: 0 0 0 3px var(--green-100) !important;
  outline: none !important;
}
#login-form .formbuttons {
  margin-top: 1rem;
}
#login-form .button.mainaction {
  background-color: var(--green-700) !important;
  border-color: var(--green-700) !important;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.65rem 1rem;
}
#login-form .button.mainaction:hover,
#login-form .button.mainaction:focus {
  background-color: var(--green-900) !important;
  border-color: var(--green-900) !important;
}
#login-footer {
  color: var(--muted);
  margin-top: 0.75rem;
}

/* Belt-and-suspenders: force light theme even if `html.dark-mode` is ever
   set by a stale cookie from before this skin removed the auto-toggle. */
html.dark-mode.task-login,
html.dark-mode body.task-login {
  background: linear-gradient(160deg, var(--green-900) 0%, var(--green-700) 55%, var(--green-600) 100%) !important;
}
html.dark-mode #login-form input.form-control {
  background: #fff !important;
  color: var(--ink) !important;
  border-color: var(--rule) !important;
}

/* --------------------------------------------------------------------------
   4. Main interface shell - top header / task icon rail
   -------------------------------------------------------------------------- */

#layout-menu,
html.layout-phone #layout-menu .popover-header {
  background-color: var(--green-900) !important;
}
#rcmdraglayer {
  background-color: var(--green-900) !important;
}

#layout-menu a.selected,
#layout-menu a.selected:hover {
  background-color: var(--green-700) !important;
}
#layout-menu a:hover {
  background-color: var(--green-800) !important;
}
#layout-menu a.logout:hover {
  background-color: var(--cm-red) !important;
}

/* Language switcher in the sidebar - deliberately NOT overriding
   display/size/padding so it inherits the exact same box as the
   About/Logout buttons it sits beside (#taskmenu a already sets those). */
#layout-menu a.langswitch {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
}
#layout-menu a.langswitch .inner {
  font-weight: 700;
  letter-spacing: 0.04em;
}
#layout-menu a.langswitch:hover {
  background-color: var(--green-800);
  color: #fff;
}

/* Visual break between the task icons (mail/contacts/settings) and the
   account controls (about/logout) at the bottom of the dark rail. */
#taskmenu .special-buttons {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

#layout > div > .header,
#layout-content > .header {
  background-color: #fff;
  border-bottom: 1px solid var(--rule);
}
#layout > div > .header .header-title {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--green-900);
}

/* Header/toolbar brand logo (small, transparent, square). */
#layout-menu .logo,
.header #logo,
#taskmenu #logo {
  width: 36px;
  height: 36px;
}

/* --------------------------------------------------------------------------
   5. Compose button - prominent, pill-shaped, not a plain menu item
   -------------------------------------------------------------------------- */

#taskmenu .action-buttons {
  padding: 0.75rem 0.6rem 0.35rem;
}
#taskmenu a.compose {
  background-color: var(--gold) !important;
  color: var(--green-900) !important;
  border-radius: 999px !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(1, 36, 20, 0.25);
}
#taskmenu a.compose:hover,
#taskmenu a.compose:focus {
  background-color: #dcc06e !important;
  color: var(--green-900) !important;
}
#taskmenu a.compose .inner {
  color: inherit !important;
}

/* --------------------------------------------------------------------------
   6. Folder list - unread badges, section separation
   -------------------------------------------------------------------------- */

#layout-sidebar,
.folder-list {
  background-color: var(--surface);
}
#layout-sidebar .listing.folder-list li.selected > a,
#folderlist li.selected > a {
  background-color: var(--green-100) !important;
  color: var(--green-900) !important;
  font-weight: 600;
  border-left: 3px solid var(--green-700);
}
#folderlist li a:hover {
  background-color: var(--green-050) !important;
}

/* Roundcube already renders a <span class="unreadcount"> per folder with a
   live unread count - style it as a proper badge instead of plain text. */
#folderlist .unreadcount {
  display: inline-block;
  min-width: 1.35em;
  padding: 0.05em 0.45em;
  margin-left: 0.4em;
  border-radius: 999px;
  background-color: var(--terracotta);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.5;
}
#folderlist li.selected .unreadcount {
  background-color: var(--green-700);
}
#folderlist li.mailbox.unread > a {
  font-weight: 600;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   7. Message list - density, avatars, unread/read distinction
   -------------------------------------------------------------------------- */

.message-list tr.selected td,
.message-list tr.selected {
  background-color: var(--green-100) !important;
}
.message-list tr.unread td.subject,
.message-list tr.unread td .fromto {
  font-weight: 700;
  color: var(--ink);
}
.message-list tr:not(.unread) td.subject,
.message-list tr:not(.unread) td .fromto {
  color: var(--ink-soft);
  font-weight: 400;
}
.message-list tr:hover td {
  background-color: var(--green-050);
}
.message-list tr td.subject {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}
/* Unread dot: recolour from elastic's default blue to the brand green so
   read/unread reads as an intentional, branded state rather than a
   leftover default. */
.message-list tr.unread td.subject:before,
.message-list .msgicon.status.unread:before {
  color: var(--unread-dot) !important;
}
.message-list td .date {
  color: var(--muted);
  font-size: 0.8rem;
}

/* Sender initials avatar, injected by minefop.js after each list render. */
.minefop-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  margin-right: 0.55rem;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

/* --------------------------------------------------------------------------
   8. Reading pane
   -------------------------------------------------------------------------- */

.message-partheaders,
.message-header {
  background-color: var(--surface);
  border-bottom: 1px solid var(--rule);
}
#messagelist-header,
.message-header {
  padding: 1rem 1.25rem;
}
.message-header .subject {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--green-900);
}
#layout-content .iframe-wrapper {
  background-color: #fff;
}

/* --------------------------------------------------------------------------
   9. Toolbar - group related actions with real visual weight
   -------------------------------------------------------------------------- */

#toolbar-menu,
#mail-menu {
  padding: 0.4rem 0.6rem;
}
#toolbar-menu .spacer {
  display: inline-block;
  width: 1px;
  height: 24px;
  margin: 0 0.6rem;
  background-color: var(--rule);
  vertical-align: middle;
}
#toolbar-menu > a.button,
#toolbar-menu .dropbutton > a.button {
  border-radius: 6px;
  margin: 0 0.1rem;
}
#toolbar-menu > a.button:hover:not(.disabled),
#toolbar-menu .dropbutton > a.button:hover:not(.disabled) {
  background-color: var(--green-050);
}
#toolbar-menu a.delete:hover:not(.disabled) {
  background-color: #fbe9e4;
  color: var(--terracotta-dark);
}

/* One-click "move to Junk" button, added by minefop.js since stock
   Roundcube has no such action without an extra plugin - see js comment. */
#toolbar-menu a.minefop-junk {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.72rem;
  color: var(--ink-soft);
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}
#toolbar-menu a.minefop-junk:before {
  content: "\26A0";
  font-size: 1.1rem;
  margin-bottom: 0.15rem;
}
#toolbar-menu a.minefop-junk:hover:not(.disabled) {
  background-color: #fdf3e7;
  color: var(--terracotta-dark);
}
#toolbar-menu a.minefop-junk.disabled {
  color: var(--muted);
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   10. Misc: about page, search box, badges, selection colour
   -------------------------------------------------------------------------- */

.frame-content h1,
.frame-content h2.sysname {
  font-family: var(--font-serif);
  color: var(--green-900);
}

#quicksearchbar input,
.searchbar input {
  border-color: var(--rule);
  border-radius: 999px;
}

.badge,
.uibadge {
  background-color: var(--green-700);
}

::selection {
  background-color: var(--green-100);
  color: var(--ink);
}
