/*
 * Project:        Trans-Allegheny Lunatic Asylum Information Systems (TIS)
 *
 * Copyright (c) 2010-present
 * Joseph Daniel DiFerio
 * All rights reserved.
 *
 * OWNERSHIP NOTICE
 * This source code, including all associated intellectual property, design,
 * architecture, and derivative works, is the exclusive property of
 * Joseph Daniel DiFerio (the "Author"). No ownership or authorship is
 * transferred by possession, use, or access to this source code.
 *
 * LICENSE NOTICE
 * Use, modification, and operation of this software are permitted only as
 * expressly authorized by the LICENSE.txt included with this project.
 * If the LICENSE.txt is missing or unavailable, you are not authorized to use,
 * copy, modify, or distribute this software.
 *
 * DATA & INFRASTRUCTURE OWNERSHIP
 * All data stored, processed, or generated by this software, and all hardware
 * and infrastructure on which it operates, are and shall remain the exclusive
 * property of Trans-Allegheny Lunatic Asylum (TALA). Ownership of data or
 * infrastructure does not imply ownership of this software.
 *
 * NO WORK-FOR-HIRE / INDEPENDENT AUTHOR
 * This software was not created as a work-for-hire. The Author is not an
 * employee, contractor, or agent of Trans-Allegheny Lunatic Asylum (TALA)
 * with respect to the creation of this software.
 *
 * RESTRICTIONS (SUMMARY)
 * No sublicensing, redistribution, publication, or transfer of successor
 * development rights is granted except as expressly permitted by LICENSE.txt.
 *
 * DO NOT REMOVE OR ALTER THIS NOTICE.
 */

body.waiverBody {
  margin: 0;
  background:
    radial-gradient(circle at top, rgba(120, 18, 28, 0.22), transparent 36%),
    linear-gradient(180deg, #191510 0%, #2c261d 40%, #120f0b 100%);
  color: #221e17;
  font-family: Georgia, 'Times New Roman', serif;
}

a { color: #6d0f1e; }

a:hover { color: #3e0912; }

.waiverPage {
  min-height: 100vh;
  padding: 16px 12px 28px;
}

.waiverShell {
  max-width: 760px;
  margin: 0 auto;
}

.waiverHero,
.waiverFooter,
.waiverPanel,
.waiverMessage {
  background: rgba(248, 243, 229, 0.96);
  border: 1px solid rgba(26, 68, 108, 0.32);
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.waiverHero,
.waiverFooter,
.waiverMessage {
  padding: 18px;
}

.waiverConfirmOverlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 12, 8, 0.58);
  z-index: 1200;
}

.waiverConfirmDialog {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 24px));
  z-index: 1201;
}

.waiverConfirmCard {
  background: rgba(248, 243, 229, 0.98);
  border: 1px solid rgba(26, 68, 108, 0.32);
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
  padding: 18px;
}

.waiverConfirmTitle {
  margin: 0 0 10px;
  color: #1a446c;
  font-size: 24px;
  line-height: 1.15;
}

.waiverConfirmMessage {
  margin: 0;
  color: #3b3125;
  font-size: 16px;
  line-height: 1.5;
}

