/* COC Volunteer Report & Management System — mobile-first stylesheet */

:root {
  --primary: #1a6b54;
  --primary-dark: #12503e;
  --primary-light: #e6f2ee;
  --danger: #c0392b;
  --danger-light: #fdecea;
  --warn: #b9770e;
  --warn-light: #fdf3e0;
  --ok: #1e8449;
  --bg: #f2f5f4;
  --card: #ffffff;
  --text: #1f2d2a;
  --muted: #6f8079;
  --border: #e3eae7;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(23, 50, 43, .05);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h2 { font-size: .98rem; color: var(--primary-dark); margin-bottom: .65rem; }
p { margin: .35rem 0; }
img { max-width: 100%; }

/* ---------- layout ---------- */

.topbar {
  background: var(--primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1.25rem;
  /* Full width so the bell and controls sit at the true right edge of the screen. */
  width: 100%;
}
.topbar-lang {
  width: auto;
  margin: 0 0 0 auto; /* pushes itself (and everything after) to the right edge */
  padding: .3rem 1.6rem .3rem .55rem;
  font-size: .82rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .25);
  color: #fff;
}
.topbar-lang option { color: var(--text); }
.brand { font-weight: 700; font-size: 1.05rem; flex: 1; letter-spacing: .01em; }
.topbar-user {
  font-size: .8rem;
  background: rgba(255, 255, 255, .14);
  padding: .3rem .75rem;
  border-radius: 999px;
  white-space: nowrap;
}
.nav-count {
  display: inline-block;
  min-width: 1.25rem;
  text-align: center;
  background: var(--danger);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: .05rem .3rem;
  margin-left: .35rem;
  vertical-align: middle;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem 1rem 5.5rem; /* room for bottom nav */
}
.topbar-logo {
  width: 34px;
  height: 34px;
  background: #fff;
  border-radius: 50%;
  padding: 2px;
  flex-shrink: 0;
}
.vol-topnav { display: none; }
@media (min-width: 900px) {
  /* Desktop: the volunteer portal becomes a full-width web app. */
  .volunteer-area .container { max-width: 1080px; padding: 1.5rem 2rem 3rem; }
  .volunteer-area .bottomnav { display: none; }
  .vol-topnav { display: flex; gap: .25rem; margin-left: 1rem; }
  .vol-topnav a {
    color: rgba(255, 255, 255, .85);
    padding: .35rem .9rem;
    border-radius: 999px;
    font-size: .92rem;
    font-weight: 600;
  }
  .vol-topnav a:hover { background: rgba(255, 255, 255, .12); text-decoration: none; color: #fff; }
  .vol-topnav a.active { background: rgba(255, 255, 255, .18); color: #fff; }
  .volunteer-area .topbar-inner { padding: .7rem 2rem; }
  .volunteer-area .brand { flex: 0 0 auto; }

  .dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; align-items: start; }
  .dash-grid > .dash-span { grid-column: 1 / -1; }
}
.auth-container { padding-top: 2.5rem; padding-bottom: 2rem; }

/* Volunteer bottom navigation */
.bottomnav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .45rem 0 .4rem;
  font-size: .7rem;
  color: var(--muted);
}
.bottomnav a .icon { font-size: 1.35rem; line-height: 1.2; }
.bottomnav a.active { color: var(--primary); font-weight: 600; }
.bottomnav a:hover { text-decoration: none; }

/* Admin shell */
.admin-area .container { max-width: none; padding-bottom: 2rem; }
.admin-shell { display: flex; min-height: calc(100vh - 52px); }
.sidenav {
  width: 210px;
  background: var(--card);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}
.sidenav ul { list-style: none; margin: 0; padding: .5rem 0; }
.sidenav a {
  display: block;
  padding: .58rem 1.1rem;
  color: var(--text);
  font-size: .92rem;
  border-left: 3px solid transparent;
}
.sidenav a:hover { background: var(--primary-light); text-decoration: none; }
.sidenav a.active {
  border-left-color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
  color: var(--primary-dark);
}
.admin-main { flex: 1; min-width: 0; padding: 1.5rem 1.75rem 2.5rem; max-width: 1440px; }
.nav-toggle { display: none; background: none; border: 0; color: #fff; font-size: 1.3rem; padding: 0; cursor: pointer; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .sidenav {
    position: fixed;
    top: 52px; bottom: 0; left: 0;
    transform: translateX(-100%);
    transition: transform .2s;
    z-index: 60;
    box-shadow: var(--shadow);
  }
  .sidenav.open { transform: translateX(0); }
  .topbar-user { display: none; }
}

