/* =========================================================================
   brochure-modal.css — Download Brochure lead-capture modal
   Prefix: bd- (brochure-download)
   Depends on CSS custom properties defined in styles.css
   ========================================================================= */

/* ---- Backdrop ---- */
.bd-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 13, 10, 0.58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms var(--ease, cubic-bezier(0.4, 0, 0.2, 1));
}
.bd-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Modal box ---- */
.bd-modal {
  background: var(--c-surface);
  border-radius: var(--radius-xl, 20px);
  max-width: 480px;
  width: 100%;
  padding: 2rem 1.85rem 1.85rem;
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.6);
  transform: translateY(20px) scale(0.98);
  transition: transform 320ms var(--ease, cubic-bezier(0.4, 0, 0.2, 1));
  position: relative;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
}
.bd-backdrop.open .bd-modal {
  transform: translateY(0) scale(1);
}

/* ---- Close button ---- */
.bd-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--c-bg);
  border: 1px solid var(--c-line);
  color: var(--c-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}
.bd-close:hover {
  background: var(--c-cream, #fff3e8);
  color: var(--o-700, #c05800);
}

/* ---- Icon ---- */
.bd-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    var(--o-500, #e86a2c),
    var(--o-700, #c05800)
  );
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  box-shadow: 0 12px 28px -10px rgba(232, 106, 44, 0.5);
}
.bd-icon svg {
  width: 22px;
  height: 22px;
}

/* ---- Heading & description ---- */
.bd-modal > h3 {
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}
.bd-modal > p {
  font-size: 0.9rem;
  color: var(--c-text-2);
  margin: 0 0 1.25rem;
  line-height: 1.55;
}

/* ---- Form layout ---- */
.bd-form {
  display: grid;
}

.bd-initial {
  display: grid;
  gap: 0.75rem;
}

.bd-form label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin-bottom: 0.25rem;
  display: block;
}

/* ---- Inputs & selects ---- */
.bd-form input,
.bd-form select {
  width: 100%;
  min-width: 0;
  background: var(--c-bg);
  border: 1px solid var(--c-line);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  color: var(--c-text);
  transition: border-color 0.15s;
}
.bd-form input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  height: 51.25px;
}
.bd-form input:focus,
.bd-form select:focus {
  outline: 2px solid var(--o-200, rgba(232, 106, 44, 0.3));
  outline-offset: 1px;
  border-color: var(--o-400, #e86a2c);
}

/* ---- Phone wrap ---- */
.bd-phone-wrap {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 0.4rem;
  align-items: stretch;
}

/* ---- Verify button ---- */
.bd-verify-btn {
  padding: 0 0.85rem;
  border-radius: 8px;
  border: 1.5px solid var(--o-500, #e86a2c);
  color: var(--o-500, #e86a2c);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s,
    color 0.15s;
}
.bd-verify-btn:hover:not(:disabled) {
  background: var(--o-500, #e86a2c);
  color: #fff;
}
.bd-verify-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.bd-verify-btn.is-sending {
  opacity: 0.7;
  cursor: default;
}
.bd-verify-btn.bd-hidden {
  display: none;
}

/* ---- Verified badge ---- */
.bd-verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.76rem;
  font-weight: 700;
  color: #2f8f5f;
  margin-top: 0.3rem;
}
.bd-verified-badge.bd-hidden {
  display: none;
}

/* ---- Field messages ---- */
.bd-msg {
  font-size: 0.69rem;
  margin-top: 0.28rem;
  min-height: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.28rem;
  line-height: 1.3;
  transition: opacity 0.18s;
}
.bd-msg:empty {
  min-height: 0;
  margin-top: 0;
}
.bd-msg.err {
  color: #d93025;
}
.bd-msg.ok {
  color: #2f8f5f;
}
.bd-msg.info {
  color: var(--o-700, #c05800);
}
.bd-msg svg {
  flex-shrink: 0;
}

/* ---- Field validation states ---- */
.bd-form input.is-error,
.bd-form select.is-error {
  border-color: #d93025;
  box-shadow: 0 0 0 3px rgba(217, 48, 37, 0.09);
}
.bd-form input.is-valid,
.bd-form select.is-valid {
  border-color: #2f8f5f;
}
.bd-form input.is-error:focus,
.bd-form select.is-error:focus {
  outline: 2px solid rgba(217, 48, 37, 0.18);
  outline-offset: 1px;
}
.bd-form input.is-valid:focus,
.bd-form select.is-valid:focus {
  outline: 2px solid rgba(47, 143, 95, 0.18);
  outline-offset: 1px;
}

/* ---- Shake animation ---- */
@keyframes bd-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-5px);
  }
  40% {
    transform: translateX(5px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(3px);
  }
}
.bd-form input.shake,
.bd-form select.shake,
.bd-verify-btn.shake {
  animation: bd-shake 0.32s ease;
}

/* ---- Submit CTA ---- */
.bd-cta {
  width: 100%;
  background: linear-gradient(
    135deg,
    var(--o-500, #e86a2c),
    var(--o-700, #c05800)
  );
  color: #fff;
  padding: 0.85rem 1.1rem;
  border: 0;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}
.bd-cta:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px -14px rgba(232, 106, 44, 0.6);
}
.bd-cta:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* ---- Consent note ---- */
.bd-note {
  font-size: 0.72rem;
  color: var(--c-muted);
  margin-top: 0.55rem;
  line-height: 1.45;
}

/* ---- Success state ---- */
.bd-success {
  display: none;
  text-align: center;
  padding: 1.25rem 0 0.5rem;
}
.bd-success.show {
  display: block;
}
.bd-success .bd-circ {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7ed0a8, #4fa87a);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.85rem;
}
.bd-success h5 {
  font-size: 1.1rem;
  margin: 0 0 0.3rem;
  letter-spacing: -0.015em;
}
.bd-success p {
  font-size: 0.88rem;
  color: var(--c-text-2);
  margin: 0;
  line-height: 1.5;
}

/* ============================================================
   OTP verification modal (layered above the main modal)
   ============================================================ */
.bd-otp-bd {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(15, 13, 10, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms var(--ease, cubic-bezier(0.4, 0, 0.2, 1));
}
.bd-otp-bd.open {
  opacity: 1;
  pointer-events: auto;
}

.bd-otp-box {
  background: var(--c-surface);
  border-radius: var(--radius-xl, 20px);
  max-width: 400px;
  width: 100%;
  padding: 2rem 1.75rem 1.75rem;
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.6);
  transform: translateY(20px) scale(0.98);
  transition: transform 320ms var(--ease, cubic-bezier(0.4, 0, 0.2, 1));
  position: relative;
  display: grid;
  gap: 1rem;
}
.bd-otp-bd.open .bd-otp-box {
  transform: translateY(0) scale(1);
}

.bd-otp-box > h4 {
  font-size: 1.1rem;
  letter-spacing: -0.015em;
  margin: 0;
}
.bd-otp-box > p {
  font-size: 0.88rem;
  color: var(--c-text-2);
  margin: 0;
  line-height: 1.5;
}

/* ---- OTP digit row ---- */
.bd-otp-row {
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
}
.bd-otp-row input {
  flex: 1;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0.75rem 0.4rem;
  max-width: 52px;
  background: var(--c-bg);
  border: 1px solid var(--c-line);
  border-radius: 10px;
  color: var(--c-text);
  font: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  transition: border-color 0.15s;
}
.bd-otp-row input:focus {
  outline: 2px solid var(--o-200, rgba(232, 106, 44, 0.3));
  outline-offset: 1px;
  border-color: var(--o-400, #e86a2c);
}
.bd-otp-row input.is-error {
  border-color: #d93025;
  box-shadow: 0 0 0 3px rgba(217, 48, 37, 0.09);
}

/* ---- OTP error ---- */
.bd-otp-err {
  background: rgba(217, 48, 37, 0.08);
  border: 1px solid rgba(217, 48, 37, 0.25);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
  color: #d93025;
  font-weight: 600;
}
.bd-otp-err.bd-hidden {
  display: none;
}

/* ---- OTP timer & resend ---- */
.bd-otp-timer {
  font-size: 0.8rem;
  color: var(--c-muted);
  text-align: center;
}
.bd-otp-timer.bd-hidden {
  display: none;
}

.bd-otp-resend {
  background: transparent;
  border: 0;
  color: var(--o-700, #c05800);
  font-weight: 700;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  padding: 0;
  text-align: center;
  width: 100%;
}
.bd-otp-resend:disabled {
  color: var(--c-muted);
  cursor: not-allowed;
}
.bd-otp-resend.bd-hidden {
  display: none;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 520px) {
  .bd-modal {
    padding: 1.75rem 1.35rem 1.5rem;
  }
  .bd-phone-wrap {
    grid-template-columns: 72px 1fr auto;
  }
  .bd-otp-row input {
    max-width: 44px;
    padding: 0.65rem 0.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bd-backdrop,
  .bd-modal,
  .bd-otp-bd,
  .bd-otp-box {
    transition: none;
  }
}
