/**
 * Organizer app (app.html) styles - built on top of style.css's
 * variables (--pf-teal etc., see that file's :root block) rather than
 * redefining the palette. Everything here is prefixed .app- to keep it
 * visually/namespace-separate from the guest share page's own classes,
 * even though they're loaded in the same stylesheet cascade on
 * app.html (style.css then app.css - see that file's <link> order).
 */

.app-body {
  padding-bottom: 72px; /* room for the fixed bottom nav */
}

/* Header (shown only once logged in) */
.app-header {
  background: var(--pf-teal);
  color: var(--pf-white);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-header-row {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-header-btn {
  background: rgba(255, 255, 255, 0.14);
  color: var(--pf-white);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.app-header-btn:hover { background: rgba(255, 255, 255, 0.24); }

.app-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 20px 20px;
}

/* Bottom nav */
.app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--pf-white);
  border-top: 1px solid var(--pf-border);
  z-index: 10;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.app-nav-btn {
  flex: 1;
  border: none;
  background: none;
  padding: 12px 0 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--pf-muted);
  cursor: pointer;
  transition: color 0.15s ease;
}
.app-nav-btn:hover { color: var(--pf-teal-dark); }
.app-nav-btn.active { color: var(--pf-teal-dark); box-shadow: inset 0 2px 0 var(--pf-teal); }

/* Login screen */
.app-login-wrap {
  min-height: calc(100vh - 40px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--pf-teal-light) 0%, var(--pf-bg) 260px);
}
.app-login-card {
  position: relative; /* anchors .app-lang-toggle below */
  width: 100%;
  max-width: 360px;
  background: var(--pf-white);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius);
  padding: 32px 28px 28px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(11, 90, 84, 0.1);
}

/* SW/EN toggle (js/app/i18n.js's langToggleHtml) - same idea as the
   guest page's .lang-toggle/.lang-btn (style.css), but those are styled
   for sitting on the teal header bar (white text/border on teal). This
   card is white, so it gets its own lighter variant instead of reusing
   those classes directly. */
.app-lang-toggle { position: absolute; top: 14px; right: 14px; display: flex; gap: 4px; }
.app-lang-btn {
  background: var(--pf-teal-light);
  color: var(--pf-teal-dark);
  border: none;
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 26px;
}
.app-lang-btn.active { background: var(--pf-teal); color: var(--pf-white); }
.app-login-logo {
  display: block;
  margin: 0 auto 14px;
  border-radius: 10px;
}
.app-login-title { margin: 0 0 4px; font-size: 1.6rem; color: var(--pf-teal-dark); }
.app-login-sub { margin: 0 0 20px; color: var(--pf-muted); }
.app-login-astranite {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  text-decoration: none;
  color: var(--pf-muted);
  font-size: 0.85rem;
  /* Was 0.75rem/opacity 0.85 with a 16px icon - a "who built this"
     credit is a normal, expected thing on a login screen (same idea as
     Stripe/Auth0's "powered by" badges), but that combination read as
     too faint/small to actually notice. Sized and darkened up a step;
     still deliberately quieter than the primary "Sign in" button so it
     doesn't compete with it. */
  opacity: 0.92;
  transition: opacity 0.15s ease;
}
.app-login-astranite:hover, .app-login-astranite:focus-visible { opacity: 1; }
.app-login-astranite img { display: block; border-radius: 3px; }

