/* ===== RESET ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

html,
body {
  height: 100%
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #fff;
  color: #111;
  -webkit-font-smoothing: antialiased;
}

/* ===== HEADER ===== */
.header {
  height: 64px;
  background: #000;
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 64px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  font-size: 28px;
  font-weight: 400;
}

/* ===== PAGE ===== */
/* Page container */
.page {
  width: 100%;
  max-width: 380px;
  /* MATCH REFERENCE: Narrower, app-like width */
  background-color: #fff;
  padding: 0 16px;
  /* Reduced padding for compact look */
  box-sizing: border-box;
  margin: 80px auto 0 auto;
  position: relative;
}

/* ===== TEXT ===== */
h1 {
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 10px;
  padding-top: 10px;
}

/* ===== INPUT AREA ===== */
.input-container {
  position: relative;
  width: 100%;
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  overflow: hidden;
  /* ensure no overflow */
}

/* country pill (hidden by default) */
.country {
  display: none;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 12px;
  background: #f6f6f6;
  border-radius: 10px;
  white-space: nowrap;
  cursor: pointer;
  flex: 0 0 auto;
  /* fixed size */
  min-width: 96px !important;
  /* prevent collapse */
  max-width: 96px;
}

.country .left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Updated for Text Code (IN) instead of Emoji */
.flag {
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  color: #000;
  gap: 6px;
}

.flag img {
  width: 24px;
  height: auto;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.caret {
  font-size: 18px;
  color: #666;
  margin-left: 6px;
}

/* full input wrapper containing dial + input */
.login-input-full {
  flex: 1 1 0%;
  min-width: 0;
  /* critical for flex shrink */
  height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: #e7e7e7;
  border-radius: 10px;
}

.login-input-full .dial {
  display: none;
  /* hidden until active */
  font-size: 15px;
  color: #111;
}

.login-input-full input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
  padding: 9px 4px;
}

/* show country & dial when input has value -> .active on input-wrap */
.input-wrap.active .country {
  display: flex;
}

.input-wrap.active .login-input-full .dial {
  display: inline-block;
}

/* focus styling for the group */
.login-input-full:focus-within {
  box-shadow: none;
  outline: none;
  border-radius: 10px;
  border: 2px solid #000;
}

/* placeholder color */
.login-input-full input::placeholder {
  color: #5e5e5e
}

/* ===== DROPDOWN ===== */
.dropdown {
  position: absolute;
  left: 0;
  top: calc(100% + 10px);
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  display: none;
  z-index: 120;
  max-height: 360px;
  overflow: auto;
  width: 100%;
}

.dd-item {
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  gap: 12px;
  font-size: 15px;
}

.dd-item .left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dd-item .dd-flag {
  font-size: 32px;
  line-height: 1;
}

.dd-item:hover {
  background: #f6f6f6;
}

/* ===== BUTTONS ===== */
.btn {
  width: 100%;
  height: 48px;
  border-radius: 10px;
  border: 0;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 14px;
}

.btn.primary {
  background: #000;
  color: #fff;
}

.btn.primary:disabled {
  background: #e6e6e6;
  color: #9a9a9a;
  cursor: not-allowed;
}

.btn.secondary {
  background: #ececec;
  color: #111;
  align-content: center;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  font-size: 16px;
  font-weight: 400;
  pointer-events: none;
  cursor: default;
}

/* OR separator */
.or {
  display: flex;
  align-items: center;
  margin: 18px 0 0 0;
  font-size: 14px;
  color: #3b3b3b;
}

.or::before,
.or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #313131
}

.or span {
  margin: 0 9px
}

/* ===== OTP ===== */
.state {
  display: none;
}

.state.active {
  display: block;
}

.otp-row {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.otp-row input {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: none;
  font-size: 22px;
  text-align: center;
  margin-top: 22px;
  background-color: #ececec;
}

.otp-row input:focus {
  border: 2px solid #000;
  outline: none;
  background-color: #fff;
}

/* nav */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
}

.icon-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 0;
  background: #f3f3f3;
  font-size: 22px;
  cursor: pointer;
  font-weight: 500;
  margin-top: 50px;
  align-content: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.third-btn {
  margin-top: 15px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 10px;
  background-color: #ececec;
  max-width: fit-content;
  border-radius: 22px;
}

.third-btn-first {
  margin-top: 40px;
}


/* modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-box {
  width: 320px;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, .28)
}

.modal-opt {
  padding: 22px 8px;
  border-bottom: 1px solid #fdfdfd;
  cursor: pointer
}

.modal-opt:last-child {
  border-bottom: none
}

/* responsive */
@media(max-width:480px) {
  .page {
    margin-top: 80px;
    /* Reduced top margin for mobile */
    padding: 0 20px;
    width: 100%;
    max-width: 100%;
  }

  .dropdown {
    left: 0;
    right: 0;
  }

  .header {
    padding: 0 16px;
    font-size: 24px;
    height: 56px;
  }
}

/* input wrapper (re-declared purposely to match original) */
.login-input-full {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 14px;
  background: #f6f6f6;
  border-radius: 10px;
}

.login-input-full:focus-within {
  border: 2px solid #000;
}

.login-input-full input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  flex: 1;
}

#errorText {
  margin-top: 2px;
  margin-bottom: 0;
  font-size: 14px;
  color: #d60e00;
  min-height: 16px;
}

/* when error message exists → add gap below */
#errorText:not(:empty) {
  margin-bottom: 10px;
}


