/* =========================================================
   QCTM Membership Application - Main UI
   ========================================================= */

:root {
  --qctm-blue: #2563eb;
  --qctm-blue-dark: #183153;
  --qctm-blue-soft: #eef5ff;
  --qctm-border: #d8e3f1;
  --qctm-border-input: #cbd5e1;
  --qctm-text: #172033;
  --qctm-muted: #64748b;
  --qctm-required: #e11d48;
  --qctm-green: #e9f8ef;
  --qctm-green-text: #087443;
  --qctm-yellow: #fff8e7;
  --qctm-shadow: 0 4px 18px rgba(30, 64, 175, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f8fbff;
  color: var(--qctm-text);
  font-family: Arial, Helvetica, sans-serif;
}

.page-container {
  width: min(1000px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 50px;
}

#form {
  width: 100%;
  margin: 0;
}

.form-header {
  text-align: center;
  margin-bottom: 28px;
}

.form-header h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.1;
  color: #0f2346;
}

.form-header h2 {
  margin: 10px 0 14px;
  font-size: clamp(22px, 3.5vw, 31px);
  color: #15213b;
}

.form-header .intro {
  max-width: 760px;
  margin: 0 auto;
  color: #52627b;
  font-size: 17px;
  line-height: 1.45;
}

.required-note {
  margin-top: 16px;
  color: var(--qctm-required);
  font-size: 15px;
}

.form-section {
  background: #fff;
  border: 1px solid var(--qctm-border);
  border-radius: 16px;
  padding: 18px 24px 24px;
  margin-bottom: 22px;
  box-shadow: var(--qctm-shadow);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: -4px -8px 20px;
  padding: 9px 14px;
  border-radius: 12px;
  background: linear-gradient(90deg, #edf5ff 0%, #f5f9ff 70%, #eef5ff 100%);
}

.section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 50%;
  background: var(--qctm-blue);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
}

.section-title {
  margin: 0;
  font-size: 27px;
  line-height: 1.2;
  color: #102349;
}

.form-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  column-gap: 22px;
  align-items: center;
  width: 100%;
  margin: 12px 0;
}

.form-label {
  text-align: right;
  font-size: 16px;
  line-height: 1.25;
  color: var(--qctm-text);
}

.required {
  color: var(--qctm-required);
}

.form-control {
  width: 100%;
  min-width: 0;
}

.form-control input:not([type="checkbox"]):not([type="radio"]),
.form-control select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--qctm-border-input);
  border-radius: 11px;
  background: #fff;
  color: var(--qctm-text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control input:focus,
.form-control select:focus {
  border-color: var(--qctm-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.subsection-panel {
  margin: 16px 0 8px;
  padding: 18px 18px 14px 26px;
  background: #f8fbff;
  border-radius: 12px;
  border-left: 5px solid var(--qctm-blue);
}

.subsection-title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
  color: #102349;
}

.subsection-help {
  margin: 0 0 18px;
  color: var(--qctm-muted);
  font-size: 14px;
}

.fee-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 14px 0;
  padding: 15px 18px;
  border-radius: 12px;
  background: var(--qctm-blue-soft);
}

.fee-box input[type="checkbox"] {
  width: auto !important;
  max-width: none !important;
  flex: 0 0 auto;
  margin: 3px 0 0;
}

.fee-main {
  font-weight: 700;
  font-size: 16px;
}

.fee-help {
  margin-top: 4px;
  color: var(--qctm-muted);
  font-size: 14px;
}

.membership-period-panel {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 24px;
  margin-top: 14px;
  padding: 20px;
  border-radius: 12px;
  background: #f8fafc;
}

.period-description h4 {
  margin: 0 0 6px;
  font-size: 18px;
  color: #102349;
}

.period-description p {
  margin: 0;
  color: var(--qctm-muted);
  line-height: 1.4;
}

#periodOptions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

#periodOptions label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 9px;
  cursor: default;
}

#periodOptions label:has(input:checked) {
  background: #e8f2ff;
}

#periodOptions input[type="radio"] {
  width: auto !important;
  max-width: none !important;
  margin: 0;
}

.period-price {
  font-weight: 600;
  white-space: nowrap;
}

.prepay-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-top: 14px;
  padding: 16px 18px;
  background: var(--qctm-yellow);
  border-radius: 12px;
}

.prepay-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.prepay-main input[type="checkbox"] {
  width: auto !important;
  max-width: none !important;
  flex: 0 0 auto;
  margin: 3px 0 0;
}

.prepay-title {
  font-weight: 700;
  font-size: 16px;
}

.prepay-help {
  margin-top: 4px;
  color: var(--qctm-muted);
  font-size: 14px;
}

.prepay-info {
  max-width: 290px;
  padding: 10px 14px;
  border: 1px solid #f3dfa4;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  color: #435066;
  font-size: 13px;
  line-height: 1.35;
}

.total-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
  padding: 18px 22px;
  background: var(--qctm-green);
  border-radius: 12px;
}

.total-label {
  font-size: 18px;
  font-weight: 700;
  color: var(--qctm-green-text);
}

.total-amount {
  flex: 0 0 auto;
  font-size: 30px;
  font-weight: 800;
  color: var(--qctm-green-text);
}

.actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.btn {
  min-width: 180px;
  padding: 12px 22px;
  border: 1px solid var(--qctm-border-input);
  border-radius: 11px;
  background: #fff;
  color: var(--qctm-text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  border-color: #94a3b8;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.btn.primary {
  border-color: var(--qctm-blue);
  background: var(--qctm-blue);
  color: #fff;
}

.btn.primary:hover {
  border-color: #1d4ed8;
  background: #1d4ed8;
}

.hidden {
  display: none !important;
}

.note,
.payinfo {
  margin-top: 10px;
  text-align: center;
  color: var(--qctm-muted);
  font-size: 13px;
  line-height: 1.45;
}

#message,
#paymentMsg {
  margin-top: 12px;
  text-align: center;
  font-weight: 600;
}

#paypalButtonsWrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

#paypal-buttons {
  width: min(420px, 100%);
}

@media (max-width: 700px) {
  .page-container {
    width: min(calc(100% - 20px), 1000px);
    padding-top: 18px;
  }

  .form-header {
    margin-bottom: 22px;
  }

  .form-header .intro {
    font-size: 15px;
  }

  .form-section {
    padding: 14px 14px 20px;
    border-radius: 13px;
  }

  .section-heading {
    gap: 11px;
    padding: 8px 10px;
  }

  .section-number {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    font-size: 18px;
  }

  .section-title {
    font-size: 21px;
  }

  .form-row {
    grid-template-columns: 1fr;
    row-gap: 6px;
    margin: 14px 0;
  }

  .form-label {
    text-align: left;
  }

  .subsection-panel {
    padding: 16px 12px 12px 16px;
  }

  .membership-period-panel {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 15px;
  }

  #periodOptions label {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .prepay-box {
    flex-direction: column;
    align-items: stretch;
  }

  .prepay-info {
    max-width: none;
  }

  .total-box {
    padding: 15px;
  }

  .total-label {
    font-size: 16px;
  }

  .total-amount {
    font-size: 25px;
  }

  .actions .btn {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .page-container {
    width: min(calc(100% - 12px), 1000px);
  }

  .form-section {
    padding-left: 10px;
    padding-right: 10px;
  }

  .membership-period-panel {
    padding: 12px;
  }

  #periodOptions label {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .period-price {
    grid-column: 2;
    justify-self: start;
    font-size: 14px;
    color: var(--qctm-muted);
  }

  .total-box {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}