/* ---------- cards & sections ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin: 0 0 1rem;
  display: block;
}
.card-alert { border-left: 3px solid var(--danger); background: #fdf0ee; }
.card-warn { border-left: 3px solid var(--warn); background: #fdf6e8; }
.card-alert, .card-warn { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; }
.card-alert h2, .card-warn h2 { flex-basis: 100%; margin-bottom: .1rem; }

.page-title { font-size: 1.3rem; margin: .25rem 0 1.1rem; letter-spacing: -.01em; }
.section-title,
.eyebrow {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  margin: 1.6rem 0 .6rem;
}
.eyebrow:first-of-type, .page-title + .eyebrow { margin-top: .25rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }

.two-col { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 980px) { .two-col { grid-template-columns: 1fr 1fr; align-items: start; } }
.two-col-wide { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 980px) { .two-col-wide { grid-template-columns: 2fr 1fr; align-items: start; } }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
  margin-bottom: .5rem;
}
@media (min-width: 700px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .stat-grid { grid-template-columns: repeat(6, 1fr); } }
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .85rem 1rem .8rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  color: var(--text);
  transition: border-color .12s, transform .12s;
}
a.stat:hover { text-decoration: none; border-color: var(--primary); transform: translateY(-1px); }
.stat-num {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.stat-warn .stat-num { color: var(--warn); }
.stat-danger .stat-num { color: var(--danger); }

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

label { display: block; font-size: .88rem; font-weight: 600; margin: .6rem 0 0; color: var(--primary-dark); }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"],
select, textarea {
  width: 100%;
  font: inherit;
  padding: .65rem .7rem;
  margin-top: .25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: var(--primary);
}
textarea { resize: vertical; }
.check-label { display: flex; align-items: center; gap: .5rem; font-weight: 400; margin-top: .6rem; }
.check-label input { width: auto; margin: 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .25rem; }
.form-row { display: grid; grid-template-columns: 1fr; gap: 0 .8rem; }
@media (min-width: 640px) { .form-row { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); } }
.form-stack .form-actions { display: flex; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; }
.inline-form { display: inline-flex; gap: .4rem; }
.action-stack { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: .6rem 1.05rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--primary-dark);
  cursor: pointer;
  text-align: center;
}
.btn:hover { border-color: var(--primary); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn-wa:hover { background: #1ebe5b; border-color: #1ebe5b; }
.contact-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
.btn-block { display: block; width: 100%; margin: .6rem 0; }
.btn-small { padding: .3rem .7rem; font-size: .82rem; }

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

.table-wrap { overflow-x: auto; padding: .4rem .5rem; }
.table { border-collapse: collapse; width: 100%; font-size: .88rem; }
.table th {
  text-align: left;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #8ba099;
  border-bottom: 1px solid var(--border);
  padding: .55rem .65rem;
  white-space: nowrap;
}
.table td { border-bottom: 1px solid #eef3f1; padding: .6rem .65rem; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr:not(:first-child):hover td { background: #f7faf9; }
.row-actions { white-space: nowrap; }

/* ---------- badges ---------- */

