/*
 * Celebration Church Potluck Signup — styles.css
 *
 * Design intent: Warm, light, inviting — "Hawaiian-shirt Sunday" energy.
 * This is a church-facing volunteer coordination tool, not a dark dashboard.
 * Serif headlines (Georgia) anchor the church aesthetic; system sans body
 * keeps form elements readable on phones. Palette centers on warm cream
 * (#faf6f0), deep church-red accents (#7a2c2c), and gold for offline badges.
 *
 * Mobile-first: 375px base (iPhone SE), 768px 2-column grid, 1024px desktop.
 * WCAG AA contrast preserved throughout; focus rings always visible.
 *
 * Sections (in order):
 *   1. CSS Custom Properties (:root)
 *   2. Base Reset
 *   3. Typography
 *   4. Layout
 *   5. Components
 *   6. State Variants
 *   7. Utilities
 *   8. Print Styles
 *   9. Responsive Breakpoints
 */

/* =============================================================
   1. CSS CUSTOM PROPERTIES
   ============================================================= */

:root {
  /* Colors */
  --bg:          #faf6f0;
  --bg-card:     #ffffff;
  --bg-subtle:   #f4ede0;
  --text:        #2a2a2a;
  --text-muted:  #6b6055;
  --accent:      #7a2c2c;
  --accent-hover:#9b3838;
  --gold:        #b89856;
  --gold-light:  #e8dcc0;
  --success:     #2d6a3e;
  --warning:     #8a5b2b;
  --danger:      #a83333;
  --border:      #d8cdb9;
  --shadow:      0 1px 3px rgba(40, 30, 20, 0.08),
                 0 4px 12px rgba(40, 30, 20, 0.04);

  /* Typography */
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-sans:  -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Spacing scale */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  16px;
  --space-4:  24px;
  --space-5:  32px;
  --space-6:  48px;

  /* Border radius */
  --radius:   8px;

  /* Transition */
  --transition: 150ms ease;
}


/* =============================================================
   2. BASE RESET
   ============================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

p {
  margin: 0 0 var(--space-3);
}

/* Remove default button chrome */
button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* Remove default input chrome */
input,
select,
textarea {
  font-family: inherit;
  font-size: 16px; /* Prevents iOS auto-zoom on focus */
  line-height: inherit;
}

a {
  color: var(--accent);
  text-decoration: underline;
}

a:hover {
  color: var(--accent-hover);
}


/* =============================================================
   3. TYPOGRAPHY
   ============================================================= */

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--accent);
  line-height: 1.25;
  margin: 0 0 var(--space-3);
}

h1 {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 700;
}

h2 {
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  font-weight: 700;
}

h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

/* Italic muted description / subtitle */
.subtitle {
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 0;
}


/* =============================================================
   4. LAYOUT
   ============================================================= */

/* Outer page wrapper — centered, padded */
.container {
  width: 100%;
  max-width: 720px;
  margin-inline: auto;
  padding-inline: 20px;
}

/* Main content area stack */
.page-body {
  padding-block: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Item grid — single column on mobile, responsive 2-col on larger screens */
.item-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

/* Category section groups items below their header */
.category-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}


/* =============================================================
   5. COMPONENTS
   ============================================================= */

/* ---- 5a. Page Header ---- */

.page-header {
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  padding-block: var(--space-4);
}

.page-header .church-name {
  font-family: var(--font-serif);
  font-size: clamp(1rem, 3vw, 1.1rem);
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}

.page-header h1 {
  margin-bottom: var(--space-1);
}

/* ---- 5b. Summary Banner ---- */

.summary-banner {
  background-color: var(--gold-light);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--warning);
  font-weight: 600;
  font-size: 0.95rem;
}

.summary-banner::before {
  content: "!";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--warning);
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Banner when all items are covered */
.summary-banner.is-complete {
  background-color: #d4edda;
  border-color: var(--success);
  color: var(--success);
}

.summary-banner.is-complete::before {
  content: "✓";
  border-color: var(--success);
}

/* ---- 5c. Category Section Header ---- */

.category-header {
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--space-1);
}

.category-header h2 {
  margin-bottom: 0;
}

.category-header .category-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---- 5d. Item Card ---- */

.item-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.item-card__name {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.item-card__meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Drag-and-drop reorder visuals for the admin Items tab. The .is-dragging
   row fades out while the user drags it; the .is-drop-target row gets a
   thick accent-coloured top border to indicate "drop will land here". */
.item-drag-handle {
  cursor: grab;
}
.item-editor-row.is-dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.item-editor-row.is-drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  background-color: var(--bg-subtle);
}

/* Per-slot quantity callout. Used when notes lead with a "Per slot:" /
   "Per volunteer:" / "Per person:" label — the JS bolds the label and
   the CSS gives the line a subtle highlight so volunteers know exactly
   what one signup commits to. */
.item-card__per-slot {
  background-color: var(--bg-subtle);
  border-left: 3px solid var(--gold);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.4;
}
.item-card__per-slot strong {
  color: var(--text);
  font-weight: 700;
}

/* Progress label for slot / numeric modes */
.item-card__progress-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

/* Numeric progress bar */
.progress-bar {
  height: 6px;
  border-radius: 3px;
  background-color: var(--bg-subtle);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background-color: var(--accent);
  border-radius: 3px;
  transition: width var(--transition);
  min-width: 0;
}

/* Fully claimed progress fills green */
.is-fully-claimed .progress-bar__fill {
  background-color: var(--success);
}

/* Claimant chip grid (slot mode) */
.claimant-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

/* ---- 5e. Claimant Chip ---- */

.claimant-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 2px var(--space-2);
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
}

.claimant-chip__name {
  font-weight: 600;
}

