/* Modern Fintech Design System for Custom Card Gateway (Classic + Checkout Blocks + 3DS Bank Modal) */

.cg-blocks-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.cg-gateway-brand-icons {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  vertical-align: middle;
}

.cg-brand-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  border: 1px solid #dbe3ee;
  background: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4px;
  line-height: 1;
}

.cg-brand-visa {
  color: #1434cb;
  font-style: italic;
}

.cg-brand-mc {
  padding: 0 5px;
}

.cg-brand-3ds {
  background: #f0f5fb;
  border-color: #c7d6ea;
  color: #16395f;
}

.cg-card-widget,
.cg-card-widget * {
  box-sizing: border-box;
}

.cg-card-widget {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #0f172a;
  margin: 4px 0 2px;
}

.cg-card-widget .cg-card-intro {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #475569;
}

.cg-card-surface {
  position: relative;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #d8dee9;
  border-radius: 8px;
  padding: 14px;
  box-shadow: none;
}

.cg-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid #e6edf5;
}

.cg-card-head-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}

.cg-card-head-title svg {
  color: #16395f;
  flex-shrink: 0;
}

.cg-bank-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  font-size: 11.5px;
  line-height: 1.2;
  color: #475569;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.cg-bank-pill.is-loading {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.cg-bank-pill.is-matched {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0c4a6e;
}

.cg-bank-pill.is-generic {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}

.cg-bank-pill strong {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 185px;
}

.cg-pill-meta {
  font-size: 10.5px;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}

.cg-pill-logo {
  height: 15px;
  width: auto;
  max-width: 58px;
  object-fit: contain;
  display: block;
}

.cg-bank-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}

.cg-bank-pill.is-generic .cg-bank-pill-dot {
  background: #0ea5e9;
}

.cg-mini-spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #bfdbfe;
  border-top-color: #1d4ed8;
  animation: cgBtnSpin 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes cgBtnSpin {
  to { transform: rotate(360deg); }
}

.cg-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.cg-field-full {
  grid-column: 1 / -1;
}

.cg-card-widget .cg-label {
  display: block;
  margin: 0 0 5px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  line-height: 1.3;
}

.cg-input-wrap {
  position: relative;
}

.cg-card-widget input.cg-input {
  width: 100%;
  height: 42px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #0f172a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  box-shadow: none;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.cg-card-widget input.cg-input-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14.5px;
  letter-spacing: 0.7px;
}

.cg-card-widget .cg-input-has-right input.cg-input {
  padding-right: 68px;
}

.cg-card-widget input.cg-input:focus {
  outline: none;
  border-color: #16395f;
  box-shadow: 0 0 0 3px rgba(22, 57, 95, 0.13);
}

.cg-card-widget input.cg-input.is-invalid {
  border-color: #dc2626;
  background: #fef2f2;
}

.cg-card-widget input.cg-input.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}

.cg-input-badge {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  pointer-events: none;
}

.cg-scheme-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4px;
}

.cg-scheme-visa {
  background: #eff6ff;
  color: #1434cb;
  font-style: italic;
}

.cg-scheme-mc {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 0 4px;
}

.cg-scheme-amex {
  background: #ecfeff;
  color: #0369a1;
}

.cg-scheme-maestro {
  background: #fef2f2;
  color: #b91c1c;
}

.cg-card-widget button.cg-cvc-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  box-shadow: none;
  cursor: pointer;
}

.cg-card-widget button.cg-cvc-toggle:hover,
.cg-card-widget button.cg-cvc-toggle.is-active {
  background: #f1f5f9;
  color: #0f172a;
}

.cg-field-error {
  margin: 5px 0 0;
  font-size: 11.5px;
  font-weight: 600;
  color: #dc2626;
  line-height: 1.35;
}

.cg-method-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #edf2f7;
}

.cg-method-label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.cg-method-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  border-radius: 8px;
  background: #eef2f6;
}

.cg-card-widget button.cg-method-pill {
  appearance: none;
  padding: 5px 10px;
  margin: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #475569;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.cg-card-widget button.cg-method-pill:hover {
  background: rgba(255, 255, 255, 0.7);
  color: #0f172a;
}

.cg-card-widget button.cg-method-pill.is-active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.cg-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #edf2f7;
}

.cg-trust-copy {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #475569;
}

.cg-trust-copy svg {
  color: #15803d;
  flex-shrink: 0;
}

.cg-trust-copy strong {
  color: #0f172a;
}

.cg-sandbox-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
}

.cg-form-alert {
  margin-top: 10px;
  padding: 10px 13px;
  border-radius: 8px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
}

.cg-editor-note {
  margin: 0;
  font-size: 12.5px;
  color: #475569;
}

/* ==========================================================================
   Bank Authorization Overlay (<dialog> wrapping only .cg-3ds-frame)
   ========================================================================== */

html.cg-modal-open {
  overflow: hidden;
}

dialog.cg-3ds-dialog,
dialog.cg-3ds-dialog * {
  box-sizing: border-box;
}

dialog.cg-3ds-dialog {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  animation: cgDialogIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

dialog.cg-3ds-dialog::backdrop {
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
}

@keyframes cgDialogIn {
  from { opacity: 0; transform: scale(0.985); }
  to { opacity: 1; transform: scale(1); }
}

.cg-3ds-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

/* ==========================================================================
   Thank You & Order Details Card Receipt
   ========================================================================== */

.cg-order-receipt {
  margin: 22px 0;
  padding: 18px 20px;
  background: #ffffff;
  border: 1px solid #d7e0eb;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.cg-order-receipt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 15px;
  color: #0f172a;
}

.cg-order-receipt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin: 0;
}

.cg-order-receipt-grid dt {
  margin: 0 0 3px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #64748b;
}

.cg-order-receipt-grid dd {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
  overflow-wrap: anywhere;
}

/* Theme isolation overrides so Poranna/Storefront rules do not distort card UI */
#payment .payment_methods li.payment_method_custom_card .cg-gateway-brand-icons {
  float: right;
  margin-top: 1px;
}

#payment .payment_methods li.payment_method_custom_card .cg-card-widget img.cg-pill-logo,
.cg-card-widget img.cg-pill-logo {
  float: none !important;
  padding: 0 !important;
  border: 0 !important;
  max-height: 15px !important;
  display: inline-block !important;
}

.cg-card-widget input.cg-input:focus,
.cg-card-widget button.cg-cvc-toggle:focus,
dialog.cg-3ds-dialog button:focus {
  outline: none !important;
}

.cg-card-widget button.cg-cvc-toggle {
  background: transparent !important;
  color: #64748b !important;
  border: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.cg-inline-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.cg-card-widget.is-busy .cg-inline-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.cg-inline-spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid #dbe3ee;
  border-top-color: #16395f;
  animation: cgBtnSpin 0.75s linear infinite;
}

@media (max-width: 520px) {
  .cg-form-grid {
    grid-template-columns: 1fr;
  }
}

