/* --- BASE STYLES --- */
body {
  font-family: "Google Sans", roboto, "Noto Sans Myanmar UI", "Noto Sans Khmer", arial, sans-serif;
  background: #f0f4f9;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
}

main {
  width: 100%;
  max-width: 1024px;
}

#signin-area {
  position: relative;
  background: white;
  min-height: 384px;
  border-radius: 28px;
  padding: 36px;
  box-sizing: border-box;
  overflow: hidden; /* keep for rounded corners + progress bar */
}

/* --- TYPOGRAPHY & LAYOUT --- */
h1 {
  font-weight: 400;
  font-size: 2.5rem;
  margin-bottom: 8px;
}

h2 {
  font-weight: 400;
  font-size: 1em;
}

#login-body {
  display: flex;
}

aside {
  flex-basis: 50%;
}

/* --- THE SLIDER (TRUE "PUSH" LOGIC) --- */
#login-form {
  flex-basis: 50%;
  position: relative;

  /* IMPORTANT:
     We only want to clip sideways motion, not vertical content */
  overflow-x: hidden;
  overflow-y: visible;
}

/* Track */
#form-slider {
  display: flex;
  width: 200%;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

/* Each step is a full viewport of #login-form */
.form-step {
  flex: 0 0 100%;
  box-sizing: border-box;
  padding-right: 2px;
}

/* Added by JS: move 1 full "page"
   (50% of a 200% track == 100% of the viewport) */
#form-slider.slide-to-step-2 {
  transform: translateX(-50%);
}

/* --- INPUTS & LABELS --- */
.input-container {
  position: relative;
  margin-top: 20px;
  width: 100%;
  max-width: 400px;
  font-family: 'Roboto', sans-serif;
}

.input-container input {
  width: 100%;
  padding: 16px 14px;
  border: 1px solid #747775;
  border-radius: 4px;
  font-size: 16px;
  background: transparent;
  outline: none;
  color: #1f1f1f;
  transition: border 0.2s ease;
  display: block;
  box-sizing: border-box;
}

.input-container label {
  position: absolute;
  left: 14px;
  top: 16px;
  font-size: 16px;
  color: #444746;
  background-color: white;
  padding: 0 4px;
  transition: all 0.2s ease;
  pointer-events: none;
  transform-origin: top left;
}

.input-container input:focus + label,
.input-container input:not(:placeholder-shown) + label {
  top: -10px;
  left: 10px;
  font-size: 12px;
  color: #0b57d0;
  font-weight: 500;
}

.input-container input:focus {
  border: 2px solid #0b57d0;
}

/* --- TEXT / LINKS --- */
#login-form p {
  margin-top: 10px;
  font-size: 0.875rem;
  line-height: 1.42;
  max-width: 400px; /* align with input width */
}

#login-form a {
  color: #0b57d0;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

#login-form a:hover {
  text-decoration: underline;
}

/* --- BUTTONS --- */
button {
  border-radius: 999px;
  padding: 10px 24px;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s;
}

/* This ID is duplicated in your HTML (step-1 + step-2),
   so we style by step container to be deterministic. */
#step-1 #submit-buttons,
#step-2 #submit-buttons {
  margin-top: 40px;
  display: flex;
  align-items: center;
  justify-content: right; /* Create account left, Next right */
  width: 100%;
  max-width: 400px; /* align with input width */
}

/* Create account = "link button" */
#create-account {
  background: transparent;
  color: #0b57d0;
  padding: 10px 12px;
}

#create-account:hover {
  background: rgba(11, 87, 208, 0.08);
}

/* Next (step 1) */
#submit {
  background: #0b57d0;
  color: white;
}

#submit:hover {
  background: #0a4bb3;
  box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.25);
}

/* Next (step 2) – your HTML uses #final-submit with inline styles;
   these rules ensure it’s visible, aligned, and consistent. */
#final-submit {
  background: #0b57d0;
  color: #fff;
  border-radius: 999px;
  padding: 10px 24px;
}

#final-submit:hover {
  background: #0a4bb3;
  box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.25);
}

/* --- USER BADGE --- */
#user-badge {
  display: flex;
  align-items: center;
  padding: 4px 12px 4px 4px;
  border: 1px solid #dadce0;
  border-radius: 16px;
  width: fit-content;
  margin-top: 16px;
  cursor: pointer;
}