.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: .15rem .55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-draft { background: #eceff1; color: #546e7a; }
.badge-submitted { background: #e3f2fd; color: #1565c0; }
.badge-under_review { background: #ede7f6; color: #5e35b1; }
.badge-approved, .badge-ok, .badge-active { background: #e8f5e9; color: var(--ok); }
.badge-returned { background: var(--danger-light); color: var(--danger); }
.badge-archived { background: #eceff1; color: #78909c; }
.badge-disabled { background: #eceff1; color: #b71c1c; }
.badge-expired { background: var(--danger); color: #fff; }
.badge-d30 { background: var(--danger-light); color: var(--danger); }
.badge-d60 { background: var(--warn-light); color: var(--warn); }
.badge-d90 { background: #fff8e1; color: #8d6e08; }
.badge-none { background: #eceff1; color: #90a4ae; }

/* ---------- misc ---------- */

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.text-danger { color: var(--danger); font-weight: 600; }
.text-warn { color: var(--warn); font-weight: 600; }
.big-date { font-size: 1.5rem; font-weight: 700; color: var(--primary-dark); margin: .2rem 0; }

.flash-wrap { margin-bottom: .75rem; }
.flash {
  padding: .7rem .9rem;
  border-radius: 8px;
  margin-bottom: .5rem;
  font-size: .92rem;
}
.flash-success { background: #e8f5e9; color: var(--ok); border: 1px solid #c8e6c9; }
.flash-error { background: var(--danger-light); color: var(--danger); border: 1px solid #f5c6cb; }

.date-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--border);
}
.date-row:last-child { border-bottom: 0; }
.date-label { font-weight: 600; font-size: .92rem; }
.date-right { text-align: right; white-space: nowrap; }

.detail-field { padding: .45rem 0; border-bottom: 1px solid var(--border); }
.detail-field:last-child { border-bottom: 0; }
.detail-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.detail-value { margin-top: .1rem; white-space: pre-line; }

.report-row { color: var(--text); }
.report-row:hover { text-decoration: none; border-color: var(--primary); }
.report-row-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li { padding: .4rem 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: .5rem; }
.notif-list li:last-child { border-bottom: 0; }
.notif-list li.unread strong { color: var(--primary-dark); }
.notif-card.unread { border-left: 4px solid var(--primary); }

.log-list { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.log-list li { padding: .35rem 0; border-bottom: 1px solid var(--border); }
.log-list li:last-child { border-bottom: 0; }
.log-comment { background: var(--bg); border-radius: 6px; padding: .4rem .6rem; margin-top: .25rem; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: .5rem;
  margin: .5rem 0;
}
.photo-item { position: relative; display: block; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); aspect-ratio: 1; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del {
  position: absolute; top: 4px; right: 4px;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 0;
  background: rgba(192, 57, 43, .92);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.file-list { list-style: none; margin: .5rem 0; padding: 0; }
.file-list li { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.file-list li:last-child { border-bottom: 0; }

/* ---------- statistics charts (single-series, brand hue) ---------- */
.chart-cols {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
  padding: .5rem .25rem 0;
  border-bottom: 1px solid var(--border);
}
.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
}
.chart-bar {
  width: 100%;
  max-width: 26px;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  transition: background .12s;
}
.chart-col:hover .chart-bar { background: var(--primary-dark); }
.chart-val {
  font-size: .62rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
  white-space: nowrap;
}
.chart-lbl {
  font-size: .62rem;
  color: var(--muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.hbar-wrap { display: flex; align-items: center; gap: .5rem; min-width: 140px; }
.hbar {
  display: inline-block;
  height: 14px;
  min-width: 3px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}
.hbar-val { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.proj-chart td { vertical-align: middle; }

/* ---------- report form: document-style editor on desktop ---------- */
.doc-editor { min-height: 160px; }
@media (min-width: 900px) {
  .form-doc {
    display: grid;
    grid-template-columns: 1fr 330px;
    gap: 0 1rem;
    align-items: start;
  }
  .form-doc-main { grid-column: 1; grid-row: 1; }
  .form-doc-side { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 68px; }
  .form-doc-actions { grid-column: 1; grid-row: 2; }
  .doc-editor { min-height: 320px; font-size: 1.02rem; line-height: 1.7; padding: 1rem 1.1rem; }
  .form-doc-main textarea { font-size: .98rem; line-height: 1.65; }
}

.sound-row { display: flex; align-items: center; gap: .75rem; margin: .6rem 0 .3rem; }
.sound-row input[type="range"] { flex: 1; max-width: 260px; margin: 0; accent-color: var(--primary); }

.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .7rem; }
.filter-bar input[type="text"] { flex: 1 1 200px; margin: 0; }
.filter-bar select { width: auto; margin: 0; }
.filter-bar .btn { margin: 0; }

.bell { position: relative; color: #fff; font-size: 1.15rem; }
.bell:hover { text-decoration: none; }
.bell-count {
  position: absolute;
  top: -6px; right: -10px;
  background: var(--danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0 .32rem;
  min-width: 1rem;
  text-align: center;
}

/* ---------- login (split hero) ---------- */
.login-split {
  display: flex;
  flex-direction: column;
  max-width: 960px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 8px 40px rgba(18, 80, 62, .12);
  overflow: hidden;
}
.login-brand {
  background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 70%, #2a8a6e 100%);
  color: #fff;
  text-align: center;
  padding: 2.25rem 1.5rem;
}
.login-logo {
  width: 132px;
  height: 132px;
  background: #fff;
  border-radius: 50%;
  padding: 10px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .25);
}
.login-org { margin: 1rem 0 0; font-size: 1.25rem; color: #fff; }
.login-appname { margin: .3rem 0 0; font-size: .9rem; opacity: .85; }
.login-panel { padding: 1.5rem 1.75rem 1.75rem; }
.login-panel-top { display: flex; justify-content: flex-end; margin-bottom: .25rem; }
.lang-select-wrap { display: inline-flex; align-items: center; gap: .35rem; font-weight: 400; margin: 0; }
.lang-select {
  width: auto;
  margin: 0;
  padding: .35rem 1.8rem .35rem .6rem;
  font-size: .88rem;
  border-radius: 8px;
}
.login-form label:first-of-type { margin-top: 0; }
.login-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--muted);
  font-size: .8rem;
  margin: .75rem 0;
}
.login-divider::before, .login-divider::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.g-button-wrap { display: flex; justify-content: center; min-height: 44px; }
.login-note { margin-top: 1rem; }
@media (min-width: 820px) {
  .auth-container { display: flex; align-items: center; min-height: 100vh; max-width: none; }
  .login-split { flex-direction: row; width: 100%; }
  .login-brand {
    flex: 1 1 46%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
  }
  .login-logo { width: 180px; height: 180px; }
  .login-panel { flex: 1 1 54%; padding: 2.25rem 2.75rem; display: flex; flex-direction: column; justify-content: center; }
}

.auth-card { max-width: 420px; margin: 0 auto; }
.auth-logo {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto .75rem;
}
.auth-card h1 { text-align: center; font-size: 1.15rem; }
.auth-logo-img { display: block; width: 96px; height: 96px; margin: 0 auto .75rem; }
.lang-switch { display: flex; justify-content: center; gap: .35rem; flex-wrap: wrap; margin: .5rem 0 .75rem; }
.lang-switch a {
  padding: .25rem .7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .82rem;
  color: var(--text);
}
.lang-switch a:hover { text-decoration: none; border-color: var(--primary); }
.lang-switch a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- print (report pages) ---------- */
@media print {
  .topbar, .sidenav, .bottomnav, .btn, form.card, .flash-wrap, .action-stack { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; page-break-inside: avoid; }
  .admin-main { padding: 0; }
}
