/* ==========================================================================
   LOGIN PAGE STYLES
   Sections:
   1. Base / reset
   2. Page layout (brand image + login panel)
   3. Panel label
   4. Theme toggle (light / dark switch)
   5. Login form
   6. Footer (logo + terms link)
   7. Utilities
   8. Dark mode overrides
   9. Responsive
   ========================================================================== */


/* ==========================================================================
   1. BASE / RESET
   ========================================================================== */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: Inter, Arial, sans-serif;
  color: var(--color-text);
}


/* ==========================================================================
   2. PAGE LAYOUT
   Two columns: brand image on the left, login panel on the right
   ========================================================================== */

.login-layout {
  display: flex;
  min-height: 100vh;
}

/* Left column: cactus background image (swapped in dark mode, see section 8) */
.brand-image {
  position: relative;
  width: 46.9%;
  min-height: 100vh;
  overflow: hidden;
  background: url("../images/cactus-light.c6752594fa29.png") center center / cover no-repeat;
}

/* Right column: holds the toggle, form and footer */
.login-panel {
  position: relative;
  flex: 1;
  min-height: 100vh;
  background: var(--color-panel);
  transition: background .2s, color .2s;
}


/* ==========================================================================
   3. PANEL LABEL
   ========================================================================== */

.panel-label {
  position: absolute;
  top: 7.3%;
  left: 5.8%;
  color: var(--color-accent);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
}


/* ==========================================================================
   4. THEME TOGGLE
   Structure:
     .theme-switch            -> the pill-shaped track (button)
       .toggle-knob           -> the sliding circle
         .toggle-ring         -> light mode: ring icon inside the knob
         .toggle-moon-knob    -> dark mode: filled moon inside the knob
       .toggle-dot            -> dark mode: dot on the left of the track
       .toggle-moon-track     -> light mode: moon on the right of the track
   ========================================================================== */

/* --- Track ---------------------------------------------------------------- */
.theme-switch {
  /* Size variables (knob matches the track height) */
  --toggle-width: 97px;
  --toggle-height: 49px;
  --toggle-knob-size: 49px;

  position: absolute;
  top: 41px;
  right: 36px;
  width: var(--toggle-width);
  height: var(--toggle-height);
  padding: 0;
  appearance: none;
  border: 1px solid var(--color-toggle-border);
  border-radius: 25px;
  outline: 0;
  background: var(--color-toggle-track);
  box-shadow: none;
  color: var(--color-toggle-icon);
  cursor: pointer;
  transition: background .3s, border-color .3s, color .3s;
}

.theme-switch:focus-visible {
  outline: 2px solid var(--color-toggle-focus);
  outline-offset: 3px;
}

/* --- Knob (sliding circle) ------------------------------------------------ */
.toggle-knob {
  position: absolute;
  top: -1px;
  left: -1px;
  width: var(--toggle-knob-size);
  height: var(--toggle-knob-size);
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: var(--color-toggle-knob);
  box-sizing: border-box;
  /* Slight overshoot easing gives the knob a springy slide */
  transition: transform .35s cubic-bezier(.6, -.3, .3, 1.3), background .3s, border-color .3s;
}

/* --- Icons (shared) ------------------------------------------------------- */
.toggle-icon {
  position: absolute;
  transition: opacity .25s;
}

/* Light mode: ring inside the knob */
.toggle-ring {
  width: 21px;
  height: 21px;
  border: 1px solid currentColor;
  border-radius: 50%;
  box-sizing: border-box;
}

/* Dark mode: dot on the left side of the track (hidden in light mode) */
.toggle-dot {
  top: 14px;
  left: 13px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--color-toggle-accent);
  opacity: 0;
}