/* Generic forms */
.app-form { display: flex; flex-direction: column; gap: 14px; text-align: left; margin-top: 4px; }
.app-form label { display: flex; flex-direction: column; gap: 5px; font-size: 0.85rem; font-weight: 600; }
.app-form input,
.app-form select,
.app-form textarea {
  font: inherit;
  color: var(--pf-ink);
  padding: 10px 12px;
  border: 1.5px solid var(--pf-input-border);
  border-radius: 7px;
  background: var(--pf-white);
  box-shadow: inset 0 1px 2px rgba(15, 23, 22, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.app-form input::placeholder,
.app-form textarea::placeholder {
  color: #9aa4a2;
}

/* Password show/hide toggle (util.js's passwordFieldHtml/wirePasswordToggle) -
   the input keeps using .app-form input's own styling untouched; this
   just positions a small icon button inside the same box rather than
   introducing a second input style. */
.app-password-wrap { position: relative; display: flex; }
.app-password-wrap input { flex: 1; padding-right: 40px; }
.app-password-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: var(--pf-muted);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
}
.app-password-toggle:hover, .app-password-toggle:focus-visible { color: var(--pf-teal-dark); }
.app-form input:focus,
.app-form select:focus,
.app-form textarea:focus {
  outline: none;
  border-color: var(--pf-teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}
.app-form-row { display: flex; gap: 12px; }
.app-form-row label { flex: 1; }
.app-btn-block { width: 100%; text-align: center; padding: 11px 16px; }
.app-hint { color: var(--pf-muted); font-size: 0.75rem; margin: 2px 0 0; font-weight: normal; }
.app-error-banner {
  background: #f4e4e2;
  color: var(--pf-danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

/* Headers used across list/detail/form screens */
.app-list-header,
.app-form-header,
.app-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 10px;
}
.app-form-header, .app-detail-header { justify-content: flex-start; }
.app-form-header h1, .app-list-header h1 { margin: 0; font-size: 1.3rem; }
.app-back-btn {
  border: none;
  background: var(--pf-teal-light);
  color: var(--pf-teal-dark);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.app-back-btn:hover { background: #d3ebe8; }
.app-detail-header-actions { margin-left: auto; }
.app-icon-btn {
  border: none;
  background: var(--pf-teal-light);
  color: var(--pf-teal-dark);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}
.app-icon-btn:hover { background: #d3ebe8; }
.app-icon-btn--danger { background: #f4e4e2; color: var(--pf-danger); }
.app-icon-btn--danger:hover { background: #ecd0cc; }

.app-detail-title { margin: 4px 0 12px; font-size: 1.4rem; font-weight: 700; }
.app-badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.app-campaign-dates { margin: 0 0 10px; font-size: 0.85rem; }

/* State blocks (loading / empty) */
.app-state { text-align: center; padding: 50px 0; color: var(--pf-muted); }
.app-state--empty { padding: 40px 16px; }

/* Card list (campaigns/events list items) */
.app-card-list { display: flex; flex-direction: column; gap: 10px; }
.app-card {
  background: var(--pf-white);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.app-card:last-child { margin-bottom: 0; }
.app-card--clickable { cursor: pointer; margin-bottom: 0; }
.app-card--clickable:active { background: var(--pf-teal-light); }
.app-card-title { font-weight: 700; margin-bottom: 4px; }
.app-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--pf-muted); font-size: 0.85rem; }
.app-card-row-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.app-card-row-header h2 { margin: 0; font-size: 1.05rem; }

/* Badges (status pills, reused across campaigns/events/dues/flags) */
.app-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.app-badge--success { background: #e3f6e6; color: #1c7a34; }
.app-badge--warning { background: #fff2d9; color: #9a6400; }
.app-badge--danger { background: #f4e4e2; color: var(--pf-danger); }
.app-badge--neutral { background: var(--pf-teal-light); color: var(--pf-teal-dark); }

/* Stat blocks (campaign totals card) */
.app-stat-row { display: flex; gap: 24px; }
.app-stat-label { font-size: 0.75rem; color: var(--pf-muted); margin-bottom: 2px; }
.app-stat-value { font-size: 1.25rem; font-weight: 700; color: var(--pf-teal-dark); }
.app-stat-value--muted { color: var(--pf-muted); }
.app-stat-sub { font-size: 0.75rem; color: var(--pf-muted); margin-top: 2px; }
.app-divider { border: none; border-top: 1px solid var(--pf-border); margin: 14px 0; }
.app-field-label { font-size: 0.8rem; font-weight: 600; color: var(--pf-ink); }

/* Headcount row (event detail) */
.app-headcount-row { display: flex; justify-content: space-around; text-align: center; }
.app-headcount-value { font-size: 1.4rem; font-weight: 700; }
.app-headcount-label { font-size: 0.7rem; color: var(--pf-muted); margin-top: 2px; }

/* Generic list rows (contributions, members, guests, payouts) */
.app-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--pf-border);
}
.app-row:last-child { border-bottom: none; }
.app-row-title { font-weight: 600; }
.app-row-sub { font-size: 0.78rem; color: var(--pf-muted); margin-top: 2px; }
.app-row-amount { font-weight: 700; white-space: nowrap; }
.app-muted { color: var(--pf-muted); }

/* Segmented control (recurrence / collection mode toggles) */
.app-field-group { margin: 4px 0; display: flex; flex-direction: column; gap: 6px; }
.app-segmented { display: flex; border: 1px solid var(--pf-border); border-radius: 8px; overflow: hidden; }
.app-segment {
  flex: 1;
  border: none;
  background: var(--pf-white);
  padding: 9px 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--pf-muted);
  cursor: pointer;
  border-right: 1px solid var(--pf-border);
}
.app-segment:last-child { border-right: none; }
.app-segment.active { background: var(--pf-teal); color: var(--pf-white); }

/* Dues tabs (monthly status, campaign detail) */
.app-dues-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; -webkit-overflow-scrolling: touch; }
.app-dues-tab {
  flex: 0 0 auto;
  background: var(--pf-teal-light);
  color: var(--pf-teal-dark);
  border: none;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.app-dues-tab.active { background: var(--pf-teal); color: var(--pf-white); }
.app-dues-rows .app-row { flex-wrap: wrap; }

/* "Created! share it now" banner (util.js's justCreatedBannerHtml) -
   shown once, right after creating a campaign/event, above the normal
   totals/headcount card. Teal-tinted so it visually leads the page
   without introducing a new color. */
.app-share-banner {
  background: var(--pf-teal-light);
  border-color: var(--pf-teal);
}
.app-share-banner-title { font-weight: 700; color: var(--pf-teal-dark); font-size: 1rem; }
.app-share-banner-link {
  font-size: 0.85rem;
  word-break: break-all;
  background: var(--pf-white);
  border: 1px solid var(--pf-input-border);
  border-radius: 7px;
  padding: 8px 10px;
}

/* Flags */
.app-flag-tile { padding: 10px 0; border-bottom: 1px solid var(--pf-border); }
.app-flag-tile:last-child { border-bottom: none; }
.app-flag-message { font-size: 0.85rem; margin-top: 4px; }
.app-flag-actions { margin-top: 4px; display: flex; gap: 4px; }

@media (max-width: 600px) {
  .app-main { padding: 16px 16px 16px; }
  .app-login-wrap { min-height: calc(100vh - 32px); }
  .app-stat-row { gap: 16px; }
}
