/* ==========================================================================
   Ministers Meeting Attendance — Admin design system
   A quiet, formal palette: ink navy + brass, on warm paper.
   ========================================================================== */

:root {
  --ink: #1c2b3a;
  --ink-2: #24384a;
  --ink-dark: #121c26;
  --gold: #ab8654;
  --gold-dark: #8a6a3f;
  --gold-pale: #f1e7d6;
  --paper: #f6f4ee;
  --surface: #ffffff;
  --border: #e6e1d6;
  --text: #23262b;
  --text-muted: #6b7280;
  --success: #2f6b4f;
  --success-bg: #e6f0ea;
  --danger: #a13d3d;
  --danger-bg: #f8ebeb;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgba(28, 43, 58, 0.04), 0 8px 24px -12px rgba(28, 43, 58, 0.14);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--paper);
  color: var(--text);
  font-size: 0.94rem;
}

h1, h2, h3, h4, .display-serif {
  font-family: 'Fraunces', Georgia, serif;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--gold-dark);
}

a { color: var(--ink); }

/* ---------- Brand mark ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--gold);
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.brand-text {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1rem;
  color: #fff;
  line-height: 1.15;
}
.brand-text small {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #8b98a8;
}

/* ---------- Layout shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  background: var(--ink-dark);
  width: 248px;
  flex-shrink: 0;
  padding: 1.5rem 1.1rem;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
}
.sidebar .brand { padding: 0 .3rem 1.75rem; }
.sidebar-nav { flex: 1; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: #9aa7b6;
  padding: .65rem .8rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.88rem;
  margin-bottom: .2rem;
  transition: background .15s ease, color .15s ease;
}
.sidebar-nav a i { font-size: 1rem; width: 18px; text-align: center; color: #6d7c8d; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: var(--gold); color: var(--ink-dark); font-weight: 600; }
.sidebar-nav a.active i { color: var(--ink-dark); }
.sidebar-foot {
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: 1rem;
  margin-top: 1rem;
}
.sidebar-foot a { color: #9aa7b6; font-size: .85rem; }
.sidebar-foot a:hover { color: #fff; }

.main-col { margin-left: 248px; flex: 1; min-width: 0; }

.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: var(--ink-dark);
  padding: .85rem 1.1rem;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .brand-text { font-size: .92rem; }
.topbar-toggle {
  background: transparent;
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  border-radius: var(--radius-sm);
  width: 38px; height: 38px;
}

.content { padding: 2.25rem 2.25rem 3rem; max-width: 1240px; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.page-head h1 { font-size: 1.65rem; font-weight: 600; margin: 0; }
.page-head p { color: var(--text-muted); margin: .2rem 0 0; font-size: .9rem; }

@media (max-width: 991.98px) {
  .sidebar { display: none; }
  .main-col { margin-left: 0; }
  .topbar { display: flex; }
  .content { padding: 1.5rem 1.1rem 2.5rem; }
  .page-head h1 { font-size: 1.4rem; }
}

/* Bootstrap offcanvas re-themed as the mobile sidebar */
#mobileNav { background: var(--ink-dark); width: 260px; }
#mobileNav .sidebar-nav a { color: #9aa7b6; }
#mobileNav .btn-close { filter: invert(1); opacity: .7; }

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  background: var(--surface);
}
.card-flush { border: none; box-shadow: none; background: transparent; }

.stat-card {
  padding: 1.35rem 1.5rem;
}
.stat-card .stat-value {
  font-family: 'Fraunces', serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
}
.stat-card .stat-label { color: var(--text-muted); font-size: .82rem; margin-top: .4rem; }

/* ---------- Buttons ---------- */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: .88rem;
  padding: .55rem 1.05rem;
}
.btn-primary { background: var(--ink); border-color: var(--ink); }
.btn-primary:hover, .btn-primary:focus { background: var(--ink-2); border-color: var(--ink-2); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-dark); border-color: var(--gold-dark); color: #fff; }
.btn-outline-primary { color: var(--ink); border-color: var(--border); }
.btn-outline-primary:hover { background: var(--ink); border-color: var(--ink); }
.btn-sm { font-size: .8rem; padding: .4rem .75rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Forms ---------- */
.form-label { font-size: .82rem; font-weight: 600; color: var(--ink); margin-bottom: .3rem; }
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--border);
  font-size: .9rem;
  padding: .55rem .75rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 .2rem rgba(171, 134, 84, .15);
}
.form-text { font-size: .78rem; }

/* ---------- Tables ---------- */
.table { font-size: .87rem; margin: 0; }
.table thead th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  padding-bottom: .75rem;
}
.table td { padding-top: .8rem; padding-bottom: .8rem; vertical-align: middle; border-color: var(--border); }
.table-hover tbody tr:hover { background: var(--gold-pale); }

/* ---------- Badges ---------- */
.badge-present { background: var(--success-bg); color: var(--success); font-weight: 600; }
.badge-muted { background: #eef0f2; color: var(--text-muted); font-weight: 600; }

/* ---------- Avatars ---------- */
.avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--gold-pale);
  flex-shrink: 0;
}
.avatar-lg { width: 88px; height: 88px; border-width: 2px; }
.avatar-initials {
  display: flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff;
  font-family: 'Fraunces', serif; font-weight: 600;
  border: 1.5px solid var(--gold-pale);
  border-radius: 50%;
  width: 44px; height: 44px; flex-shrink: 0;
}
.avatar-initials.avatar-lg { width: 88px; height: 88px; font-size: 1.6rem; border-width: 2px; }