/* --- Moons ---------------------------------------------------------------- */
/* Base moon shape: OUTLINE only (used by the light mode moon) */
.toggle-moon {
  width: 23px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* Light mode moon: outlined crescent on the right of the track, rotated */
.toggle-moon-track {
  /* Vertically centered: (track inner height 47px - moon height 24px) / 2 */
  top: 11.5px;
  /* Horizontally centered in the free area right of the knob */
  right: 12px;
  /* No rotation: the crescent opens to the upper right, as in the design.
     To tilt it, try e.g. transform: rotate(10deg) or rotate(-10deg). */
  transform: none;
}

/* Dark mode moon: filled, lives inside the knob (hidden in light mode) */
.toggle-moon-knob {
  fill: currentColor;
  opacity: 0;
}


/* ==========================================================================
   5. LOGIN FORM
   ========================================================================== */

.login-form {
  width: min(65%, 650px);
  margin: 0 auto;
  padding-top: 33.8vh;
}

.login-form h1 {
  margin: 0 0 36px;
  font-size: 32px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -1.2px;
}

/* Text inputs */
.login-form input {
  display: block;
  width: 100%;
  height: 62px;
  margin: 0 0 12px;
  padding: 0 28px;
  border: 1px solid var(--color-input-border);
  border-radius: 0;
  outline: none;
  box-shadow: 0 2px 5px var(--shadow-field);
  color: var(--color-text);
  font-size: 20px;
  font-weight: 500;
  background: transparent;
}

.login-form input::placeholder {
  color: var(--color-placeholder);
  opacity: 1;
}

.login-form input:focus {
  border-color: var(--color-focus);
  box-shadow: 0 0 0 2px var(--color-focus-ring);
}

/* Submit button */
.submit-button {
  float: right;
  margin-top: 10px;
  min-width: 147px;
  height: 60px;
  padding: 0 24px;
  border: 1px solid var(--color-input-border);
  background: var(--color-button-background);
  color: var(--color-placeholder);
  font-family: inherit;
  font-size: 20px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 5px var(--shadow-field);
}

.submit-button:hover,
.submit-button:focus {
  color: var(--color-accent);
  border-color: var(--color-focus);
}

/* Validation error (pulled up under the field above it) */
.form-error {
  margin: -19px 0 14px;
  color: var(--color-error);
  font-size: 13px;
}


/* ==========================================================================
   6. FOOTER (LOGO + TERMS LINK)
   ========================================================================== */

.aizre-logo {
  position: absolute;
  bottom: 3.6%;
  left: 50%;
  width: 79px;
  height: 29px;
  text-decoration: none;
  transform: translateX(-50%);
}

.aizre-logo img {
  display: block;
  width: 79px;
  height: 29px;
}

.terms-link {
  position: absolute;
  right: 4.8%;
  bottom: 3.3%;
  color: var(--color-terms);
  font-size: 11px;
  font-weight: 700;
  text-decoration: underline;
}


/* ==========================================================================
   7. UTILITIES
   ========================================================================== */

/* Visually hidden, still readable by screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* ==========================================================================
   8. DARK MODE OVERRIDES
   Applied when an ancestor (e.g. <html> or <body>) has the .dark class
   ========================================================================== */

/* Swap the background image */
.dark .brand-image {
  background-image: url("../images/cactus-dark.5c28bafc6eed.png");
}

/* Slide the knob to the right end of the track */
.dark .toggle-knob {
  transform: translateX(calc(var(--toggle-width) - var(--toggle-knob-size) + 1px));
  background: var(--color-toggle-knob);
  border-color: var(--color-toggle-knob);
}

/* Hide the light mode icons */
.dark .toggle-ring,
.dark .toggle-moon-track {
  opacity: 0;
}

/* Show the dark mode icons */
.dark .toggle-dot,
.dark .toggle-moon-knob {
  opacity: 1;
}


/* ==========================================================================
   9. RESPONSIVE
   ========================================================================== */

/* Very wide screens: keep the logo anchored near the form instead of centered */
@media (min-width: 1800px) {
  .aizre-logo {
    right: 474px;
    bottom: 32px;
    left: auto;
    transform: none;
  }
}

/* Mobile: brand image becomes a faded full-screen backdrop behind the form */
@media (max-width: 760px) {
  .brand-image {
    position: absolute;
    inset: 0;
    width: 100%;
    min-height: 100%;
    opacity: .36;
  }

  .login-panel {
    min-height: 100vh;
    background: var(--color-mobile-panel);
  }

  .panel-label {
    font-size: 14px;
  }

  .login-form {
    width: min(82%, 430px);
    padding-top: 31vh;
  }

  .login-form h1 {
    font-size: 26px;
  }

  .login-form input {
    height: 52px;
    font-size: 17px;
  }

  .submit-button {
    min-width: 110px;
    height: 48px;
    font-size: 17px;
  }
}