/**
 * SignupWrangler — Public Signup Interface
 *
 * Design: Mobile-first, accessible, USWDS-inspired.
 * Colors: Success #00a32a, Warning #b45309, Error #b50909, Info #2271b1
 * Focus: 2px solid outline with 2px offset (USWDS focus pattern)
 * Border radius: 4px (USWDS default)
 * Font: system stack (inherits from theme)
 */

/* ═══ Reset & Container ═══ */
.suw-public { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: #1b1b1b; max-width: 860px; line-height: 1.5; }
.suw-public *, .suw-public *::before, .suw-public *::after { box-sizing: border-box; }
.suw-public :focus-visible { outline: 2px solid #2271b1; outline-offset: 2px; }
.suw-public a { color: #2271b1; }
.suw-public a:hover { color: #0e4f8b; }

/* ═══ Messages & Notices ═══ */
.suw-notice { padding: 12px 16px; border-radius: 4px; margin-bottom: 16px; font-size: 14px; border-left: 4px solid; }
.suw-notice--success { background: #ecfdf5; border-left-color: #00a32a; color: #065f46; }
.suw-notice--error   { background: #fef2f2; border-left-color: #b50909; color: #7f1d1d; }
.suw-notice--warning { background: #fffbeb; border-left-color: #b45309; color: #78350f; }
.suw-notice--info    { background: #eff6ff; border-left-color: #2271b1; color: #1e3a5f; }

/* ═══ Auth Bar ═══ */
.suw-auth { padding: 16px 20px; border-radius: 4px; margin-bottom: 20px; font-size: 15px; }
.suw-auth--in  { background: #ecfdf5; border: 1px solid #86efac; }
.suw-auth--out { background: #f8fafc; border: 1px solid #cbd5e1; }
.suw-auth__check { color: #00a32a; font-weight: 700; margin-right: 4px; }
.suw-auth__email { font-weight: 600; }
.suw-auth__toprow { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.suw-auth__actions { display: flex; gap: 12px; align-items: center; font-size: 13px; }
.suw-auth__edit-toggle { background: none; border: none; color: #065f46; text-decoration: underline; cursor: pointer; font-size: 13px; padding: 0; }
.suw-auth__edit-toggle:hover { color: #047857; }
.suw-auth__signout { color: #6b7280; text-decoration: none; font-size: 13px; }
.suw-auth__signout:hover { color: #b50909; text-decoration: underline; }
.suw-auth__profile { margin-top: 14px; padding-top: 14px; border-top: 1px solid #a7f3d0; }
.suw-auth__profile-grid { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 10px; margin-bottom: 10px; }
.suw-auth__profile-field label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; color: #065f46; margin-bottom: 2px; }
.suw-auth__profile-field input[type="text"],
.suw-auth__profile-field input[type="tel"] { width: 100%; padding: 7px 10px; border: 1px solid #86efac; border-radius: 4px; font-size: 14px; background: #fff; }
.suw-auth__profile-field input:focus { border-color: #2271b1; outline: none; box-shadow: 0 0 0 1px #2271b1; }
.suw-auth__profile-field--radio { display: flex; flex-direction: column; justify-content: center; }
.suw-auth__profile-field--radio label { margin-bottom: 4px; }
.suw-auth__profile-field--radio span label { font-size: 13px; text-transform: none; font-weight: 400; display: inline-flex; align-items: center; gap: 3px; cursor: pointer; }
.suw-auth__profile-actions { display: flex; gap: 8px; align-items: center; }
.suw-auth__prompt { display: block; font-weight: 600; margin-bottom: 10px; font-size: 15px; }
.suw-auth__row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.suw-auth__input { padding: 10px 14px; border: 2px solid #cbd5e1; border-radius: 4px; font-size: 15px; width: 300px; max-width: 100%; transition: border-color .15s; }
.suw-auth__input:focus { border-color: #2271b1; box-shadow: 0 0 0 1px #2271b1; outline: none; }
.suw-auth__btn { padding: 10px 20px; background: #2271b1; color: #fff; border: 2px solid #2271b1; border-radius: 4px; font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s; }
.suw-auth__btn:hover { background: #0e4f8b; border-color: #0e4f8b; }

/* ═══ Event Header ═══ */
.suw-event-hdr { margin-bottom: 24px; }
.suw-event-hdr__title { font-size: 26px; font-weight: 700; margin: 0 0 6px; color: #1b1b1b; }
.suw-event-hdr__date { font-size: 16px; color: #3d4551; font-weight: 500; }
.suw-event-hdr__desc { margin: 12px 0 0; line-height: 1.65; color: #3d4551; }

/* ═══ Filter Bar ═══ */
.suw-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 10px 16px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 4px; margin-bottom: 20px; }
.suw-filters__select { padding: 8px 12px; border: 1px solid #94a3b8; border-radius: 4px; font-size: 14px; background: #fff; }
.suw-filters__toggle { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; user-select: none; }
.suw-filters__toggle input { width: 18px; height: 18px; accent-color: #2271b1; }

/* ═══ Location Card ═══ */
.suw-loc { margin-bottom: 24px; border: 1px solid #d1d5db; border-radius: 4px; overflow: hidden; }
.suw-loc__hdr { padding: 14px 20px; background: #1e3a5f; color: #fff; display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 6px; }
.suw-loc__hdr-left { flex: 1; min-width: 0; }
.suw-loc__hdr-right { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.suw-loc__name { font-size: 17px; font-weight: 700; margin: 0; }
.suw-loc__addr { font-size: 13px; opacity: .8; margin-top: 2px; }
.suw-loc__tag { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; background: rgba(255,255,255,.2); color: #fff; }

/* ═══ Slot Table ═══ */
.suw-slots { width: 100%; border-collapse: collapse; font-size: 14px; }
.suw-slots thead { display: none; } /* show on desktop */
.suw-slots th { text-align: left; padding: 8px 16px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: #6b7280; background: #f9fafb; border-bottom: 1px solid #e5e7eb; }
.suw-slots td { padding: 12px 16px; border-bottom: 1px solid #f3f4f6; vertical-align: top; text-align: left; }
.suw-slots tr { transition: background .15s; }
.suw-slots tbody tr:hover { background: #f8fafc; }
.suw-slots tbody tr.suw-row-flash { animation: suw-flash .8s ease-out; }
@keyframes suw-flash { 0% { background: #dbeafe; } 100% { background: transparent; } }

/* Slot row: left accent border for status */
.suw-slots tr[data-avail="0"] { border-left: 3px solid #d1d5db; }
.suw-slots tr[data-status="available"] { border-left: 3px solid #00a32a; }
.suw-slots tr[data-status="mine"] { border-left: 3px solid #2271b1; background: #eff6ff; }

/* Slot info */
.suw-slot__title { font-weight: 600; color: #1b1b1b; }
.suw-slot__time { color: #3d4551; white-space: nowrap; }
.suw-slot__desc { font-size: 12px; color: #6b7280; margin-top: 2px; }
.suw-slot__names { font-size: 13px; color: #6b7280; margin-top: 4px; }
.suw-slot__names strong { color: #374151; font-weight: 500; }

/* Status badge */
.suw-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.suw-badge--avail { background: #dcfce7; color: #166534; }
.suw-badge--partial { background: #fef9c3; color: #854d0e; }
.suw-badge--full { background: #f3f4f6; color: #6b7280; }
.suw-badge--mine { background: #dbeafe; color: #1e40af; }

/* ═══ Action Buttons ═══ */
.suw-btn { display: inline-block; padding: 7px 16px; font-size: 13px; font-weight: 600; border-radius: 4px; cursor: pointer; text-decoration: none; border: 2px solid; transition: all .15s; text-align: center; line-height: 1.3; }
.suw-btn:focus-visible { outline: 2px solid #2271b1; outline-offset: 2px; }
.suw-btn--signup { background: #00a32a; border-color: #00a32a; color: #fff; }
.suw-btn--signup:hover { background: #008a20; border-color: #008a20; color: #fff; }
.suw-btn--withdraw { background: #fff; border-color: #b50909; color: #b50909; }
.suw-btn--withdraw:hover { background: #b50909; color: #fff; }
.suw-btn--cancel { background: #fff; border-color: #94a3b8; color: #475569; }
.suw-btn--cancel:hover { background: #f1f5f9; border-color: #64748b; }
.suw-btn--confirm { background: #2271b1; border-color: #2271b1; color: #fff; }
.suw-btn--confirm:hover { background: #0e4f8b; border-color: #0e4f8b; color: #fff; }
.suw-btn--signin { background: #f8fafc; border-color: #94a3b8; color: #475569; font-size: 12px; padding: 4px 10px; }
.suw-btn--signin:hover { border-color: #2271b1; color: #2271b1; }
.suw-btn--disabled { background: #f3f4f6; border-color: #d1d5db; color: #9ca3af; cursor: not-allowed; }

/* ═══ Inline Signup Form (expands below row) ═══ */
.suw-inline-form { padding: 16px 20px; background: #f8fafc; border-bottom: 1px solid #e5e7eb; animation: suw-slidedown .2s ease-out; }
.suw-inline-form__hdr { font-size: 14px; color: #374151; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #e5e7eb; }
.suw-inline-form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.suw-inline-form__field label { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .3px; }
.suw-inline-form__field input[type="text"],
.suw-inline-form__field input[type="email"],
.suw-inline-form__field input[type="tel"] { width: 100%; padding: 8px 12px; border: 2px solid #d1d5db; border-radius: 4px; font-size: 14px; transition: border-color .15s; }
.suw-inline-form__field input:focus { border-color: #2271b1; box-shadow: 0 0 0 1px #2271b1; outline: none; }
.suw-inline-form__field--radio { display: flex; gap: 16px; align-items: center; padding-top: 22px; }
.suw-inline-form__field--radio label { text-transform: none; font-weight: 400; font-size: 14px; display: flex; align-items: center; gap: 4px; cursor: pointer; margin-bottom: 0; }
.suw-inline-form__actions { display: flex; gap: 8px; align-items: center; }
.suw-inline-form__spinner { width: 20px; height: 20px; border: 3px solid #e5e7eb; border-top-color: #2271b1; border-radius: 50%; animation: suw-spin .6s linear infinite; display: none; }
.suw-inline-form__msg { font-size: 13px; min-height: 0; }
@keyframes suw-spin { to { transform: rotate(360deg); } }
@keyframes suw-slidedown { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 300px; } }

/* ═══ Event List ═══ */
.suw-evtlist__item { padding: 16px 0; border-bottom: 1px solid #e5e7eb; }
.suw-evtlist__item:last-child { border-bottom: none; }
.suw-evtlist__title { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
.suw-evtlist__title a { text-decoration: none; color: #1b1b1b; }
.suw-evtlist__title a:hover { color: #2271b1; }
.suw-evtlist__meta { font-size: 14px; color: #6b7280; }

/* ═══ My Signups ═══ */
.suw-mysignups { margin-top: 4px; }
.suw-mysignups__item { padding: 10px 0; border-bottom: 1px solid #f3f4f6; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.suw-mysignups__item:last-child { border-bottom: none; }

/* ═══ Closed / Test Mode ═══ */
.suw-closed { padding: 16px 20px; background: #f3f4f6; border: 1px solid #d1d5db; border-radius: 4px; color: #6b7280; font-size: 15px; text-align: center; }
.suw-test-mode { background: #fffbeb; border: 1px solid #fde68a; color: #78350f; padding: 12px 16px; border-radius: 4px; }

/* ═══ Responsive: Desktop ═══ */
@media (min-width: 641px) {
  .suw-slots thead { display: table-header-group; }
  .suw-slots td:before { display: none; } /* hide mobile labels */
}

/* ═══ Responsive: Mobile ═══ */
@media (max-width: 640px) {
  .suw-public { font-size: 15px; }
  .suw-event-hdr__title { font-size: 22px; }

  /* Stacked table rows */
  .suw-slots, .suw-slots thead, .suw-slots tbody, .suw-slots th, .suw-slots td, .suw-slots tr { display: block; }
  .suw-slots thead { position: absolute; top: -9999px; left: -9999px; }
  .suw-slots tr { padding: 12px 16px; margin-bottom: 1px; border-left-width: 4px !important; position: relative; }
  .suw-slots td { padding: 3px 0; border: none; }
  .suw-slots td:before { content: attr(data-label); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; color: #6b7280; display: block; margin-bottom: 1px; }
  .suw-slots td.suw-td-actions { padding-top: 8px; }

  /* Inline form: single column */
  .suw-inline-form__grid { grid-template-columns: 1fr; }
  .suw-inline-form__field--radio { padding-top: 0; }

  /* Auth */
  .suw-auth__input { width: 100%; }
  .suw-auth__row { flex-direction: column; align-items: stretch; }
  .suw-auth__btn { text-align: center; }
  .suw-auth__toprow { flex-direction: column; align-items: flex-start; }
  .suw-auth__profile-grid { grid-template-columns: 1fr 1fr; }

  /* Filters */
  .suw-filters { flex-direction: column; align-items: stretch; }
  .suw-filters__select { width: 100%; }

  /* Location card header */
  .suw-loc__hdr { padding: 12px 16px; }
}