/* ---------- Minister profile cards ---------- */
.minister-card {
  padding: 1.15rem;
  cursor: pointer;
  transition: box-shadow .15s ease, transform .15s ease;
  height: 100%;
}
.minister-card:hover { box-shadow: 0 10px 28px -14px rgba(28,43,58,.28); transform: translateY(-2px); }
.minister-card .name { font-family: 'Fraunda', 'Fraunces', serif; font-weight: 600; font-size: 1rem; color: var(--ink); margin: 0; }
.minister-card .church { font-size: .82rem; color: var(--text-muted); margin: .15rem 0 0; }
.minister-card .meta-row { display: flex; align-items: center; gap: .8rem; margin-top: .95rem; }

/* ---------- Profile modal ---------- */
.profile-header { display: flex; gap: 1.1rem; align-items: center; padding: .25rem 0 1.1rem; border-bottom: 1px solid var(--border); margin-bottom: 1.1rem; }
.profile-field { margin-bottom: .85rem; }
.profile-field .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 600; }
.profile-field .value { font-size: .93rem; color: var(--text); }
.qr-box { border: 1px dashed var(--border); border-radius: var(--radius-md); padding: 1rem; text-align: center; background: var(--paper); }

/* ---------- Empty states ---------- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 1.8rem; color: var(--gold); margin-bottom: .6rem; display: block; }

/* ---------- Documents ---------- */
.doc-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--gold-pale);
  color: var(--gold-dark);
  font-size: 1.15rem;
  flex-shrink: 0;
}
.badge-minutes { background: var(--success-bg); color: var(--success); font-weight: 600; }
.badge-announcement { background: var(--gold-pale); color: var(--gold-dark); font-weight: 600; }
.badge-poster { background: #ece3f6; color: #6b4fa0; font-weight: 600; }
.badge-other { background: #eef0f2; color: var(--text-muted); font-weight: 600; }
.subnav { display: flex; gap: .5rem; }
.subnav .btn.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Login page ---------- */
.login-page { background: var(--ink-dark); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2.25rem;
  width: 100%; max-width: 380px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.5);
  text-align: center;
}
.login-card .brand-mark { margin: 0 auto 1rem; }
.login-card h1 { font-size: 1.3rem; margin-bottom: .2rem; }
.login-card p.subtitle { color: var(--text-muted); font-size: .85rem; margin-bottom: 1.6rem; }
.login-card form { text-align: left; }

/* ---------- Misc ---------- */
.hr-fade { border: none; height: 1px; background: linear-gradient(90deg, transparent, var(--border), transparent); margin: 1.75rem 0; }
/* ---------- Meetings list ---------- */
.meeting-row { cursor: pointer; }
.meeting-row:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

/* ---------- Notes split view ---------- */
/* Wraps the meeting's main content (attendance/documents) and the notes
   segment. In its default state it's just a plain block — the split only
   kicks in once .notes-open is added (see JS in meeting_view.php). */
.meeting-split.notes-open {
  display: flex;
  gap: 1.25rem;
}
.meeting-main-pane { min-width: 0; }

.notes-pane {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.notes-pane.d-none { display: none; }

.notes-pane-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .5rem .6rem .85rem;
  background: var(--ink-dark);
  color: #fff;
  font-size: .85rem;
  font-weight: 600;
}
.notes-pane-header span:first-child { flex: 1; display: flex; align-items: center; gap: .4rem; }
.notes-pane-status { font-size: .68rem; font-weight: 500; color: #9aa7b6; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.notes-pane-close {
  background: transparent;
  border: none;
  color: #9aa7b6;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 .3rem;
}
.notes-pane-close:hover { color: #fff; }
.notes-pane-body {
  flex: 1;
  border: none;
  resize: none;
  outline: none;
  padding: 1rem;
  font-family: 'Inter', sans-serif;
  font-size: .92rem;
  line-height: 1.6;
  color: var(--text);
}

/* Landscape / wide screens: side-by-side split, each pane independently
   scrollable so typing in Notes never gets pushed off screen. */
@media (orientation: landscape) and (min-width: 768px) {
  .meeting-split.notes-open { flex-direction: row; align-items: flex-start; }
  .meeting-split.notes-open .meeting-main-pane { flex: 1 1 55%; max-height: 78vh; overflow-y: auto; padding-right: .25rem; }
  .meeting-split.notes-open .notes-pane { flex: 1 1 45%; max-width: 520px; height: 78vh; }
}

/* Portrait / narrow screens (most phones): stacked split, notes gets the
   larger share since that's where typing happens. */
@media (orientation: portrait), (max-width: 767.98px) {
  .meeting-split.notes-open { flex-direction: column; }
  .meeting-split.notes-open .meeting-main-pane { max-height: 30vh; overflow-y: auto; }
  .meeting-split.notes-open .notes-pane { height: 50vh; }
}