/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1a1a1a;
  background: #f5f5f5;
  line-height: 1.5;
}

/* ===== VIEWS ===== */
.view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.view[hidden] {
  display: none;
}

/* ===== INPUT CARD ===== */
.input-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
  padding: 48px 40px;
  max-width: 620px;
  width: 90%;
  text-align: center;
}

.input-card h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #111;
}

.subtitle {
  color: #555;
  font-size: 0.95rem;
  margin-bottom: 28px;
}

.form-group {
  text-align: left;
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.95rem;
  border: 1.5px solid #d0d0d0;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: #4285f4;
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.15);
}

#generate-btn {
  background: #4285f4;
  color: #fff;
  border: none;
  padding: 12px 32px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

#generate-btn:hover {
  background: #3367d6;
}

#generate-btn:disabled {
  background: #a0c0f0;
  cursor: not-allowed;
}

.note {
  margin-top: 16px;
  font-size: 0.8rem;
  color: #888;
}

.error {
  margin-top: 16px;
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  color: #b91c1c;
  font-size: 0.9rem;
  text-align: left;
}

/* ===== LOADING ===== */
.loader-container {
  text-align: center;
  color: #555;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e0e0e0;
  border-top-color: #4285f4;
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== DISPLAY / PRINTABLE CONTENT ===== */
#display-view {
  justify-content: flex-start;
  padding: 20px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 750px;
  margin-bottom: 20px;
}

.toolbar button {
  background: #fff;
  border: 1.5px solid #d0d0d0;
  padding: 8px 18px;
  font-size: 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.toolbar button:hover {
  background: #f0f0f0;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.month-nav span {
  font-weight: 600;
  font-size: 1rem;
  min-width: 160px;
  text-align: center;
}

.month-nav button {
  font-size: 1.2rem;
  padding: 6px 14px;
  font-weight: bold;
}

.toolbar-checkbox {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  color: #555;
  cursor: pointer;
}

#printable-content {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.06);
  padding: 48px 52px;
  max-width: 750px;
  width: 100%;
}

/* ===== SIGN FEED PANEL ===== */
.sign-panel {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.06);
  padding: 28px 32px;
  max-width: 750px;
  width: 100%;
  margin-bottom: 20px;
}

.sign-panel[hidden] {
  display: none;
}

.sign-panel h3 {
  margin-top: 0;
}

.sign-help {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 16px;
}

.sign-options {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.sign-options label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sign-link {
  margin-bottom: 12px;
}

.sign-link-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.sign-link-label small {
  font-weight: 400;
  color: #777;
  margin-left: 6px;
}

.sign-link-row {
  display: flex;
  gap: 8px;
}

.sign-link-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1.5px solid #d0d0d0;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: ui-monospace, Consolas, monospace;
  color: #333;
}

.sign-link-row button {
  background: #fff;
  border: 1.5px solid #d0d0d0;
  padding: 8px 14px;
  font-size: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
}

.sign-link-row button:hover {
  background: #f0f0f0;
}

.sign-exclude input {
  width: 220px;
  padding: 6px 8px;
  border: 1.5px solid #d0d0d0;
  border-radius: 6px;
  font-size: 0.9rem;
}

/* --- Page header: title left, QR right --- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 16px;
}

.page-header-left {
  flex: 1;
}

.page-title {
  text-align: left;
  font-size: 1.7rem;
  font-weight: 700;
  color: #111;
  margin: 0;
}

.page-title-name:not(:empty)::after {
  content: " \2014  ";
  font-weight: 400;
  color: #555;
}

.page-header-qr {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
}

.page-header-qr img,
.page-header-qr canvas {
  width: 80px !important;
  height: 80px !important;
}

.checkbox-group {
  text-align: left;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 400;
  color: #555;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
  margin: 0;
}

h3 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #555;
  margin-bottom: 4px;
}

.section-divider {
  height: 2px;
  background: #222;
  margin-bottom: 16px;
}

#unique-section {
  margin-bottom: 32px;
}

/* --- Event rows --- */
.event-row {
  display: flex;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  gap: 12px;
}

.event-row:last-child {
  border-bottom: none;
}

.event-date {
  flex: 0 0 110px;
  font-weight: 600;
  font-size: 0.92rem;
  color: #222;
  white-space: nowrap;
}

.event-time {
  flex: 0 0 140px;
  font-size: 0.88rem;
  color: #555;
  white-space: nowrap;
}

.event-details {
  flex: 1;
}

.event-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: #111;
}

.event-location {
  font-size: 0.82rem;
  color: #777;
  margin-top: 1px;
}

/* --- Recurring group cards --- */
.recurring-group {
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.recurring-group:last-child {
  border-bottom: none;
}

.rg-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.rg-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #111;
}

.rg-time {
  font-size: 0.88rem;
  color: #555;
}

.rg-pattern {
  font-size: 0.88rem;
  color: #333;
  margin-top: 4px;
}

.rg-dates {
  font-size: 0.88rem;
  color: #555;
  margin-top: 2px;
}

.rg-location {
  font-size: 0.82rem;
  color: #777;
  margin-top: 2px;
}

/* --- Hide locations/descriptions toggle --- */
.hide-locations .event-location,
.hide-locations .rg-location {
  display: none;
}

/* --- Summary footer --- */
.event-summary {
  margin-top: 28px;
  padding-top: 12px;
  border-top: 1px solid #ddd;
  text-align: center;
  font-size: 0.82rem;
  color: #888;
}

/* --- Empty state --- */
.empty-message {
  text-align: center;
  color: #888;
  font-size: 1rem;
  padding: 40px 0;
}

/* ===== PRINT STYLES ===== */
@media print {
  @page {
    size: letter;
    margin: 0;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .no-print,
  .toolbar,
  #input-view,
  #loading-view {
    display: none !important;
  }

  #display-view {
    min-height: auto;
    padding: 0;
  }

  #printable-content {
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    max-width: 100%;
  }

  .print-page {
    padding: 0.65in 0.75in;
  }

  .page-header {
    margin-bottom: 18pt;
  }

  .page-title {
    font-size: 18pt;
  }

  .page-header-qr {
    width: 72px;
    height: 72px;
  }

  .page-header-qr img,
  .page-header-qr canvas {
    width: 72px !important;
    height: 72px !important;
  }

  .split-pages #recurring-section {
    break-before: page;
  }

  h3 {
    font-size: 10pt;
  }

  .section-divider {
    background: #000;
    height: 1.5px;
  }

  .event-row {
    border-bottom-color: #ccc;
  }

  .event-date {
    font-size: 10pt;
  }

  .event-time {
    font-size: 9.5pt;
  }

  .event-name {
    font-size: 10pt;
  }

  .event-location {
    font-size: 8.5pt;
  }

  .recurring-group {
    break-inside: avoid;
    border-bottom-color: #ccc;
  }

  .rg-name {
    font-size: 10pt;
  }

  .rg-time,
  .rg-pattern,
  .rg-dates {
    font-size: 9.5pt;
  }

  .rg-location {
    font-size: 8.5pt;
  }

  .event-summary {
    font-size: 8.5pt;
    border-top-color: #999;
  }
}