.waiverConfirmActions {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.waiverBtnDanger {
  background: linear-gradient(180deg, #8d0d19 0%, #640815 100%);
  color: #fff7f7;
}

.waiverHero {
  margin-bottom: 14px;
  text-align: center;
}

.waiverHeroTopRow {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin-bottom: 10px;
}

.waiverHeroActions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 24px;
}

.waiverHeroActions.is-internal {
  justify-content: flex-end;
}

.waiverHeroBrandWrap {
  position: relative;
  min-height: 96px;
  margin-bottom: 10px;
}

.waiverHeroBrand {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: block;
  max-height: 132px;
  width: auto;
  max-width: min(100%, 420px);
  object-fit: contain;
  pointer-events: none;
  z-index: 0;
}

.waiverHeroUtility {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid rgba(26, 68, 108, 0.4);
  border-radius: 999px;
  background: rgba(248, 243, 229, 0.76);
  color: #1a446c;
  text-decoration: none;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(3px);
  cursor: pointer;
}

@media (max-width: 640px) {
  .waiverHeroActions {
    justify-content: center;
    gap: 12px;
  }

  .waiverHeroBrandWrap {
    min-height: 88px;
  }

  .waiverHeroBrand {
    max-height: 88px;
    max-width: 260px;
  }

  .waiverHeroUtility {
    font-size: 12px;
    padding: 6px 12px;
  }
}

@media (hover: hover) and (pointer: fine) {
.waiverHeroUtility:hover {
    background: rgba(212, 230, 244, 0.95);
    border-color: #1a446c;
    color: #1a446c;
    text-shadow: 0 0 10px rgba(26, 68, 108, 0.18);
    transform: translateY(-2px);
  }

  .waiverBtn:hover {
    filter: brightness(1.12) saturate(1.08);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
  }

  .waiverFloatingIssue:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.26);
    color: #1a446c;
    border-color: #1a446c;
  }

  .waiverField input:hover,
  .waiverField select:hover,
  .waiverField textarea:hover {
    border-color: #1a446c;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 0 0 2px rgba(26, 68, 108, 0.08);
  }
}

.waiverBtn,
.waiverFloatingIssue,
.waiverHeroUtility,
.waiverField input,
.waiverField select,
.waiverField textarea {
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease,
    filter 0.18s ease;
}

@media (max-width: 640px) {
  .waiverFloatingIssue {
    left: 12px;
    bottom: 12px;
  }
}

@media (max-width: 640px) and (orientation: portrait) {
  .waiverHeroTopRow {
    justify-content: flex-start;
    margin-bottom: 8px;
  }

  .waiverHeroActions {
    display: grid;
    grid-template-columns: repeat(2, minmax(122px, 136px));
    justify-content: space-between;
    align-items: center;
    gap: 10px;
  }

  .waiverHeroBrandWrap {
    min-height: 72px;
    margin-bottom: 8px;
  }

  .waiverHeroBrand {
    max-width: 220px;
    max-height: 70px;
  }

  .waiverHome {
    order: 1;
    justify-self: start;
    text-align: left;
    width: 100%;
  }

  .waiverReset {
    order: 2;
    justify-self: end;
    margin-left: 0;
    text-align: right;
    width: 100%;
  }
}

.waiverHome {
  text-decoration: none;
}

.waiverReset {
  min-height: 32px;
  padding: 5px 11px;
  font-size: 12px;
  letter-spacing: 0.035em;
}

.waiverHero h1 {
  margin: 0;
  color: #8d0d19;
  font-size: 30px;
  line-height: 1.12;
}

.waiverHero p {
  margin: 8px 0 0;
  color: #5a4a36;
  line-height: 1.4;
}

.waiverHero p.waiverSandboxNotice {
  margin: 8px 0 0;
  color: #f8f3e5;
  background: #8d0d19;
  border: 1px solid #8d0d19;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 14px;
  font-size: 16px;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.waiverPanel {
  overflow: hidden;
}

.waiverProgress {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(26, 68, 108, 0.98);
  color: #f8f3e5;
}

.waiverProgress strong {
  font-size: 18px;
  line-height: 1.25;
}

.waiverProgressBar {
  flex: 1 1 auto;
  max-width: 240px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.waiverProgressBar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #eee4b9 0%, #d7c178 100%);
}

.waiverStep {
  display: none;
  padding: 18px;
}

.waiverStep.is-active {
  display: block;
}

.waiverStep h2 {
  margin: 0 0 8px;
  color: #1a446c;
  font-size: 25px;
}

.waiverStepLead {
  margin: 0 0 18px;
  color: #5f4f3c;
  line-height: 1.45;
}

.waiverGrid {
  display: grid;
  gap: 14px;
}

.waiverGrid.two-up {
  grid-template-columns: 1fr;
}

.waiverDateField {
  width: 100%;
}

.waiverField label,
.waiverCheckbox label,
.waiverRadio legend {
  display: block;
  margin-bottom: 6px;
  color: #1a446c;
  font-weight: bold;
}

.waiverHint,
.waiverField small {
  color: #6a5a46;
  font-size: 13px;
}

.waiverFieldError {
  margin-top: 6px;
  display: inline-block;
  padding: 4px 8px;
  border-radius: 8px;
  color: #f8f3e5;
  background: #8d0d19;
  font-size: 13px;
  font-weight: bold;
  animation: waiverErrorBlink 1s step-end 60;
}

@keyframes waiverErrorBlink {
  0%, 50% {
    color: #f8f3e5;
    background: #8d0d19;
  }
  51%, 100% {
    color: #f0d9a6;
    background: #8d0d19;
  }
}

#under18LockMessage {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .waiverFieldError {
    animation: none;
  }
}