.claimant-chip__detail {
  color: var(--text-muted);
}

/* Gold badge for coordinator-entered / offline claims */
.badge-gold {
  display: inline-block;
  background-color: var(--gold);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 100px;
  padding: 1px 6px;
  vertical-align: middle;
}

/* ---- 5f. Claim Form ---- */

.claim-form {
  border-top: 1px solid var(--border);
  padding-top: var(--space-2);
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-field label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.form-field .field-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0;
  margin-bottom: 0;
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: var(--bg-card);
  color: var(--text);
  font-size: 16px; /* Prevents iOS zoom */
  transition: border-color var(--transition);
}

.form-field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.form-field input[type="number"] {
  max-width: 120px;
}

/* Form row for name + qty side by side on wider cards */
.form-row {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.form-row .form-field {
  flex: 1;
  min-width: 140px;
}

.form-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* Inline form-row variant: narrow first field (e.g. slot-count input) sits
   next to the submit button on the same horizontal line, button bottom-aligned
   to the input. Wraps to two rows on very narrow viewports. */
.form-row--inline-button {
  align-items: flex-end;
}
.form-row--inline-button .form-field {
  flex: 0 0 auto;
  min-width: auto;
}
.form-row--inline-button .form-field input[type="number"] {
  max-width: 90px;
}
.form-row--inline-button .form-actions {
  flex: 1 1 auto;
  justify-content: flex-end;
}

/* Small italic hint shown below a claim form (e.g. reminder explanation). */
.form-hint {
  margin: var(--space-2) 0 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
}

/* ---- 5g. Buttons ---- */

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: 44px;         /* Mobile tap target */
  padding: 10px var(--space-3);
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition),
              border-color var(--transition);
}

.btn-primary {
  background-color: var(--accent);
  color: #fff;
  border: 2px solid var(--accent);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.btn-secondary {
  background-color: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-secondary:hover {
  background-color: var(--bg-subtle);
  color: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* Focus rings for all interactive elements */
.btn-primary:focus,
.btn-secondary:focus,
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Disabled state */
.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}


/* =============================================================
   6. STATE VARIANTS
   ============================================================= */

/* ---- 6a. Church-provided item ---- */

.item-card.is-church-provided {
  background-color: var(--bg-subtle);
  border-style: dashed;
}

.item-card.is-church-provided .item-card__name {
  font-style: italic;
}

.item-card.is-church-provided .church-provided-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Claim form hidden on church-provided items */
.item-card.is-church-provided .claim-form {
  display: none;
}

/* ---- 6b. Fully claimed item ---- */

.item-card.is-fully-claimed {
  border-color: #b4d6bb;
  background-color: #f0f8f1;
}

.item-card.is-fully-claimed .item-card__name {
  color: var(--success);
}

/* Claim form collapsed once fully claimed */
.item-card.is-fully-claimed .claim-form {
  display: none;
}

/* ---- 6c. Warning / still-needed indicator ---- */

.item-card.needs-volunteers {
  border-left: 4px solid var(--warning);
}

/* ---- 6d. Error state on form fields ---- */

.form-field.has-error label {
  color: var(--danger);
}

.form-field.has-error input {
  border-color: var(--danger);
}

.form-field .field-error {
  font-size: 0.8rem;
  color: var(--danger);
  font-weight: 600;
}


/* =============================================================
   7. UTILITIES
   ============================================================= */

/* Visually hidden — accessible text for screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Text helpers */
.text-muted  { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }

/* Spacing helpers */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }

.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin-block: var(--space-3);
}

/* Inline status pill */
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.pill-success {
  background-color: #d4edda;
  color: var(--success);
}

.pill-warning {
  background-color: var(--gold-light);
  color: var(--warning);
}

.pill-danger {
  background-color: #fde8e8;
  color: var(--danger);
}


/* =============================================================
   8. PRINT STYLES
   ============================================================= */

@media print {
  /* Strip chrome — show only content */
  .page-header .church-name,
  .summary-banner,
  .claim-form,
  nav,
  .btn-primary,
  .btn-secondary {
    display: none !important; /* Intentional: only suppress non-content UI on print */
  }

  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }

  .container {
    max-width: 100%;
    padding-inline: 0;
  }

  .page-header {
    border-bottom: 2px solid #000;
    background: none;
    padding-block: 8pt;
  }

  .page-header h1 {
    color: #000;
    font-size: 18pt;
  }

  .category-header h2 {
    color: #000;
    font-size: 14pt;
    border-bottom: 1px solid #000;
  }

  .item-card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 4pt;
    padding: 6pt 8pt;
  }

  .item-card__name {
    font-size: 11pt;
  }

  .item-card__progress-label {
    font-size: 10pt;
  }

  .progress-bar {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .claimant-chip {
    border: 1px solid #aaa;
    background: none;
  }

  .badge-gold {
    background: none;
    color: #000;
    border: 1px solid #000;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  /* Ensure page breaks between category sections */
  .category-section + .category-section {
    page-break-before: auto;
  }
}


/* =============================================================
   9. RESPONSIVE BREAKPOINTS
   ============================================================= */

/* ---- 768px: 2-column item grid ---- */
@media (min-width: 768px) {
  .container {
    padding-inline: 24px;
  }

  .item-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }

  .form-row {
    flex-wrap: nowrap;
  }

  .form-actions {
    flex-wrap: nowrap;
  }

  .page-header {
    padding-block: var(--space-5);
  }
}

/* ---- 1024px: wider desktop container ---- */
@media (min-width: 1024px) {
  .container {
    max-width: 960px;
  }

  .page-body {
    padding-block: var(--space-5);
    gap: var(--space-5);
  }
}
