/**
 * ═══════════════════════════════════════════════════════════════════
 * UNIVERSAL GATEWAY — MODAL & 3DS STYLES
 * ═══════════════════════════════════════════════════════════════════
 */

.gw-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-out;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.gw-backdrop.gw-open {
  opacity: 1;
  pointer-events: auto;
}

.gw-modal {
  background: var(--gw-card-bg, #ffffff);
  color: var(--gw-text, #1f2937);
  width: 100%;
  max-width: 480px;
  border-radius: var(--gw-radius, 14px);
  box-shadow: var(--gw-shadow, 0 25px 50px -12px rgba(0, 0, 0, 0.25));
  overflow: hidden;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  box-sizing: border-box;
}

.gw-backdrop.gw-open .gw-modal {
  transform: translateY(0) scale(1);
}

/* RTL Support */
[dir="rtl"] .gw-modal {
  text-align: right;
  direction: rtl;
}

/* Header */
.gw-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--gw-border, #e5e7eb);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
}

.gw-header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gw-text, #1f2937);
  display: flex;
  align-items: center;
  gap: 8px;
}

.gw-close-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--gw-muted, #6b7280);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.15s, background-color 0.15s;
}

.gw-close-btn:hover {
  color: #111;
  background-color: rgba(0, 0, 0, 0.05);
}

/* Order Summary Bar */
.gw-order-bar {
  background: #f8fafc;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  border-bottom: 1px solid var(--gw-border, #e5e7eb);
}

.gw-order-label {
  color: var(--gw-muted, #6b7280);
  font-weight: 500;
}

.gw-order-amount {
  font-size: 18px;
  font-weight: 800;
  color: var(--gw-primary, #1a56db);
}

/* Modal Body */
.gw-body {
  padding: 24px;
  overflow-y: auto;
  box-sizing: border-box;
}

/* Form Groups & Inputs */
.gw-group {
  margin-bottom: 16px;
}

.gw-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gw-text, #374151);
  margin-bottom: 6px;
}

.gw-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--gw-border, #d1d5db);
  border-radius: 8px;
  font-size: 15px;
  color: var(--gw-text, #1f2937);
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
  font-family: inherit;
}

.gw-input:focus {
  border-color: var(--gw-primary, #1a56db);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.gw-input.gw-has-error {
  border-color: var(--gw-error, #ef4444);
  background-color: #fef2f2;
}

.gw-input-row {
  display: flex;
  gap: 12px;
}

.gw-input-row .gw-group {
  flex: 1;
}

/* Card Input with Brand Badge */
.gw-card-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.gw-card-brand-badge {
  position: absolute;
  right: 12px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
  pointer-events: none;
}

[dir="rtl"] .gw-card-brand-badge {
  right: auto;
  left: 12px;
}

/* Primary Button */
.gw-btn {
  width: 100%;
  padding: 14px 20px;
  background: var(--gw-primary, #1a56db);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.05s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  margin-top: 8px;
}

.gw-btn:hover {
  background: var(--gw-primary-hover, #1e40af);
}

.gw-btn:active {
  transform: scale(0.99);
}

.gw-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.gw-btn-secondary {
  background: #f1f5f9;
  color: #334155;
  box-shadow: none;
  margin-top: 10px;
}

.gw-btn-secondary:hover {
  background: #e2e8f0;
}

/* ─── 3DS SCREEN STYLES ───────────────────────────────────────────── */

.gw-3ds-container {
  text-align: center;
  padding: 10px 0;
}

.gw-spinner-wrap {
  margin: 20px auto;
  width: 72px;
  height: 72px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gw-spinner-ring {
  position: absolute;
  inset: 0;
  border: 4px solid #f1f5f9;
  border-top-color: var(--gw-primary, #1a56db);
  border-radius: 50%;
  animation: gw-spin 1s linear infinite;
}

.gw-spinner-icon {
  font-size: 26px;
}

@keyframes gw-spin {
  to { transform: rotate(360deg); }
}

.gw-3ds-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--gw-text, #1f2937);
  margin-bottom: 8px;
}

.gw-3ds-desc {
  font-size: 14px;
  color: var(--gw-muted, #6b7280);
  line-height: 1.5;
  margin-bottom: 20px;
}

/* OTP Digits Grid */
.gw-otp-grid {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 20px 0;
  direction: ltr; /* OTP always left to right */
}

.gw-otp-box {
  width: 46px;
  height: 52px;
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  border: 2px solid var(--gw-border, #cbd5e1);
  border-radius: 8px;
  outline: none;
  background: #ffffff;
  color: #0f172a;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.gw-otp-box:focus {
  border-color: var(--gw-primary, #1a56db);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.2);
}

.gw-otp-box.gw-error {
  border-color: var(--gw-error, #ef4444);
  background: #fef2f2;
}

/* Push Phone Animation */
.gw-phone-icon-wrap {
  width: 80px;
  height: 80px;
  margin: 15px auto;
  background: #eff6ff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  animation: gw-pulse 2s infinite;
}

@keyframes gw-pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(26, 86, 219, 0.4); }
  70% { transform: scale(1); box-shadow: 0 0 0 16px rgba(26, 86, 219, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(26, 86, 219, 0); }
}

/* Push 3 Number Code Badge */
.gw-push-code-badge {
  display: inline-block;
  padding: 12px 28px;
  background: #0f172a;
  color: #ffffff;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 4px;
  border-radius: 12px;
  margin: 15px 0 20px 0;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

/* Error Alert Box */
.gw-alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: gw-shake 0.3s;
}

@keyframes gw-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Footer & Security Note */
.gw-footer {
  padding: 14px 24px;
  background: #f8fafc;
  border-top: 1px solid var(--gw-border, #e5e7eb);
  font-size: 12px;
  color: var(--gw-muted, #94a3b8);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Mobile full-screen / bottom-sheet responsiveness */
@media (max-width: 640px) {
  .gw-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .gw-modal {
    max-width: 100%;
    border-radius: var(--gw-radius, 16px) var(--gw-radius, 16px) 0 0;
    max-height: 94vh;
  }
  .gw-otp-box {
    width: 40px;
    height: 48px;
    font-size: 20px;
  }
}
