/* TrackingMass.com — Stylesheet */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream: #faf8f5;
  --gold: #b5831a;
  --gold-light: #f5ecd4;
  --gold-dark: #8a6010;
  --navy: #1a2540;
  --navy-light: #2d3d6b;
  --text: #1c1c1e;
  --text-secondary: #6b6b6b;
  --text-muted: #a0a0a0;
  --border: #e5e0d6;
  --border-strong: #ccc6b8;
  --surface: #ffffff;
  --surface-alt: #f7f4ef;
  --red: #c0392b;
  --red-light: #fdf0ee;
  --green: #2d7a4f;
  --green-light: #edf7f1;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.5;
}

/* ---- LOGIN ---- */
#login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-cross {
  font-size: 3rem;
  margin-bottom: 1rem;
}
.login-card h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: .25rem;
}
.login-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}
.login-error {
  font-size: 13px;
  color: var(--red);
  margin-bottom: 1rem;
  min-height: 20px;
}

/* ---- APP SHELL ---- */
#app { display: none; }

header {
  background: var(--navy);
  color: #fff;
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-brand .cross { font-size: 1.4rem; }
.header-brand h1 { font-size: 1.1rem; font-weight: 600; letter-spacing: .01em; }
.header-brand span { font-size: 12px; color: rgba(255,255,255,.5); display: block; }
.btn-logout {
  background: rgba(255,255,255,.12);
  border: none;
  color: rgba(255,255,255,.8);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.btn-logout:hover { background: rgba(255,255,255,.2); }

/* ---- TABS ---- */
.tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  padding: 0 1rem;
}
.tab-btn {
  padding: .75rem 1.25rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn.active {
  color: var(--gold-dark);
  border-bottom-color: var(--gold);
}

/* ---- MAIN CONTENT ---- */
main { padding: 1rem; max-width: 600px; margin: 0 auto; }

/* ---- STATS BAR ---- */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 1rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem;
  text-align: center;
}
.stat-number { font-size: 1.5rem; font-weight: 600; color: var(--navy); }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ---- SECTION LABELS ---- */
.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 1.25rem 0 .5rem;
}

/* ---- MASS CARDS ---- */
.mass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.mass-card.past { opacity: .75; }
.mass-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .5rem;
}
.mass-church-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
}
.mass-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.mass-badge.upcoming { background: var(--green-light); color: var(--green); }
.mass-badge.past { background: var(--surface-alt); color: var(--text-muted); }
.mass-badge.today { background: var(--gold-light); color: var(--gold-dark); }

.mass-meta { margin-top: .5rem; display: flex; flex-direction: column; gap: 4px; }
.mass-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.mass-meta-row svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-muted); }

.mass-notes {
  margin-top: .75rem;
  padding: .6rem .75rem;
  background: var(--surface-alt);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  border-left: 3px solid var(--gold);
  white-space: pre-wrap;
}

.mass-actions {
  display: flex;
  gap: 8px;
  margin-top: .75rem;
}
.btn-edit, .btn-delete {
  padding: 5px 14px;
  font-size: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-secondary);
}
.btn-edit:hover { background: var(--surface-alt); }
.btn-delete:hover { background: var(--red-light); color: var(--red); border-color: #f5c6c2; }

/* ---- MAP / LIST VIEW ---- */
.map-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.map-pin-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.2rem;
}
.map-info { flex: 1; min-width: 0; }
.map-church { font-weight: 600; color: var(--navy); font-size: 15px; }
.map-address { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.map-times { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.map-time-pill {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--gold-light);
  color: var(--gold-dark);
}

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state p { font-size: 14px; }

/* ---- FAB ---- */
.fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  border: none;
  font-size: 1.75rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(181,131,26,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: transform .15s, background .15s;
}
.fab:hover { background: var(--gold-dark); transform: scale(1.05); }

/* ---- MODAL ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem 1.25rem 2rem;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}
.modal-title { font-size: 1.1rem; font-weight: 600; color: var(--navy); }
.btn-close {
  background: var(--surface-alt);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- FORM ---- */
.form-row { margin-bottom: 1rem; }
.form-row label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(181,131,26,.15);
}
.form-row textarea { height: 120px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

.btn-save {
  width: 100%;
  padding: .85rem;
  background: var(--gold);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin-top: .5rem;
}
.btn-save:hover { background: var(--gold-dark); }

/* ---- TOAST ---- */
.toast {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: #fff;
  padding: .6rem 1.25rem;
  border-radius: 20px;
  font-size: 14px;
  opacity: 0;
  transition: all .3s;
  z-index: 300;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Inputs for login */
.input-wrap { position: relative; margin-bottom: 1rem; }
.input-wrap input {
  width: 100%;
  padding: .7rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
.input-wrap input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(181,131,26,.15); }
.btn-primary {
  width: 100%;
  padding: .8rem;
  background: var(--gold);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary:hover { background: var(--gold-dark); }

/* ---- TYPE SELECTOR ---- */
.type-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 1.25rem;
}
.type-btn {
  flex: 1;
  padding: .6rem .75rem;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.type-btn.active.mass  { background: var(--gold-light); border-color: var(--gold); color: var(--gold-dark); }
.type-btn.active.visit { background: #e8f0fe; border-color: #4a6fcf; color: #2a4da0; }

/* ---- MASSTIMES BAR ---- */
.masstimes-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem 1rem;
  margin-bottom: 1rem;
  text-align: center;
}
.masstimes-bar a,
.masstimes-link {
  color: var(--navy);
  text-decoration: none;
  font-size: 14px;
}
.masstimes-bar a:hover,
.masstimes-link:hover { text-decoration: underline; color: var(--gold-dark); }

/* ---- VISIT CARD VARIANT ---- */
.mass-card.visit {
  border-left: 4px solid #4a6fcf;
}
.mass-card.mass-entry {
  border-left: 4px solid var(--gold);
}
.mass-badge.visit-badge {
  background: #e8f0fe;
  color: #2a4da0;
}

/* ---- CHURCHES TAB ---- */
.church-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: .75rem;
  overflow: hidden;
}
.church-group-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}
.church-icon {
  font-size: 1.4rem;
  width: 38px;
  text-align: center;
}
.church-name-main {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
}
.church-location {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}
.church-entries {
  padding: .5rem 0;
}
.church-entry-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem 1.25rem;
}
.church-entry-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.church-entry-dot.mass-dot  { background: var(--gold); }
.church-entry-dot.visit-dot { background: #4a6fcf; }
.church-entry-text {
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
}
.church-entry-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
}
.church-entry-badge.mass-eb  { background: var(--gold-light); color: var(--gold-dark); }
.church-entry-badge.visit-eb { background: #e8f0fe; color: #2a4da0; }

/* ---- LEGEND ---- */
.legend {
  display: flex;
  gap: 1rem;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: .75rem;
  align-items: center;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

/* ---- USERNAME INPUT on login ---- */
#username-input {
  width: 100%;
  padding: .7rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  margin-bottom: 0;
}
#username-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(181,131,26,.15);
}
