/* ==========================================================================
   Troop 33 shared theme — matches www.troop33.org (navy / off-white / Lato).
   BYTE-IDENTICAL across every app. Edit here, then copy to all apps with:
     deploy-all-apps style fan-out (cp apps/activities/theme.css into each app dir).
   App-specific rules (table widths, forms, per-app cards) live in each app's
   own styles.css. Override --container-max there; never edit this file per-app.
   ========================================================================== */

:root {
  --navy: #02133e;
  --navy-light: #0a3161;
  --bg: #f9f9f9;
  --ink: #1c1c1c;
  --muted: #666;
  --line: #e9ecef;
  --beta: #ff9800;
  --container-max: 1200px;
  --masthead-h: 44px;
  --shadow-navy: rgba(2, 19, 62, 0.18);
}

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

body {
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  padding: 20px;
  padding-top: 64px; /* clear the fixed beta-notice */
}

/* Beta notice banner (injected by layout.js) ------------------------------- */
.beta-notice {
  background: var(--beta);
  color: #fff;
  padding: 12px 20px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.beta-notice a {
  color: #fff;
  text-decoration: underline;
  font-weight: 600;
}

.beta-notice a:hover {
  color: #fff3e0;
}

/* Masthead (injected by layout.js) — the troop top bar on every app -------- */
.masthead {
  max-width: var(--container-max);
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  border-radius: 12px;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 10px 30px var(--shadow-navy);
}

.masthead a {
  display: inline-flex;
  line-height: 0;
}

.masthead-logo {
  height: var(--masthead-h);
  width: auto;
  display: block;
}

.masthead-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

#t33-user-email {
  color: #fff;
  opacity: 0.9;
  font-size: 14px;
}

.masthead-logout {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.masthead-logout:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Layout primitives -------------------------------------------------------- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.content {
  padding: 30px;
}

.screen {
  padding: 60px 40px;
  text-align: center;
}

.page-title {
  color: var(--ink);
  font-size: 28px;
  margin-bottom: 6px;
}

.subtitle,
.page-subtitle {
  color: var(--muted);
  font-size: 16px;
  margin-bottom: 24px;
}

.user-email {
  font-size: 14px;
  opacity: 0.9;
}

/* Loading spinner ---------------------------------------------------------- */
.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--navy);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Buttons ------------------------------------------------------------------ */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--navy);
  color: #fff;
}

.btn-primary:hover {
  background: var(--navy-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-navy);
}

.btn-secondary {
  background: #f1f3f5;
  color: #333;
}

.btn-secondary:hover {
  background: #e9ecef;
}

.btn-small {
  padding: 8px 16px;
  font-size: 14px;
}

.btn-success {
  background: #28a745;
  color: #fff;
}

.btn-success:hover {
  background: #218838;
}

.btn-success:disabled {
  background: #94d3a2;
  cursor: not-allowed;
}

.btn-danger {
  background: #dc3545;
  color: #fff;
}

.btn-danger:hover {
  background: #c82333;
}

/* Google sign-in button ---------------------------------------------------- */
.google-btn {
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.google-btn:hover {
  background: var(--navy-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-navy);
}

.google-icon {
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 3px;
  padding: 2px;
}

/* Auth / sign-in screen ---------------------------------------------------- */
.auth-screen {
  text-align: center;
  padding: 56px 40px;
}

.auth-patch {
  width: 140px;
  height: auto;
  margin: 0 auto 20px;
  display: block;
}

.auth-screen h1,
.auth-screen h2 {
  color: var(--ink);
  font-size: 28px;
  margin-bottom: 10px;
}

/* Responsive --------------------------------------------------------------- */
@media (max-width: 768px) {
  .container {
    border-radius: 0;
  }

  .content {
    padding: 20px;
  }

  .masthead {
    border-radius: 0;
  }

  .btn {
    width: 100%;
  }
}

/* Data-table tools --------------------------------------------------------- */
/* Shared styling for the resizable / sortable / hideable table columns driven
   by table-tools.js. Used by the table apps (medical-records, roster-viewer,
   reimbursement-viewer); harmless where there are no tables. Those apps set
   position: relative (or sticky) on their <th> so the handle can anchor. */

/* Draggable column resize handle (a <span class="resize-handle"> inside each th). */
th .resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 1;
}

th .resize-handle:hover {
  background: #02133e;
}

th.resizing {
  user-select: none;
}

/* Sort-direction indicators (add class "sortable" + data-sort-key to a <th>). */
th.sortable::after {
  content: ' \2195'; /* ↕ */
  opacity: 0.3;
}

th.sortable.sorted-asc::after {
  content: ' \2191'; /* ↑ */
  opacity: 1;
}

th.sortable.sorted-desc::after {
  content: ' \2193'; /* ↓ */
  opacity: 1;
}

/* "Columns" show/hide dropdown. */
.columns-toggle {
  padding: 8px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fff;
  color: #333;
  font-size: 14px;
  cursor: pointer;
}

.columns-toggle:hover {
  background: #f2f4f8;
}

.columns-dropdown {
  position: relative;
  display: inline-block;
}

.columns-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 20;
  margin-top: 4px;
  min-width: 180px;
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 6px;
}

.columns-menu-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 4px;
}

.columns-menu-item:hover {
  background: #f2f4f8;
}

.columns-menu-item input {
  cursor: pointer;
}
