/* KeepWatch Vigil — Shared Stylesheet
   Warm gold/cream Catholic aesthetic, mobile-first */

:root {
  --gold: #C5963A;
  --gold-light: #E8D5A3;
  --gold-dark: #8B6914;
  --cream: #FDF8F0;
  --cream-dark: #F5EBD8;
  --burgundy: #6B1D2A;
  --burgundy-light: #8B3A4A;
  --text: #2C2416;
  --text-light: #6B5D4F;
  --white: #FFFFFF;
  --green: #2D7A3A;
  --green-light: #E8F5E9;
  --yellow: #F9A825;
  --yellow-light: #FFF8E1;
  --red: #C62828;
  --red-light: #FFEBEE;
  --shadow: 0 2px 8px rgba(44, 36, 22, 0.1);
  --shadow-lg: 0 4px 16px rgba(44, 36, 22, 0.15);
  --radius: 8px;
  --radius-lg: 12px;
}

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

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

/* ─── Typography ───────────────────────── */

h1 { font-size: 1.75rem; font-weight: 700; color: var(--burgundy); }
h2 { font-size: 1.35rem; font-weight: 600; color: var(--text); }
h3 { font-size: 1.1rem; font-weight: 600; color: var(--text); }
p { margin-bottom: 0.5rem; }
a { color: var(--burgundy); text-decoration: none; }
a:hover { text-decoration: underline; }
small { color: var(--text-light); font-size: 0.85rem; }

/* ─── Layout ───────────────────────────── */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem;
}

.container-narrow {
  max-width: 500px;
  margin: 0 auto;
  padding: 1rem;
}

/* ─── Header / Nav ─────────────────────── */

.header {
  background: var(--burgundy);
  color: var(--white);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-brand a { color: var(--gold-light); }
.header-brand a:hover { text-decoration: none; opacity: 0.9; }

.header-nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.header-nav a {
  color: var(--gold-light);
  font-size: 0.9rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.header-nav a:hover {
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}

.header-nav a.active {
  background: rgba(255,255,255,0.15);
  font-weight: 600;
}

/* ─── Cards ────────────────────────────── */

.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--cream-dark);
}

/* ─── Module Tiles (Dashboard) ─────────── */

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.module-tile {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border-left: 4px solid var(--gold);
  text-decoration: none;
  color: var(--text);
  display: block;
}

.module-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
}

.module-tile.disabled {
  opacity: 0.5;
  cursor: default;
  border-left-color: #ccc;
}

.module-tile .tile-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.module-tile .tile-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.module-tile .tile-desc {
  font-size: 0.85rem;
  color: var(--text-light);
}

.module-tile .tile-stat {
  margin-top: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold-dark);
}

/* ─── Buttons ──────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-decoration: none;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--burgundy);
  color: var(--white);
}
.btn-primary:hover { background: var(--burgundy-light); color: var(--white); text-decoration: none; }

.btn-gold {
  background: var(--gold);
  color: var(--white);
}
.btn-gold:hover { background: var(--gold-dark); color: var(--white); text-decoration: none; }

.btn-outline {
  background: transparent;
  border: 2px solid var(--burgundy);
  color: var(--burgundy);
}
.btn-outline:hover { background: var(--burgundy); color: var(--white); text-decoration: none; }

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.btn-danger {
  background: var(--red);
  color: var(--white);
}
.btn-danger:hover { background: #B71C1C; }

.btn-success {
  background: var(--green);
  color: var(--white);
}

/* ─── Forms ────────────────────────────── */

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid #D4C9B8;
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: var(--white);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(197, 150, 58, 0.15);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group { flex: 1; }

/* ─── Tables ───────────────────────────── */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--cream-dark);
}

