/*
 * Racing In The Woods — Site-wide Notification Bell
 * -----------------------------------------------------------------
 * Floating bell (bottom-right, every page) that opens a modal for
 * push notifications (Web Push API) and SMS text alerts (Twilio).
 * Scoped entirely under .ritwn-* classes and CSS variables so it
 * can never collide with Divi/theme styles.
 */

.ritwn-scope {
  --ritwn-navy-900: #0B1F3A;
  --ritwn-navy-800: #122A4D;
  --ritwn-navy-700: #1B3B6B;
  --ritwn-red-600: #C8102E;
  --ritwn-red-700: #9E0C24;
  --ritwn-paper: #FFFFFF;
  --ritwn-panel: #F4F5F7;
  --ritwn-border: #DADFE6;
  --ritwn-text: #1B1F27;
  --ritwn-muted: #5B6270;
  --ritwn-warning-bg: #FDF1E7;
  --ritwn-warning-text: #7A3C13;
  --ritwn-success: #2F6B1E;
  --ritwn-error: #9E0C24;
  font-family: 'Satoshi', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ---- Floating bell button ---- */
.ritwn-bell {
  position: fixed;
  right: 20px;
  bottom: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ritwn-navy-800);
  border: none;
  box-shadow: 0 6px 18px rgba(11, 31, 58, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 99990;
  padding: 0;
  transition: background 0.15s ease, transform 0.15s ease;
}
.ritwn-bell:hover { background: var(--ritwn-navy-900); transform: translateY(-1px); }
.ritwn-bell:focus-visible { outline: 3px solid var(--ritwn-red-600); outline-offset: 3px; }
.ritwn-bell svg { width: 24px; height: 24px; fill: #fff; }
.ritwn-bell__dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ritwn-red-600);
  border: 2px solid var(--ritwn-navy-800);
  display: none;
}
.ritwn-bell[data-status="off"] .ritwn-bell__dot { display: block; }

/* ---- Overlay + modal ---- */
.ritwn-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 24, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99995;
  padding: 16px;
}
.ritwn-overlay.is-open { display: flex; }

.ritwn-modal {
  background: var(--ritwn-paper);
  color: var(--ritwn-text);
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(11, 15, 24, 0.35);
}

.ritwn-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--ritwn-border);
}
.ritwn-modal__header h2 {
  font-family: 'Switzer', sans-serif;
  font-weight: 700;
  font-size: 20px;
  margin: 0;
  color: var(--ritwn-navy-900);
}
.ritwn-modal__close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  line-height: 0;
  color: var(--ritwn-muted);
  border-radius: 6px;
}
.ritwn-modal__close:hover { background: var(--ritwn-panel); color: var(--ritwn-text); }
.ritwn-modal__close svg { width: 18px; height: 18px; }

.ritwn-modal__intro {
  padding: 14px 20px 4px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ritwn-muted);
  margin: 0;
}

.ritwn-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--ritwn-border);
}
.ritwn-section:last-of-type { border-bottom: none; }
.ritwn-section h3 {
  font-family: 'Switzer', sans-serif;
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 10px;
  color: var(--ritwn-navy-900);
}

.ritwn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.ritwn-row__label { font-size: 14px; font-weight: 600; color: var(--ritwn-text); }

/* ---- Buttons ---- */
.ritwn-btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  border-radius: 8px;
  padding: 9px 16px;
  border: 1.5px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.ritwn-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ritwn-btn--red { background: var(--ritwn-red-600); color: #fff; }
.ritwn-btn--red:hover:not(:disabled) { background: var(--ritwn-red-700); }
.ritwn-btn--navy { background: var(--ritwn-navy-800); color: #fff; }
.ritwn-btn--navy:hover:not(:disabled) { background: var(--ritwn-navy-900); }
.ritwn-btn--outline { background: transparent; border-color: var(--ritwn-navy-700); color: var(--ritwn-navy-800); }
.ritwn-btn--outline:hover:not(:disabled) { background: var(--ritwn-panel); }
.ritwn-btn--outline.is-active { background: var(--ritwn-navy-800); color: #fff; border-color: var(--ritwn-navy-800); }
.ritwn-btn--block { width: 100%; }

.ritwn-testbtn { margin-top: 8px; }

/* ---- iOS install note ---- */
.ritwn-ios-note {
  margin-top: 10px;
  background: var(--ritwn-warning-bg);
  color: var(--ritwn-warning-text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.5;
}
.ritwn-ios-note strong { font-weight: 700; }
.ritwn-ios-note ol { margin: 6px 0 0; padding-left: 18px; }
.ritwn-ios-note p.ritwn-ios-note__fallback { margin: 8px 0 0; font-weight: 600; }

/* ---- SMS fields ---- */
.ritwn-field { margin-bottom: 10px; }
.ritwn-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ritwn-muted);
  margin-bottom: 5px;
}
.ritwn-field input[type="tel"] {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--ritwn-border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ritwn-text);
}
.ritwn-field input[type="tel"]:focus { outline: none; border-color: var(--ritwn-navy-700); }

.ritwn-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}
.ritwn-checkbox-row input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--ritwn-red-600);
  flex-shrink: 0;
}
.ritwn-checkbox-row p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ritwn-muted);
}
.ritwn-checkbox-row a { color: var(--ritwn-navy-800); font-weight: 600; text-decoration: underline; }

.ritwn-status {
  font-size: 12.5px;
  font-weight: 600;
  margin-top: 8px;
  min-height: 16px;
}
.ritwn-status.is-success { color: var(--ritwn-success); }
.ritwn-status.is-error { color: var(--ritwn-error); }

/* ---- Mobile: bottom sheet ---- */
@media (max-width: 480px) {
  .ritwn-overlay { align-items: flex-end; padding: 0; }
  .ritwn-modal {
    max-width: 100%;
    max-height: 88vh;
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .ritwn-bell { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); }
}