.waiverField input,
.waiverField select,
.waiverField textarea {
  width: 100%;
  min-height: 46px;
  box-sizing: border-box;
  border: 1px solid #8f7b53;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: #163955;
  padding: 10px 12px;
  font-size: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.waiverCountryRow {
  display: block;
}

.waiverField input[readonly] {
  background: #efe8d3;
}

.waiverField.has-error input,
.waiverField.has-error select,
.waiverField.has-error textarea,
.waiverCheckbox.has-error {
  border-color: #8c0d19;
  box-shadow: 0 0 0 2px rgba(140, 13, 25, 0.12);
}

.waiverField textarea {
  min-height: 120px;
  resize: vertical;
}

.waiverField.is-hidden,
.waiverCheckbox.is-hidden,
.waiverFieldError.is-hidden,
.waiverGrid.is-hidden,
.waiverIssuePanel.is-hidden,
.waiverIssueStatus.is-hidden,
.waiverManualFields.is-hidden,
.waiverAutoLocation.is-hidden,
.waiverBanner.is-hidden,
.waiverIssueOverlay.is-hidden,
.waiverConfirmOverlay.is-hidden,
.waiverConfirmDialog.is-hidden {
  display: none !important;
}

.waiverCheckbox,
.waiverRadio {
  padding: 12px 14px;
  border: 1px solid rgba(26, 68, 108, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.52);
}

.waiverGrid > .waiverCheckbox {
  margin: 0;
}

.waiverCheckboxFull {
  grid-column: 1 / -1;
}

.waiverCheckbox input,
.waiverRadio input {
  margin-right: 8px;
}

.waiverRadioGroup {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.waiverLegal {
  display: grid;
  gap: 12px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.waiverLegal section {
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(26, 68, 108, 0.12);
}

.waiverLegal h3 {
  margin: 0 0 8px;
  color: #1a446c;
  font-size: 18px;
}

.waiverLegal p {
  margin: 0;
  line-height: 1.45;
}

.waiverBanner,
.waiverErrors,
.waiverSuccess,
.waiverFailure {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 12px;
}

.waiverBanner {
  background: rgba(238, 228, 185, 0.75);
  border: 1px solid rgba(143, 123, 83, 0.32);
}

.waiverErrors,
.waiverFailure {
  background: #8d0d19;
  border: 1px solid #8d0d19;
  color: #f8f3e5;
}

.waiverSuccess {
  background: #f8f3e5;
  border: 2px solid #1a446c;
  color: #1a446c;
  text-align: center;
}

.waiverSuccess .waiverActions {
  justify-content: center;
}

.waiverSuccessActions {
  gap: 18px;
}

.waiverSuccess .waiverHeroUtility {
  background: #7b8fa8;
  border-color: #1a446c;
  color: #f8f3e5;
}

.waiverInternalSuccessTitle {
  color: #1a446c;
}

.waiverInternalSuccessMessage {
  font-size: 30px;
  line-height: 1.35;
  font-weight: 600;
  color: #1a446c;
}

.waiverExternalSuccess .waiverInternalSuccessMessage {
  font-size: 36px;
  line-height: 1.3;
}

.waiverInternalNewWaiver {
  background: #7b8fa8;
  border-color: #1a446c;
  color: #f8f3e5;
}

.waiverErrors ul,
.waiverFailure ul {
  margin: 8px 0 0 18px;
  padding: 0;
}

.waiverFailure code {
  color: #f8f3e5;
}

.waiverIssueOverlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 12, 8, 0.58);
  z-index: 1298;
}

.waiverIssuePanel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 24px));
  z-index: 1299;
}

