/* ===== iPay Loan Department — Design System ===== */
:root {
  --primary: #0b6e6e;
  --primary-light: #14a3a3;
  --primary-dark: #064e4e;
  --accent: #c9922a;
  --accent-light: #e8b84a;
  --surface: #f4f7f7;
  --surface-card: #ffffff;
  --text: #1a2e2e;
  --text-muted: #5a7171;
  --border: #c5d6d6;
  --link: #0b6e6e;
  --shadow: 0 8px 24px rgba(6, 78, 78, 0.12);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;
}

/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow-x: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: #102828;
  max-width: 430px;
  margin: 0 auto;
  width: 100%;
}

/* ===== Brand Logo ===== */
.brand-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--accent-light), var(--accent));
  color: var(--primary-dark);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  border: 3px solid rgba(255, 255, 255, 0.35);
}

.brand-name {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
  max-width: 260px;
}

.brand-tagline {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.85rem;
  font-weight: 500;
}

.brand-logo--banner .brand-mark {
  width: 56px;
  height: 56px;
  font-size: 1.1rem;
  border-radius: 14px;
}

.brand-logo--banner .brand-name {
  font-size: 1.25rem;
}

/* ===== Screen Container ===== */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 100%;
  display: none;
  flex-direction: column;
  transition: opacity 0.3s ease;
}

.screen.active {
  display: flex;
}

/* ===== Splash Screen ===== */
#splash {
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.splash-gradient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(201, 146, 42, 0.25), transparent 45%),
    linear-gradient(160deg, var(--primary-light) 0%, var(--primary) 45%, var(--primary-dark) 100%);
}

.splash-logo {
  position: relative;
  z-index: 1;
  width: 180px;
  height: auto;
  max-width: 70vw;
  mix-blend-mode: screen;
  filter: sepia(1) hue-rotate(148deg) saturate(2.6) brightness(1.08) contrast(1.05);
}

/* ===== Language Screen ===== */
#language {
  background: var(--primary-dark);
  justify-content: center;
  align-items: center;
  padding: 2rem 1.5rem;
}

.lang-bg {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 18px,
      rgba(255, 255, 255, 0.03) 18px,
      rgba(255, 255, 255, 0.03) 36px
    ),
    var(--primary-dark);
}

.brand-logo--lang {
  position: relative;
  z-index: 1;
  margin-bottom: 2rem;
}

.lang-title {
  position: relative;
  z-index: 1;
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-align: center;
}

.lang-subtitle {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.92rem;
  margin-bottom: 2rem;
  text-align: center;
  max-width: 300px;
  line-height: 1.5;
}

.lang-toggle {
  position: relative;
  z-index: 1;
  display: flex;
  background: var(--surface-card);
  border-radius: var(--radius-md);
  padding: 5px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.lang-option {
  flex: 1;
  padding: 12px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.lang-option.active {
  background: var(--primary);
  color: #fff;
}

.lang-footer {
  position: absolute;
  bottom: 2rem;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.78rem;
}

.lang-footer p {
  margin: 0.2rem 0;
}

/* ===== Login Screen ===== */
#login {
  background: #1a3030;
  padding: 0;
}

.login-header {
  flex: 0 0 auto;
  width: 100%;
}

.login-banner {
  min-height: 220px;
  padding: 2.5rem 1.5rem 3rem;
  background:
    radial-gradient(circle at 85% 15%, rgba(201, 146, 42, 0.35), transparent 40%),
    linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
}

.login-banner::after {
  content: '';
  position: absolute;
  bottom: -40px;
  left: -10%;
  width: 120%;
  height: 80px;
  background: var(--surface-card);
  border-radius: 50% 50% 0 0;
}

.login-banner-text {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.88rem;
  text-align: center;
}

.login-card {
  flex: 1;
  background: var(--surface-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  margin-top: -20px;
  padding: 2rem 1.5rem 3rem;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 3;
}

.login-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.login-form .form-group {
  margin-bottom: 1.25rem;
}

.login-form label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.input-row {
  display: flex;
  gap: 8px;
}

.country-code {
  flex: 0 0 110px;
  padding: 12px 28px 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: var(--surface);
  color: var(--text);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235a7171' d='M2 5l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.form-input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
}

.form-input-password {
  width: 100%;
}

.form-input::placeholder {
  color: #8aa0a0;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0 1rem;
  flex-wrap: wrap;
}

.btn-login {
  flex: 1 1 140px;
  min-width: 140px;
  padding: 15px 28px;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary));
  border: none;
  border-radius: var(--radius-pill);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(11, 110, 110, 0.35);
}

