/* Reset & base – mobile fixed layout, no page scroll */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: 100vw;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: 100vw;
  overflow: hidden;
  background: #fff;
  color: #333;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.hidden {
  display: none !important;
}

/* ========== Splash Screen ========== */
.splash-screen {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: 100vw;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.4s ease;
  overflow: hidden;
}

.splash-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-content {
  display: flex;
  align-items: center;
  justify-content: center;
}

.splash-logo {
  max-width: 180px;
  width: 50vw;
  height: auto;
  object-fit: contain;
}

/* Shared full-screen loader (same as splash) */
.app-loader {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: 100vw;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  overflow: hidden;
}

.app-loader .splash-content {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========== Login Screen ========== */
.login-screen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  padding: 0 calc(24px + env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-left));
  padding-top: calc(52px + env(safe-area-inset-top));
  overflow: hidden;
}

/* Top bar - language toggle */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  min-height: 44px;
  padding-top: env(safe-area-inset-top);
  padding-left: calc(20px + env(safe-area-inset-left));
  padding-right: calc(20px + env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background: #fff;
  border-bottom: 1px solid #eee;
  z-index: 10;
}

.lang-toggle {
  background: none;
  border: none;
  font-size: 15px;
  color: #0066cc;
  cursor: pointer;
  padding: 6px 0;
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.lang-toggle:hover {
  text-decoration: underline;
}

/* Header */
.login-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}

.bir-id-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  color: #333;
}

.bir-id-icon {
  font-size: 12px;
  color: #0066cc;
}

/* Main content */
.login-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.logo-circle {
  /* Remove circular background, just use as a simple container */
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo {
  width: 120px; /* make logo bigger on login & OTP */
  height: auto;
  object-fit: contain;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.3;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 15px;
  color: #6b7280;
  margin-bottom: 24px;
}

/* Form */
.login-form {
  width: 100%;
}

.input-wrapper {
  margin-bottom: 20px;
}

.input-label {
  display: block;
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 6px;
  text-align: left;
}

.password-input-wrapper .input-label {
  text-align: center;
}

.phone-input-row {
  display: flex;
  align-items: center;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 4px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.phone-input-row:focus-within {
  border-color: #0066cc;
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.15);
}

.country-code {
  font-size: 15px;
  color: #374151;
  margin-right: 8px;
  padding-right: 8px;
  border-right: 1px solid #e5e7eb;
}

.phone-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16px; /* avoid iOS zoom on focus */
  padding: 12px 0;
  color: #111;
  outline: none;
  min-width: 0;
}

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

/* Password - 4 boxes */
.password-boxes {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.password-box {
  width: 52px;
  height: 52px;
  min-width: 44px;
  min-height: 44px;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  color: #111;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  touch-action: manipulation;
}

.password-box:focus {
  border-color: #0066cc;
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.15);
}

.password-box::placeholder {
  color: #9ca3af;
}

.btn-continue {
  width: 100%;
  padding: 14px 24px;
  min-height: 48px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: #1e3a5f;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-continue:hover {
  background: #152a47;
}

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

/* Footer */
.login-footer {
  margin-top: auto;
  padding-top: 32px;
  text-align: center;
}

.login-footer p {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}

.terms-link {
  color: #0066cc;
  text-decoration: none;
}

.terms-link:hover {
  text-decoration: underline;
}

/* ========== OTP Screen ========== */
.otp-screen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  padding: 0 calc(24px + env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-left));
  padding-top: calc(56px + env(safe-area-inset-top));
  overflow: hidden;
}

.otp-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  min-height: 48px;
  padding-top: env(safe-area-inset-top);
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid #eee;
  z-index: 10;
}

.otp-back {
  background: none;
  border: none;
  font-size: 24px;
  color: #111;
  cursor: pointer;
  padding: 4px 8px;
  min-height: 44px;
  min-width: 44px;
  line-height: 1;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.otp-header-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  color: #333;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.otp-close {
  font-size: 15px;
  color: #0066cc;
  text-decoration: none;
}

.otp-close:hover {
  text-decoration: underline;
}

.otp-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.otp-title {
  font-size: 22px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.3;
  margin-bottom: 12px;
}

.otp-instruction {
  font-size: 14px;
  color: #6b7280;
  line-height: 1.5;
  margin-bottom: 24px;
}

.otp-input-wrapper {
  width: 100%;
  margin-bottom: 16px;
}

.otp-input {
  width: 100%;
  padding: 14px 16px;
  min-height: 48px;
  font-size: 18px;
  letter-spacing: 0.25em;
  text-align: center;
  color: #111;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  touch-action: manipulation;
}

.otp-input:focus {
  border-color: #0066cc;
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.15);
}

.otp-input::placeholder {
  color: #9ca3af;
  letter-spacing: normal;
}

.otp-resend {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

.otp-timer {
  font-weight: 600;
  color: #111;
}

.otp-resend-btn {
  background: none;
  border: none;
  font-size: 14px;
  color: #0066cc;
  cursor: pointer;
  padding: 0 4px;
  margin-left: 4px;
}

.otp-resend-btn:hover {
  text-decoration: underline;
}

.otp-timer-end-msg {
  width: 100%;
  margin-bottom: 16px;
  text-align: center;
}

.otp-timer-end-text {
  font-size: 14px;
  color: #6b7280;
  line-height: 1.5;
  margin-bottom: 12px;
}

.btn-back-to-home {
  display: block;
  width: 100%;
  padding: 12px 24px;
  min-height: 48px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: #1e3a5f;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-back-to-home:hover {
  background: #152a47;
}

.otp-error {
  color: #b91c1c;
  font-size: 14px;
  margin-bottom: 16px;
  text-align: center;
}

.btn-otp-continue {
  margin-top: 8px;
}

/* OTP full-screen loader */
.otp-loader {
  position: fixed;
  inset: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.otp-loader-content {
  display: flex;
  align-items: center;
  justify-content: center;
}

.otp-loader .splash-logo {
  max-width: 180px;
  width: 50vw;
  height: auto;
  object-fit: contain;
}

.otp-footer {
  margin-top: auto;
}

/* Mobile: very small screens */
@media (max-width: 360px) {
  .splash-logo {
    max-width: 140px;
  }
  .login-title {
    font-size: 20px;
  }
  .otp-title {
    font-size: 20px;
  }
  .password-boxes {
    gap: 6px;
  }
  .password-box {
    width: 46px;
    height: 46px;
    min-width: 40px;
    min-height: 40px;
    font-size: 18px;
  }
}
