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

html {
  overflow: hidden;
  overflow-x: hidden;
  height: 100%;
  width: 100%;
  position: fixed;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #222;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  overflow-x: hidden;
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  background-color: #ffffff;
  -webkit-overflow-scrolling: touch;
  touch-action: manipulation;
}

/* Splash screen */
#splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.6s ease, visibility 0.6s ease;
  overflow: hidden;
  /* Splash uses the Yoco gradient */
  background: linear-gradient(90deg, #A9C4D6 0%, #D8CACA 100%);
}

.splash-content {
  text-align: center;
}

.logo {
  max-width: 50vw;
  width: 260px;
  height: auto;
  display: block;
  margin: 0 auto 1.5rem;
}

/* Circular loader under logo on splash */
.loader-circle {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 3px solid rgba(0, 0, 0, 0.25);
  border-top-color: #000000;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

.splash-loading-text {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.75);
}

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

/* Main content */
#main-content {
  height: 100%;
  min-height: 0;
  max-height: 100vh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow-x: hidden;
  /* Login screen also uses the same gradient */
  background: linear-gradient(90deg, #A9C4D6 0%, #D8CACA 100%);
}

.app-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow-x: hidden;
}

.top-bar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
}

.logo-small {
  height: 40px;
  width: auto;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px;
  background-color: rgba(255, 255, 255, 0.7);
}

.lang-option {
  border: none;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.8rem;
  background: transparent;
  cursor: pointer;
  color: #555;
}

.lang-option.active {
  background-color: #000;
  color: #fff;
}

.auth-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 0.5rem 1.5rem 2rem;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.auth-card {
  width: 100%;
  max-width: min(420px, calc(100vw - 3rem));
  display: flex;
  flex-direction: column;
  min-height: 0;
  background-color: transparent;
  border-radius: 18px;
  padding: 1rem 1.5rem 1.5rem;
  padding-top: 0.5rem;
  box-shadow: none;
}

.auth-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #222;
  margin-bottom: 0.9rem;
  text-align: center;
}

.auth-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0.85rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.field-group label {
  font-size: 0.85rem;
  color: #333;
}

.field-group input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.7);
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  outline: none;
  background-color: transparent;
  color: #222;
}

.field-group input::placeholder {
  color: rgba(0, 0, 0, 0.35);
}

.field-group input:focus {
  border-color: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.password-wrapper {
  display: flex;
  align-items: center;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.7);
  background-color: transparent;
  padding-right: 0.25rem;
}

.password-wrapper input {
  border: none;
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
}

.password-wrapper input:focus {
  box-shadow: none;
}

.icon-button {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0.4rem 0.5rem;
  font-size: 1.1rem;
}

.icon-eye svg {
  width: 20px;
  height: 20px;
  display: block;
  color: rgba(0, 0, 0, 0.45);
}

.forgot-password {
  margin-top: -0.3rem;
  font-size: 0.9rem;
  align-self: flex-start;
}

.primary-button {
  margin-top: 1rem;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  background-color: #d0d0d0;
  color: #555555;
  cursor: pointer;
}

/* Login page: push Continue button to bottom */
.auth-form .primary-button {
  margin-top: auto;
}

.primary-button:disabled {
  background-color: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.3);
  cursor: not-allowed;
}

/* When keyboard is open, move buttons slightly up so they stay visible */
body.keyboard-open .auth-form .primary-button {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

body.keyboard-open .otp-form .primary-button {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.signup-text {
  margin-top: 1.1rem;
  text-align: center;
  font-size: 0.9rem;
  color: rgba(0, 0, 0, 0.75);
}

.link-button {
  border: none;
  background: transparent;
  padding: 0;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}

.signup-text .link-button {
  color: rgba(0, 0, 0, 0.85);
}

/* OTP screen */
.otp-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem 1.5rem 2rem;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.otp-card {
  width: 100%;
  max-width: min(420px, calc(100vw - 3rem));
  background-color: transparent;
  border-radius: 18px;
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: none;
}

.otp-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #222;
  margin-bottom: 0.6rem;
  text-align: center;
}

.otp-message {
  font-size: 0.9rem;
  color: rgba(0, 0, 0, 0.7);
  margin-bottom: 1.2rem;
  text-align: center;
}

.otp-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.otp-footer {
  margin-top: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.otp-error {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #d93025;
  text-align: left;
}

.otp-timer-text {
  color: rgba(0, 0, 0, 0.7);
}

.resend-button {
  border-radius: 999px;
  border: none;
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: not-allowed;
  background-color: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.35);
}

.resend-button.enabled {
  cursor: pointer;
  background-color: #000000;
  color: #ffffff;
}

/* Utility */
.hidden {
  display: none;
}

/* Responsive tweaks */
@media (min-width: 768px) {
  .auth-wrapper {
    align-items: center;
    padding-top: 0;
  }
}

