/*
 * BMP MEL Tool - styles.
 *
 * Colours follow mahilaparishad.org: the blue of its header, a light blue as
 * support, and purple sparingly as an accent. All colours are variables here,
 * so the look can be changed in one place when it is decided with BMP.
 *
 * Fonts are served from the tool's own server, never from Google. Noto Sans
 * covers Latin, Noto Sans Bengali covers Bangla; the browser picks the one
 * that has the glyph, so mixed text looks consistent.
 */

@font-face {
  font-family: "Noto Sans";
  src: url("../fonts/NotoSans-wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans Bengali";
  src: url("../fonts/NotoSansBengali-wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bmp-blue: #0071b5;
  --bmp-blue-dark: #005a91;
  --bmp-blue-light: #6cbdf4;
  --menu-bg: #e8f4fc;
  --menu-text: #0c447c;
  --accent: #785cb4;
  --accent-bg: #eeeaf7;
  --accent-text: #4a3880;

  --text: #1f2933;
  --muted: #5b6670;
  --border: #d8e1e8;
  --page-bg: #f5f7f9;
  --surface: #ffffff;
  --surface-soft: #f0f4f7;

  --success-bg: #e6f4ea;
  --success-text: #1e6b34;
  --error-bg: #fcebeb;
  --error-text: #a32d2d;

  --radius: 8px;
  --font: "Noto Sans", "Noto Sans Bengali", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--page-bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Bangla script needs a little more line height to keep its vowel signs clear. */
:lang(bn) body, body:lang(bn) { line-height: 1.75; }

h1, h2, h3 { line-height: 1.3; font-weight: 600; margin: 0 0 12px; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0 0 12px; }
a { color: var(--bmp-blue); }
code, .mono { font-family: var(--mono); font-size: 0.9em; }

/* ------------------------------------------------------------ top bar */

.topbar {
  background: var(--bmp-blue);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 24px;
  flex-wrap: wrap;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  text-decoration: none;
}

.topbar-logo img { height: 44px; width: auto; display: block; }

.topbar-name {
  font-size: 15px;
  font-weight: 500;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.5);
  white-space: nowrap;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.topbar-user { opacity: 0.95; }

.lang-switch {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  overflow: hidden;
  margin: 0;
}

.lang-switch button {
  font: inherit;
  font-size: 13px;
  background: transparent;
  color: #fff;
  border: 0;
  padding: 4px 11px;
  cursor: pointer;
}

.lang-switch button.is-current {
  background: #fff;
  color: var(--bmp-blue);
  font-weight: 600;
}

.link-button {
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  color: #fff;
  text-decoration: underline;
  cursor: pointer;
}

form.inline { display: inline; margin: 0; }

/* --------------------------------------------------------------- menu */

.menubar {
  background: var(--menu-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.menu, .submenu { list-style: none; margin: 0; padding: 0; }
.menu { display: flex; flex-wrap: wrap; gap: 4px; }
.menu-item { position: relative; }

.menu-item > a,
.menu-toggle {
  display: block;
  font: inherit;
  font-size: 14px;
  color: var(--menu-text);
  text-decoration: none;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 10px 12px 9px;
  cursor: pointer;
}

.menu-item.is-active > a,
.menu-item.is-active > .menu-toggle {
  border-bottom-color: var(--bmp-blue);
  font-weight: 600;
}

.menu-item > a:hover,
.menu-toggle:hover { background: rgba(0, 113, 181, 0.08); }

.caret { font-size: 10px; margin-left: 2px; }

.submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  z-index: 10;
  padding: 6px 0;
}

/* Open by the script, or by keyboard focus if the script did not load. */
.menu-toggle[aria-expanded="true"] + .submenu,
.menu-item:focus-within > .submenu { display: block; }

.submenu a {
  display: block;
  padding: 8px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}

.submenu a:hover { background: var(--menu-bg); }
.submenu a.is-active { font-weight: 600; color: var(--bmp-blue); }

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

.page {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.page-narrow { max-width: 460px; padding-top: 48px; }

.page-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.page-heading h1 { margin: 0; }

.lead { font-size: 17px; max-width: 46em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
}

.card-table { padding: 0; overflow-x: auto; }
.card-table-title { padding: 16px 18px 4px; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-top: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 600; color: var(--muted); }

/* ------------------------------------------------------------- tables */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 18px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 13px; background: var(--surface-soft); }
tr:last-child td { border-bottom: 0; }

.scroll-box { max-height: 340px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); margin-top: 12px; }
.scroll-box td { padding: 6px 12px; }

/* -------------------------------------------------------------- forms */

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }

input[type="text"], input[type="email"], input[type="password"], input[type="url"],
select, textarea {
  width: 100%;
  font: inherit;
  padding: 9px 11px;
  border: 1px solid #b9c5cf;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--bmp-blue-light);
  outline-offset: 1px;
}

.hint { font-size: 13px; color: var(--muted); margin: 4px 0 0; }

.button {
  display: inline-block;
  font: inherit;
  font-size: 15px;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid #b9c5cf;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.button:hover { background: var(--surface-soft); }
.button-primary { background: var(--bmp-blue); border-color: var(--bmp-blue); color: #fff; }
.button-primary:hover { background: var(--bmp-blue-dark); }
.button-danger { color: var(--error-text); border-color: #e3b4b4; }
.button-small { font-size: 13px; padding: 4px 10px; }
.button-wide { width: 100%; }

/* ------------------------------------------------- notices and badges */

.notice { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 15px; }
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.notice-success { background: var(--success-bg); color: var(--success-text); }
.notice-error { background: var(--error-bg); color: var(--error-text); }

.badge { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 6px; white-space: nowrap; }
.badge-accent { background: var(--accent-bg); color: var(--accent-text); }
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-error { background: var(--error-bg); color: var(--error-text); }
.badge-neutral { background: var(--surface-soft); color: var(--muted); }

/* ------------------------------------------------------ users, account */

.topbar-user { color: #fff; text-decoration: none; }
.topbar-user:hover { text-decoration: underline; }

tr.is-inactive td { color: var(--muted); }

.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
.details dt { color: var(--muted); font-size: 14px; }
.details dd { margin: 0; }

label.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 600; }
label.checkbox input { width: auto; margin: 0; }

.secret { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.secret-value {
  font-size: 18px;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  user-select: all;
}

/* --------------------------------------------------------- registers */

.outcome-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.outcome-head h2 { margin: 0; }
.code { font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
section.is-inactive { opacity: 0.7; }

details.statement { margin: 4px 0 14px; }
details.statement summary { cursor: pointer; color: var(--bmp-blue); font-size: 14px; }
details.statement p { margin: 8px 0 0; max-width: 60em; color: var(--text); }

table.indicators td { padding: 8px 10px; }
table.indicators tr:first-child td { border-top: 1px solid var(--border); }

.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 20px; }
textarea { resize: vertical; }

.inline-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.inline-add input[type="text"] { flex: 1 1 200px; width: auto; }

fieldset.checks { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px 12px; margin: 0 0 14px; }
fieldset.checks legend { font-weight: 600; font-size: 14px; padding: 0 6px; }
fieldset.checks label.checkbox { font-weight: 400; margin: 4px 16px 0 0; display: inline-flex; }

.guidance { margin-top: 6px; padding: 6px 10px; background: var(--accent-bg); color: var(--accent-text); border-radius: 6px; font-size: 14px; }
fieldset.guidance-fields { border: 1px solid var(--accent-bg); background: #faf8fd; border-radius: var(--radius); padding: 10px 16px 4px; margin: 0 0 16px; }
fieldset.guidance-fields legend { font-weight: 600; font-size: 14px; color: var(--accent-text); padding: 0 6px; }
input[readonly], textarea[readonly] { background: var(--surface-soft); color: var(--muted); }

/* ------------------------------------------------------------- footer */

.site-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 24px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ------------------------------------------------------------- narrow */

@media (max-width: 640px) {
  .topbar { padding: 10px 16px; }
  .topbar-logo img { height: 34px; }
  .topbar-name { display: none; }
  .topbar-right { margin-left: 0; width: 100%; justify-content: space-between; }
  .menubar { padding: 0 8px; }
  .page { padding: 20px 16px 32px; }
  .submenu { position: static; box-shadow: none; border-radius: 0; }
}
