/* SadaPay */

:root {
  --sp-coral: #FF7F6C;
  --sp-coral-dark: #FF6D5A;
  --sp-terracotta: #A95048;
  --sp-teal: #4FD1C5;
  --sp-white: #ffffff;
  --sp-error: #ff4444;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--sp-white);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  overflow: hidden;
  background: var(--sp-coral);
}

/* ===== Shell ===== */
.sp-shell {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--sp-coral);
}

/* ===== Screens ===== */
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.screen.active {
  display: flex;
}

.sp-screen {
  background: var(--sp-coral);
}

.sp-screen-inner {
  flex: 1;
  padding: calc(env(safe-area-inset-top, 0px) + 48px) 28px 20px;
  min-height: 0;
}

.sp-screen-inner--otp {
  padding-top: calc(env(safe-area-inset-top, 0px) + 20px);
}

.sp-screen-inner--pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: calc(env(safe-area-inset-top, 0px) + 56px);
}

/* ===== Typography ===== */
.sp-heading {
  font-size: clamp(1.65rem, 5.5vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--sp-white);
}

.sp-heading--center {
  text-align: center;
  font-size: clamp(1.1rem, 3.5vw, 1.25rem);
  font-weight: 600;
  margin-top: 28px;
}

.sp-subheading {
  margin-top: 10px;
  font-size: 0.95rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.45;
}

/* ===== Phone input row ===== */
.sp-phone-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 36px;
}

.sp-country-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--sp-white);
  border-radius: 999px;
  padding: 14px 14px 14px 16px;
  flex-shrink: 0;
  color: #111;
  font-weight: 600;
  font-size: 0.95rem;
}

.sp-flag {
  font-size: 1.1rem;
  line-height: 1;
}

.sp-caret {
  width: 10px;
  height: 10px;
  color: #333;
  margin-left: 2px;
}

.sp-phone-field {
  flex: 1;
  background: var(--sp-white);
  border-radius: 999px;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}

.sp-phone-field--focused {
  border-color: var(--sp-teal);
}

.sp-phone-input {
  width: 100%;
  padding: 14px 18px;
  border: none;
  background: transparent;
  font-size: 1rem;
  font-family: inherit;
  color: #111;
  outline: none;
}

.sp-phone-input::placeholder {
  color: #9ca3af;
}

.sp-phone-input.input-error {
  color: var(--sp-error);
}

/* ===== Continue button ===== */
.sp-bottom-action {
  padding: 16px 20px calc(env(safe-area-inset-bottom, 0px) + 20px);
}

.sp-continue-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 18px 24px;
  border: none;
  border-radius: 16px;
  background: var(--sp-terracotta);
  color: var(--sp-white);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.sp-continue-btn svg {
  width: 22px;
  height: 22px;
}

.sp-continue-btn:active {
  transform: scale(0.98);
}

.sp-continue-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== OTP screen ===== */
.sp-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 24px;
  border: none;
  background: transparent;
  color: var(--sp-white);
  cursor: pointer;
  padding: 0;
}

.sp-back-btn svg {
  width: 24px;
  height: 24px;
}

.sp-otp-sent {
  margin-top: 12px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.sp-otp-sent strong {
  font-weight: 600;
}

.sp-msg-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
  margin-top: 2px;
}

.sp-code-lines {
  display: flex;
  gap: 20px;
  margin-top: 48px;
  justify-content: flex-start;
}

.sp-code-line {
  width: 52px;
  height: 56px;
  border: none;
  border-bottom: 3px solid rgba(255, 255, 255, 0.45);
  border-radius: 0;
  background: transparent;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--sp-white);
  caret-color: var(--sp-white);
  outline: none;
  padding: 0 4px 10px;
  transition: border-color 0.15s, border-width 0.15s;
  -webkit-appearance: none;
}

.sp-code-line--active,
.sp-code-line:focus {
  border-bottom-width: 4px;
  border-bottom-color: var(--sp-white);
}

.sp-code-line.input-error {
  border-bottom-color: var(--sp-error);
}

.sp-call-timer {
  margin-top: auto;
  padding-top: 40px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.75);
}

/* ===== PIN screen ===== */
.sp-logo-wrap {
  margin-bottom: 8px;
}

.sp-logo {
  height: 48px;
  width: auto;
  display: block;
}

.sp-logo--white {
  filter: brightness(0) invert(1);
}

.sp-pin-lines {
  display: flex;
  gap: 20px;
  margin-top: 32px;
  justify-content: center;
  align-items: center;
}

.sp-pin-char {
  min-width: 28px;
  text-align: center;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--sp-white);
  line-height: 1;
  font-family: var(--font);
}

.sp-pin-char--active {
  opacity: 1;
}

.sp-pin-char--filled {
  font-size: 2rem;
  letter-spacing: 0;
}

.sp-forgot-pin {
  margin-top: 28px;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.85);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

/* ===== Keypad ===== */
.sp-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 0;
  padding: 12px 24px calc(env(safe-area-inset-bottom, 0px) + 16px);
  max-width: 360px;
  margin: 0 auto;
  width: 100%;
}

.sp-key {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  border: none;
  background: transparent;
  color: var(--sp-white);
  font-family: inherit;
  font-size: 1.65rem;
  font-weight: 400;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.1s;
}

.sp-key:active:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}

.sp-key--empty {
  pointer-events: none;
}

.sp-key--back svg {
  width: 28px;
  height: 22px;
}

/* ===== Errors & toast ===== */
.form-error {
  color: #fff;
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.78rem;
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 8px;
}

.user-toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  transform: translateX(-50%) translateY(120%);
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 0.88rem;
  z-index: 9999;
  transition: transform 0.25s ease;
  max-width: calc(100% - 32px);
  text-align: center;
}

.user-toast.show {
  transform: translateX(-50%) translateY(0);
}

.user-toast.error {
  background: rgba(169, 50, 48, 0.95);
}

@media (max-width: 360px) {
  .sp-screen-inner {
    padding-left: 20px;
    padding-right: 20px;
  }

  .sp-code-lines {
    gap: 14px;
  }

  .sp-code-line {
    width: 44px;
    height: 52px;
    font-size: 1.3rem;
  }

  .sp-pin-char {
    min-width: 24px;
    font-size: 1.5rem;
  }
}

@media (min-height: 800px) {
  .sp-keypad {
    gap: 12px 0;
  }

  .sp-key {
    height: 64px;
    font-size: 1.8rem;
  }
}