.waiverFloatingIssue {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 1300;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid #1a446c;
  border-radius: 999px;
  background: rgba(248, 243, 229, 0.96);
  color: #1a446c;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.waiverIssueCard {
  background: rgba(248, 243, 229, 0.96);
  border: 1px solid rgba(26, 68, 108, 0.32);
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  padding: 18px;
  max-height: min(80vh, 720px);
  overflow: auto;
}

.waiverIssueCard h3 {
  margin: 0 0 8px;
  color: #1a446c;
  font-size: 22px;
}

.waiverIssueCard p {
  margin: 0 0 14px;
  color: #5f4f3c;
  line-height: 1.45;
}

.waiverIssueStatus {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(26, 68, 108, 0.12);
  border: 1px solid rgba(26, 68, 108, 0.3);
  color: #15395a;
}

.waiverIssueStatus.is-error {
  background: #8d0d19;
  border-color: #8d0d19;
  color: #f8f3e5;
}

.waiverActions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 20px;
  flex-wrap: wrap;
}

.waiverActionPrimary {
  order: 2;
  margin-left: auto;
}

.waiverActionSecondary {
  order: 1;
}

.waiverActions.is-centered {
  justify-content: center;
}

.waiverErrorActions {
  justify-content: center;
  gap: 24px;
}

.waiverBtn {
  appearance: none;
  border: 1px solid #8d0d19;
  border-radius: 12px;
  min-height: 48px;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  flex: 1 1 180px;
}

a.waiverBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.waiverBtn.secondary {
  background: #d4e6f4;
  color: #1a446c;
  border-color: #1a446c;
}

.waiverBtn.primary {
  background: #1a446c;
  color: #f8f3e5;
}

.waiverBtn.danger {
  background: #8d0d19;
  border-color: #8d0d19;
  color: #fff9f6;
}

.waiverBtn[disabled] {
  opacity: 0.6;
  cursor: wait;
}

.waiverFooter {
  margin-top: 14px;
  text-align: center;
  color: #4d4030;
  font-size: 14px;
}

.waiverHeaderGhostLink {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-block;
  width: 180px;
  height: 56px;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: auto;
  z-index: 2;
}

.waiverInlineForm {
  margin: 0;
  display: flex;
}

.waiverInternalToolsActions {
  justify-content: center;
  gap: 14px;
}

.waiverInternalToolButton {
  width: 200px;
  min-height: 36px;
  box-sizing: border-box;
}

.waiverInternalPanel .waiverProgress {
  position: static;
}

.waiverInternalPanel .waiverStep {
  display: block;
}

.waiverInternalToolsTitle {
  text-align: center;
}

.waiverInternalToolsGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.waiverInternalToolsActionsSolo {
  margin-top: 14px;
}

.waiverHeaderPlaceholder {
  visibility: hidden;
  pointer-events: none;
}

.waiverFooter strong {
  color: #8d0d19;
}

@media (min-width: 720px) {
  .waiverPage {
    padding: 28px 18px 36px;
  }

  .waiverHero,
  .waiverFooter,
  .waiverMessage {
    padding: 22px 24px;
  }

  .waiverStep {
    padding: 24px;
  }

  .waiverGrid.two-up {
    grid-template-columns: 1fr 1fr;
  }

  .waiverBtn {
    flex: 0 0 auto;
  }

  .waiverErrorActions {
    gap: 50px;
  }

  .waiverInternalToolsGrid {
    grid-template-columns: repeat(2, minmax(200px, 200px));
    justify-content: center;
  }

  .waiverDateField {
    max-width: 420px;
    margin: 0 auto;
  }

  .waiverHeroBrand {
    margin-top: -5px;
  }
}

@media (max-width: 719px) and (orientation: landscape) {
  .waiverDateField {
    max-width: 420px;
    margin: 0 auto;
  }

  .waiverHeroBrand {
    margin-top: -5px;
  }
}