.btn-login:active {
  transform: scale(0.98);
}

.link-forgot {
  color: var(--link);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.link-forgot:hover {
  text-decoration: underline;
}

.register-prompt {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.link-register {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.link-register:hover {
  text-decoration: underline;
}

/* ===== OTP Screen ===== */
#otp {
  background: var(--primary-dark);
  padding: 0;
}

.otp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  position: relative;
  z-index: 2;
}

.btn-back, .btn-change {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.otp-illustration {
  flex: 0 0 auto;
  padding: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.otp-graphic {
  position: relative;
  width: 140px;
  height: 160px;
}

.otp-phone {
  width: 90px;
  height: 140px;
  margin: 0 auto;
  border-radius: 18px;
  background: linear-gradient(180deg, #e8f4f4, #c5e0e0);
  border: 3px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  position: relative;
}

.otp-phone-screen {
  position: absolute;
  top: 18px;
  left: 10px;
  right: 10px;
  height: 70px;
  border-radius: 8px;
  background: var(--primary);
  opacity: 0.85;
}

.otp-shield {
  position: absolute;
  right: 0;
  bottom: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--primary-dark);
  font-size: 1.5rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  border: 3px solid #fff;
}

.otp-card {
  flex: 1;
  background: var(--surface-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 2rem 1.5rem 3rem;
  box-shadow: var(--shadow);
}

.otp-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.otp-instruction {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

.otp-inputs {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.otp-input {
  width: 52px;
  height: 52px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  background: var(--surface);
}

.otp-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11, 110, 110, 0.15);
}

.otp-resend {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.link-resend {
  color: var(--link);
  font-weight: 600;
  text-decoration: underline;
}

.btn-verify {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary-light));
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 14px rgba(11, 110, 110, 0.3);
}

.btn-verify:active {
  transform: scale(0.98);
}

.otp-sent {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.phone-masked {
  color: var(--primary);
  font-weight: 700;
}

/* ===== Forgot Password Screen ===== */
#forgot {
  background: var(--primary-dark);
  padding: 0;
}

.forgot-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2.5rem 0;
  min-height: 180px;
}

.forgot-lock {
  position: relative;
  width: 90px;
  height: 110px;
}

.forgot-lock-body {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 72px;
  height: 58px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.forgot-lock-shackle {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 52px;
  height: 52px;
  border: 10px solid #d4dce0;
  border-bottom: none;
  border-radius: 30px 30px 0 0;
}

.forgot-card {
  flex: 1;
  background: var(--surface-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 2rem 1.5rem 3rem;
  box-shadow: var(--shadow);
}

.forgot-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.forgot-instruction {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.45;
}

.forgot-form .form-group {
  margin-bottom: 1.25rem;
}

.forgot-form label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.forgot-form .form-input {
  width: 100%;
}

.btn-submit {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary));
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(11, 110, 110, 0.3);
}

.btn-submit:active {
  transform: scale(0.98);
}

.forgot-back {
  margin-top: 1.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  text-align: center;
}

.link-back-login {
  color: var(--link);
  font-weight: 600;
  text-decoration: underline;
}

[data-goto] {
  cursor: pointer;
}
