@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600&display=swap');

/* Re-themed to match NewSite's palette (gold/ink/cream) instead of inventing a
   new one -- component structure below is otherwise the same proven admin-panel
   system already used in Member_html/css/styles.css. */
:root {
  --accent: #172a27;
  --accent-dark: #0d1917;
  --accent-contrast: #ffffff;
  --gold: #c59649;
  --bg: #f2eee5;
  --surface: #fbfaf6;
  --surface-alt: #efe9db;
  --border: #d7d0c1;
  --text: #172a27;
  --text-muted: #6a746f;
  --success: #1a7f43;
  --danger: #b3261e;
  --warning: #a06400;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --font: Montserrat, Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  min-height: 100vh;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.hidden { display: none !important; }

/* Matches Member_html's login page background (--bg: #f7ecd0) while the
   Communications login screen is showing. */
body.login-screen { background: #f7ecd0; }

/* ---------- Header / Nav ---------- */

.app-header {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 10px 24px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-wrap: wrap;
}

.header-left { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--gold); border-radius: 50%; color: var(--gold);
  font-size: 14px; letter-spacing: 0.02em;
}
.app-title { font-weight: 600; font-size: 15px; letter-spacing: 0.02em; }

.main-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; align-items: center; }
.main-nav button, .main-nav a {
  background: transparent;
  border: none;
  color: var(--accent-contrast);
  opacity: 0.8;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
}
.main-nav button:hover, .main-nav a:hover { background: rgba(255, 255, 255, 0.12); opacity: 1; }
.main-nav button.active { background: rgba(197, 150, 73, 0.25); color: var(--gold); opacity: 1; }

.header-right { display: flex; align-items: center; gap: 12px; }
.current-user { font-size: 12px; opacity: 0.85; }

/* ---------- Buttons ---------- */

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--surface-alt); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-dark); }

.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-ghost { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.3); color: var(--accent-contrast); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.2); }

/* ---------- Layout ---------- */

#app-main { max-width: 1200px; margin: 0 auto; padding: 24px; }

.view { display: block; }

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

.card h2 { margin-top: 0; font-size: 18px; }
.card h3 { font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 18px 0 10px; }

.page-title { font-size: 24px; font-weight: 600; margin: 4px 0 16px; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type="text"], .toolbar input[type="search"] { flex: 1; min-width: 200px; }

/* ---------- Dashboard tiles ---------- */

.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.tile {
  display: block; text-align: left; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; cursor: pointer; box-shadow: var(--shadow);
}
.tile:hover { border-color: var(--gold); }
.tile .tile-title { font-weight: 600; font-size: 16px; margin-bottom: 6px; }
.tile .tile-desc { color: var(--text-muted); font-size: 12px; line-height: 1.5; }

/* ---------- Forms ---------- */

label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }

input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="search"], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
textarea { resize: vertical; min-height: 60px; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-alt); color: var(--text-muted); }

.field { margin-bottom: 12px; }
.field-checkbox { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.field-checkbox label { margin-bottom: 0; }
.field-checkbox input { width: auto; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px 16px;
}

.login-wrap { max-width: 380px; margin: 100px auto; text-align: center; }
.login-wrap .brand-mark { width: 56px; height: 56px; font-size: 22px; margin: 0 auto 16px; color: var(--gold); border-color: var(--gold); }
.login-wrap .card { text-align: left; }

/* ---------- Tables ---------- */

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.table-wrap { overflow-x: auto; }

/* ---------- Toasts ---------- */

.toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--gold);
  box-shadow: var(--shadow); border-radius: 8px; padding: 10px 16px; min-width: 240px;
  opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { border-left-color: var(--danger); }
.toast-success { border-left-color: var(--success); }

/* ---------- Misc ---------- */

.muted { color: var(--text-muted); }
.error-text { color: var(--danger); font-size: 13px; margin-top: 6px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-alt); border: 1px solid var(--border); }
.badge-role { color: var(--accent); border-color: var(--gold); }
.badge-unread { color: var(--accent-contrast); background: var(--gold); border-color: var(--gold); }

.spacer { flex: 1; }

@media (max-width: 640px) {
  #app-main { padding: 14px; }
  .app-header { padding: 8px 14px; }
}