.continue-btn {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 10px;
  background: #000;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

/* loading look */
.continue-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

.terms {
  font-size: 12px;
  color: #5f5f5f;
  margin-top: 18px;
  line-height: 1.7;
  font-weight: 500;
}

.second-h1 {
  font-weight: 700;
  padding-top: 20px;
  margin: 0;
}

#masked {
  font-size: 24px;
  font-weight: 700;
  white-space: nowrap;
  display: inline;
}

/* second row container */
.otp-sub {
  display: flex;
  align-items: center;
  gap: 7px;
}

/* left label ("via SMS at") */
.otp-label {
  flex: 0 0 auto;
  /* stays its natural width */
  font-size: 24px;
  font-weight: 700;
  color: #1f1f1f;
  white-space: nowrap;
}

/* right: the number — will shrink to fit but won't wrap mid-number */
.otp-number {
  flex: 1 1 0;
  /* take remaining space, but can shrink */
  font-weight: 700;
  color: #111;
  font-size: clamp(16px, 2.4vw, 20px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


#nextBtn {
  border-radius: 24px;
  background-color: #f1f1f1;
  margin-top: 50px;
  align-content: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

#nextBtn:disabled {
  background-color: #e6e6e6;
  color: #9a9a9a;
  cursor: not-allowed;
}

#nextBtn:enabled {
  background-color: #000;
  color: #fff;
  cursor: pointer;
}

/* Overlay / modal center */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  /* darker overlay like screenshot */
  z-index: 9999;
  padding: 20px;
  -webkit-font-smoothing: antialiased;
}

/* Header bar (first child of .modal) */
.modal .modal-header {
  width: min(500px, 92vw);
  height: 52px;
  background: #fff;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  border: 1px solid #e6e6e6;
  border-bottom: 0;
  /* connect to the box below */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 500;
  color: #111;
  position: relative;
  box-sizing: border-box;
}

/* close X in the header (real element) */
.modal .modal-close {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #111;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  background: transparent;
  border: 0;
}

/* hide default HR or style it as thin separator */
.modal>hr {
  width: min(500px, 92vw);
  margin: 0;
  border: 0;
  border-top: 1px solid #e9e9e9;
  box-sizing: border-box;
}

/* Main modal content box */
.modal .modal-box {
  width: min(500px, 92vw);
  background: #fff;
  border: 1px solid #e6e6e6;
  border-top: 0;
  /* header already has top border */
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  padding: 20px 20px 12px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.18);
  box-sizing: border-box;
}

/* Title inside modal-box */
.modal .modal-box>div:first-child {
  font-size: 16px;
  /* close to screenshot */
  font-weight: 700;
  margin-bottom: 12px;
  color: #111;
}

/* Option rows (list items) */
.modal .modal-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 6px;
  cursor: pointer;
  font-size: 15px;
  color: #111;
  background: transparent;
  user-select: none;
}

/* icon slot */
.modal .modal-opt svg {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: block;
  color: #111;
  /* currentColor fills path using currentColor */
  margin-left: 6px;
}

/* text inside option */
.modal .modal-opt {
  padding-left: 8px;
  padding-right: 8px;
}

/* thin divider between option rows */
.modal .modal-opt+.modal-opt {
  border-top: 1px solid #f0f0f0;
}

/* last row: remove top-border if it's the first option (avoid double) */
.modal .modal-opt:first-of-type {
  border-top: none;
}

/* ensure the 'Email' row icon lines up with others and text weight */
.modal .modal-opt svg {
  color: #111;
}

.modal .modal-opt {
  font-weight: 500;
}

@media (max-width:420px) {

  .modal .modal-header,
  .modal>hr,
  .modal .modal-box {
    width: calc(100% - 32px);
  }

  .modal .modal-header .modal-close {
    right: 10px;
  }

  .modal .modal-box {
    padding: 14px;
  }

  .modal .modal-opt {
    padding: 10px 6px;
    font-size: 14px;
  }

  .modal .modal-opt svg {
    width: 20px;
    height: 20px;
  }
}

.second-h2 {
  margin-bottom: 15px;
}

.input-container-second {
  margin-top: 25px;
}

/* Email OTP text */
.email-text {
  font-size: 15px;
  color: #555;
  margin-top: 6px;
}

/* OTP container */
.otp-container {
  display: flex;
  gap: 12px;
  margin: 20px 0 12px;
}

.otp-input {
  width: 52px;
  height: 56px;
  font-size: 22px;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 8px;
}

/* Tip text */
.otp-tip {
  font-size: 13px;
  color: #696969;
  margin-top: 10px;
  margin-bottom: 40px;
}

/* Bottom buttons */
.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.btn-outline {
  flex: 1;
  height: 48px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
}

.btn-primary {
  flex: 1;
  height: 48px;
  border-radius: 8px;
  background: #000;
  color: #fff;
}

.nextBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  height: 44px;
  /* locks visual height */
  padding: 0 18px;
  /* balanced horizontal padding */
  gap: 6px;
  /* space between text & arrow */
  margin-top: 20px;
  border-radius: 22px;
  min-width: fit-content;

  font-size: 15px;
  font-weight: 500;
  line-height: 1;

  transition:
    background-color 0.2s ease,
    opacity 0.2s ease,
    transform 0.1s ease;
}

.nav .nextBtn {
  position: relative;
  top: 15px;
}

.shake {
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  75% {
    transform: translateX(5px);
  }
}