/* ==========================================================================
   ZYNLUME — Luxury Glassmorphic Overlay & Modal Design System (v9.5.2)
   Flawless responsive adaptation for Desktop & Mobile in unified dark aesthetic.
   ========================================================================== */

/* ---------------- 1. Backdrop Overlay ---------------- */
.overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  padding: 24px !important;
  background: rgba(3, 5, 10, 0.78) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s !important;
}

.overlay.show {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* ---------------- 2. Floating Modal Shell (Desktop) ---------------- */
.modal {
  width: min(440px, 100%) !important;
  max-height: calc(100vh - 48px) !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding: 32px 30px 28px !important;
  background: linear-gradient(165deg, rgba(16, 20, 29, 0.98), rgba(8, 11, 17, 0.99)) !important;
  border: 1px solid rgba(255, 255, 255, 0.13) !important;
  border-radius: 24px !important;
  box-shadow: 0 36px 110px rgba(0, 0, 0, 0.75), 0 0 60px rgba(118, 104, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.09) !important;
  position: relative !important;
  transform: translateY(20px) scale(0.97) !important;
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s ease !important;
  color: #edf0f7 !important;
  box-sizing: border-box !important;
}

.overlay.show .modal {
  transform: translateY(0) scale(1) !important;
}

/* Mobile top handle indicator (hidden on desktop) */
.modal-handle {
  display: none;
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  margin: -12px auto 18px;
}

/* ---------------- 3. Close Button ---------------- */
.modal-close,
.modal .x {
  position: absolute !important;
  right: 18px !important;
  top: 18px !important;
  width: 34px !important;
  height: 34px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #a6b2c8 !important;
  font-size: 18px !important;
  line-height: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  z-index: 10 !important;
  padding: 0 !important;
}

.modal-close:hover,
.modal .x:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  transform: scale(1.06) !important;
}

/* ---------------- 4. Header & Typography ---------------- */
.modal-logo {
  display: inline-flex !important;
  margin-bottom: 14px !important;
  width: 38px !important;
  height: 38px !important;
}

.modal h3 {
  font-size: 23px !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em !important;
  margin: 0 0 4px 0 !important;
  color: #ffffff !important;
}

.modal-sub,
.modal .msub {
  margin: 0 0 20px 0 !important;
  color: #8c9bb4 !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
}

/* ---------------- 5. Form Fields & Inputs ---------------- */
.modal .field,
.auth-modal .field {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  margin-bottom: 14px !important;
  text-align: left !important;
}

.modal .field > span,
.auth-modal .field > span,
.field-label {
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  color: #8391a8 !important;
}

.modal input,
.auth-modal input {
  width: 100% !important;
  height: 46px !important;
  padding: 10px 14px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  color: #ffffff !important;
  font-size: 14px !important;
  font-family: inherit !important;
  box-sizing: border-box !important;
  transition: all 0.2s ease !important;
  outline: none !important;
}

.modal input::placeholder,
.auth-modal input::placeholder {
  color: rgba(255, 255, 255, 0.28) !important;
}

.modal input:focus,
.auth-modal input:focus {
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: #7668ff !important;
  box-shadow: 0 0 0 3px rgba(118, 104, 255, 0.2), 0 0 20px rgba(118, 104, 255, 0.14) !important;
}

/* ---------------- 6. Google OAuth Button ---------------- */
.google-button {
  width: 100% !important;
  height: 48px !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 13px !important;
  background: rgba(255, 255, 255, 0.05) !important;
  color: #edf0f7 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-sizing: border-box !important;
}

.google-button:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.24) !important;
  transform: translateY(-1px) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
}

.google-button svg {
  width: 20px !important;
  height: 20px !important;
  flex: none !important;
}

/* ---------------- 7. Divider ---------------- */
.divider {
  margin: 18px 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  color: #637189 !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
}

.divider::before,
.divider::after {
  content: "" !important;
  height: 1px !important;
  flex: 1 !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

/* ---------------- 8. Buttons & Toggles ---------------- */
.btn-block {
  width: 100% !important;
  height: 48px !important;
  border-radius: 13px !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  margin-top: 6px !important;
}

.auth-toggle {
  width: 100% !important;
  margin-top: 14px !important;
  background: transparent !important;
  border: none !important;
  color: #9b90ff !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  padding: 6px !important;
  transition: all 0.2s ease !important;
  text-align: center !important;
}

.auth-toggle:hover {
  color: #ffffff !important;
  text-decoration: none !important;
}

/* ---------------- 9. Virtual Card Preview (Checkout) ---------------- */
.pay-card-box {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 16px !important;
  padding: 16px !important;
  margin: 14px 0 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

.pay-card-chip {
  width: 32px;
  height: 24px;
  border-radius: 5px;
  background: linear-gradient(135deg, #d4af37, #aa8524);
  margin-bottom: 12px;
  opacity: 0.85;
}

.pay-guarantee {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  margin-top: 14px !important;
  color: #7988a2 !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
}

/* ---------------- 10. Hardware Gate (App Sign-In Demo) ---------------- */
.key-field-wrap {
  margin: 14px 0 !important;
}

.key-input {
  text-align: center !important;
  letter-spacing: 0.15em !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  height: 52px !important;
  border-radius: 14px !important;
  background: rgba(0, 0, 0, 0.35) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

.gate-msg {
  min-height: 20px !important;
  margin-top: 8px !important;
  margin-bottom: 10px !important;
  text-align: center !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
}

.gate-msg.ok {
  color: #34d399 !important;
  text-shadow: 0 0 12px rgba(52, 211, 153, 0.3) !important;
}

.gate-msg.err {
  color: #f87171 !important;
  text-shadow: 0 0 12px rgba(248, 113, 113, 0.3) !important;
}

.gate-downloads {
  display: flex !important;
  gap: 8px !important;
  margin-top: 16px !important;
}

.btn-sm {
  height: 38px !important;
  font-size: 12px !important;
  padding: 0 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  border-radius: 10px !important;
}

/* ---------------- 11. Mobile Bottom-Sheet (<= 640px) ---------------- */
@media (max-width: 640px) {
  .overlay {
    padding: 0 !important;
    align-items: flex-end !important;
  }

  .modal {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 28px 28px 0 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    padding: 24px 20px max(24px, env(safe-area-inset-bottom)) !important;
    transform: translateY(100%) !important;
    max-height: 88vh !important;
  }

  .overlay.show .modal {
    transform: translateY(0) !important;
  }

  .modal-handle {
    display: block !important;
  }

  .modal-close,
  .modal .x {
    top: 16px !important;
    right: 16px !important;
    width: 32px !important;
    height: 32px !important;
  }

  .modal h3 {
    font-size: 20px !important;
  }

  .modal input,
  .auth-modal input,
  .google-button,
  .btn-block {
    height: 48px !important;
  }
}