th {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tr:hover { background: var(--cream); }

/* ─── Adoration Schedule Grid ──────────── */

.schedule-grid {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  gap: 2px;
  background: var(--cream-dark);
  border-radius: var(--radius);
  overflow: hidden;
}

.schedule-grid .hour-label {
  background: var(--white);
  padding: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.schedule-grid .day-header {
  background: var(--burgundy);
  color: var(--gold-light);
  padding: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
}

.schedule-grid .slot {
  background: var(--white);
  padding: 0.3rem;
  min-height: 40px;
  font-size: 0.7rem;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.schedule-grid .slot:hover { background: var(--cream); }

.schedule-grid .slot.covered {
  background: var(--green-light);
  border-left: 3px solid var(--green);
}

.schedule-grid .slot.partial {
  background: var(--yellow-light);
  border-left: 3px solid var(--yellow);
}

.schedule-grid .slot.empty {
  background: var(--red-light);
  border-left: 3px solid var(--red);
}

.schedule-grid .slot.inactive {
  background: #F5F5F5;
  color: #bbb;
  cursor: default;
}

.slot .adorer-name {
  display: block;
  font-size: 0.65rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot .adorer-count {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-light);
}

/* ─── Stats / Badges ───────────────────── */

.stat-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.stat-box {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  flex: 1;
  min-width: 130px;
  text-align: center;
}

.stat-box .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--burgundy);
}

.stat-box .stat-label {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.2rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-green { background: var(--green-light); color: var(--green); }
.badge-yellow { background: var(--yellow-light); color: #F57F17; }
.badge-red { background: var(--red-light); color: var(--red); }

/* ─── Modals ───────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--burgundy);
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/* ─── Toast / Alert ────────────────────── */

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--text);
  color: var(--white);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  z-index: 300;
  animation: slideUp 0.3s ease;
}

.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-info { background: #E3F2FD; color: #1565C0; border-left: 4px solid #1565C0; }
.alert-success { background: var(--green-light); color: var(--green); border-left: 4px solid var(--green); }
.alert-warning { background: var(--yellow-light); color: #F57F17; border-left: 4px solid var(--yellow); }
.alert-danger { background: var(--red-light); color: var(--red); border-left: 4px solid var(--red); }

/* ─── Kiosk Mode ───────────────────────── */

body.kiosk-mode {
  background: #1A1210;
  color: var(--cream);
}

.kiosk-time {
  font-size: 4rem;
  font-weight: 200;
  text-align: center;
  color: var(--gold-light);
  margin: 2rem 0 1rem;
}

.kiosk-hour-label {
  font-size: 1.5rem;
  text-align: center;
  color: var(--gold);
  margin-bottom: 2rem;
}

.kiosk-btn {
  display: block;
  width: 100%;
  max-width: 400px;
  margin: 1rem auto;
  padding: 1.5rem;
  font-size: 1.3rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: transform 0.1s;
}

.kiosk-btn:active { transform: scale(0.97); }

.kiosk-btn-primary {
  background: var(--gold);
  color: var(--text);
}

.kiosk-btn-secondary {
  background: rgba(255,255,255,0.1);
  color: var(--gold-light);
  border: 2px solid var(--gold);
}

.kiosk-message {
  text-align: center;
  font-size: 1.2rem;
  color: var(--gold-light);
  margin-top: 2rem;
}

/* ─── Landing Page Hero ────────────────── */

.hero {
  text-align: center;
  padding: 3rem 1rem;
  background: linear-gradient(135deg, var(--burgundy) 0%, #4A1520 100%);
  color: var(--white);
}

.hero h1 {
  font-size: 2.5rem;
  color: var(--gold-light);
  margin-bottom: 0.5rem;
}

.hero .tagline {
  font-size: 1.15rem;
  color: var(--gold-light);
  opacity: 0.9;
  margin-bottom: 2rem;
}

.hero .hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ─── Responsive ───────────────────────── */

@media (max-width: 768px) {
  .form-row { flex-direction: column; gap: 0; }
  .stat-row { gap: 0.5rem; }
  .stat-box { min-width: 100px; }
  .hero h1 { font-size: 1.75rem; }
  .schedule-grid { font-size: 0.65rem; }
  .schedule-grid .hour-label { font-size: 0.65rem; padding: 0.2rem; }
  .header-nav a { font-size: 0.8rem; padding: 0.2rem 0.4rem; }
  .module-grid { grid-template-columns: 1fr; }
}

/* ─── Utility ──────────────────────────── */

.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.hidden { display: none !important; }

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--cream-dark);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
