/*
 * KashKrypto Square modal — same layout as Kashpack square.blade.php.
 * Local classes use sqp- prefix (Square SDK owns sq-*).
 */
:root {
  --sqp-maroon: #5c1a1a;
  --sqp-maroon-hover: #4a1414;
  --sqp-border: #d0d5dd;
  --sqp-muted: #667085;
  --sqp-bg: #ffffff;
}

.sqp-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  visibility: hidden;
  pointer-events: none;
}

.sqp-modal.is-open {
  visibility: visible;
  pointer-events: auto;
}

.sqp-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 15, 30, 0.55);
}

.sqp-modal__dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 32px);
  overflow: visible;
  background: var(--sqp-bg);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  padding: 28px 24px 24px;
}

.sqp-modal__close {
  position: absolute;
  top: 10px;
  right: 14px;
  border: 0;
  background: transparent;
  font-size: 32px;
  line-height: 1;
  color: #667085;
  cursor: pointer;
  padding: 4px 8px;
}

.sqp-modal__header {
  text-align: center;
  margin-bottom: 22px;
  padding-right: 18px;
}

.sqp-modal__title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 12px;
  color: #101828;
}

.sqp-modal__amount {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sqp-modal__amount-label {
  font-size: 1rem;
  color: var(--sqp-muted);
}

.sqp-modal__amount-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: #101828;
}

.sqp-modal__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: visible;
  min-height: 220px;
  position: relative;
}

.sqp-modal-loader {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 30;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 220px;
  padding: 24px 12px;
  width: 100%;
  background: #fff;
  border-radius: 8px;
}

.sqp-modal-loader.is-active {
  display: flex;
}

.sqp-modal-loader__spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(92, 26, 26, 0.15);
  border-top-color: var(--sqp-maroon);
  border-radius: 50%;
  animation: sqp-spin 0.85s linear infinite;
}

.sqp-modal-loader__text {
  margin: 0;
  font-size: 1rem;
  color: var(--sqp-muted);
  text-align: center;
}

.sqp-modal-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.sqp-modal-fields.is-loading {
  pointer-events: none;
  min-height: 220px;
}

.sqp-wallets {
  display: grid;
  width: 100%;
  gap: 10px;
  align-items: center;
  justify-items: stretch;
}

.sqp-wallets[data-layout="none"] {
  display: none;
}

/* Apple + Google side by side; Cash App second row centered */
.sqp-wallets[data-layout="apple-google"] {
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "apple google"
    "cash cash";
}

.sqp-wallets[data-layout="apple-google"] #apple-pay-button { grid-area: apple; }
.sqp-wallets[data-layout="apple-google"] #google-pay-button { grid-area: google; }
.sqp-wallets[data-layout="apple-google"] #cash-app-pay {
  grid-area: cash;
  justify-self: center;
  width: min(52%, 220px);
}

/* No Apple: Google + Cash App side by side */
.sqp-wallets[data-layout="google-cash"] {
  grid-template-columns: 1fr 1fr;
}

.sqp-wallets[data-layout="google-cash"] #cash-app-pay {
  width: 100%;
  max-width: none;
  justify-self: stretch;
}

/* Apple + Cash only */
.sqp-wallets[data-layout="apple-cash"] {
  grid-template-columns: 1fr 1fr;
}

.sqp-wallets[data-layout="apple-cash"] #cash-app-pay {
  width: 100%;
  max-width: none;
}

.sqp-wallets[data-layout="single"] {
  grid-template-columns: 1fr;
  justify-items: center;
}

.sqp-wallets[data-layout="single"] .sqp-cap-btn {
  width: min(100%, 260px);
}

.sqp-cap-btn {
  min-height: 44px;
  height: 44px;
  border-radius: 999px;
  overflow: hidden;
  display: flex !important;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 5;
  pointer-events: auto;
  background: #000;
}

.sqp-cap-btn[hidden] {
  display: none !important;
}

.sqp-cap-btn--cash {
  z-index: 8;
  background: transparent;
  overflow: visible;
}

#apple-pay-button > *,
#apple-pay-button iframe,
#apple-pay-button button {
  border-radius: 999px !important;
  width: 100% !important;
  height: 44px !important;
  min-height: 44px !important;
}

#google-pay-button {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}

#google-pay-button > * {
  width: 100% !important;
  height: 44px !important;
  min-height: 44px !important;
  border-radius: 999px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 auto !important;
}

#google-pay-button iframe,
#google-pay-button button {
  margin: 0 auto !important;
  border-radius: 999px !important;
}

.sqp-or-divider {
  text-align: center;
  color: var(--sqp-muted);
  font-size: 1rem;
}

.sqp-card-box {
  width: 100%;
  min-height: 160px;
  border: 1px solid var(--sqp-border);
  border-radius: 10px;
  overflow: visible;
  background: #fff;
  padding: 12px;
}

.sqp-error {
  color: #b42318;
  font-size: 0.95rem;
  font-weight: 600;
  min-height: 1.35em;
  visibility: hidden;
}

.sqp-error.is-visible {
  visibility: visible;
}

.sqp-pay-btn {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: var(--sqp-maroon);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 15px 16px;
  cursor: pointer;
}

.sqp-pay-btn:hover:not(:disabled) {
  background: var(--sqp-maroon-hover);
}

.sqp-pay-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sqp-processing {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 30, 0.88);
  z-index: 100001;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
}

.sqp-processing__spinner {
  width: 56px;
  height: 56px;
  border: 5px solid rgba(255, 255, 255, 0.25);
  border-top-color: #006aff;
  border-radius: 50%;
  animation: sqp-spin 0.9s linear infinite;
}

.sqp-processing__title {
  color: #fff;
  font-size: 18px;
  font-weight: 600;
}

.sqp-processing__sub {
  color: rgba(255, 255, 255, 0.7);
  font-size: 15px;
  text-align: center;
  padding: 0 16px;
}

@keyframes sqp-spin {
  to { transform: rotate(360deg); }
}

body.sqp-modal-open {
  overflow: hidden;
}

@media (max-width: 575.98px) {
  .sqp-modal {
    padding: 0;
    align-items: flex-end;
  }
  .sqp-modal__dialog {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 24px 16px 20px;
  }
  .sqp-wallets[data-layout="apple-google"] #cash-app-pay {
    width: min(70%, 220px);
  }
  .sqp-cap-btn {
    height: 42px;
    min-height: 42px;
  }
}