#user-badge img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin-right: 8px;
  background: #f1f3f4;
}
/* Avatar circle crop (show TOP of rectangular images, no squish) */
#user-badge img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;       /* crop instead of stretch */
  object-position: top;    /* anchor crop to the top */
  display: block;
  overflow: hidden;
}

/* --- FOOTER & LANG PICKER --- */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 18px;
}

.lang-picker-trigger {
  display: flex;
  align-items: center;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  border: none;
  padding: 8px 12px;
}

.lang-menu {
  position: absolute;
  bottom: calc(100% + 4px);
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  display: none;
  z-index: 1000;
  list-style: none;
  padding: 8px 0;
}

.lang-menu.show { display: block; }

#terms a {
  margin-left: 24px;
  color: #444746;
  text-decoration: none;
  font-size: 12px;
}

/* --- LOADING ANIMATION --- */
.progress-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  display: none;
}

.progress-bar {
  width: 100%;
  height: 100%;
  background-color: #0b57d0;
  animation: indeterminate .75s infinite linear;
  transform-origin: 0% 50%;
}

@keyframes indeterminate {
  0% { transform: translateX(-100%) scaleX(0.2); }
  50% { transform: translateX(0%) scaleX(0.5); }
  100% { transform: translateX(100%) scaleX(0.2); }
}

#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(255, 255, 255, 0.44);
  display: none;
  z-index: 999;
}

/* --- INPUT ERROR STATE --- */

.input-container.error input {
  border: 2px solid #d93025 !important;
}

.input-container.error label {
  color: #d93025 !important;
}

.input-container.error input:focus {
  border: 2px solid #d93025 !important;
}


/* =========================
   Responsive (Mobile)
   ========================= */

/* Let the page breathe on small screens */
@media (max-width: 720px) {
  body {
    align-items: flex-start;      /* don't vertically center on phones */
    height: auto;                 /* avoid weird cropping */
    padding: 24px 12px;
  }

  main {
    max-width: 520px;             /* narrower card on phones */
    width: 100%;
  }

  #signin-area {
    padding: 24px;                /* tighter padding */
    border-radius: 20px;
    min-height: auto;             /* allow it to grow naturally */
  }

  /* Stack the two columns */
  #login-body {
    flex-direction: column;
    gap: 16px;
  }

  aside,
  #login-form {
    flex-basis: auto;
    width: 100%;
  }

  /* Make headings scale down */
  h1 {
    font-size: 2rem;
    margin-top: 4px;
    margin-bottom: 6px;
  }

  h2 {
    font-size: 0.95rem;
    margin-top: 0;
  }

  /* Inputs + action areas should be full width now */
  .input-container,
  #action-area,
  #step-1 #submit-buttons,
  #step-2 #submit-buttons,
  #login-form p {
    max-width: 100%;
  }

  /* Give action buttons a bit more comfortable spacing */
  #action-area,
  #step-1 #submit-buttons,
  #step-2 #submit-buttons {
    margin-top: 24px;
  }

  /* Footer stacks nicely on mobile */
  footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-top: 18px;
  }

  #terms a {
    margin-left: 0;
    margin-right: 16px;
  }
}

/* Extra-small phones */
@media (max-width: 420px) {
  #signin-area {
    padding: 18px;
    border-radius: 18px;
  }

  h1 {
    font-size: 1.75rem;
  }

  /* Buttons still align left/right, but shrink padding a bit */
  #submit,
  #final-submit {
    padding: 10px 18px;
  }
}



/* =========================
   Mobile: no slide, hard swap
   ========================= */
@media (max-width: 720px) {
  /* turn the slider track into a normal block */
  #form-slider {
    width: 100% !important;
    display: block !important;
    transform: none !important;
    transition: none !important;
  }

  /* steps become normal blocks */
  .form-step {
    width: 100% !important;
    flex: none !important;
  }

  /* default: only show step 1 on mobile */
  #step-2 {
    display: none;
  }

  /* make sure form elements fit the card */
  .input-container,
  #action-area,
  #step-1 #submit-buttons,
  #step-2 #submit-buttons,
  #login-form p {
    width: 100%;
    max-width: 100%;
  }
}