/* ============================================================================
   EduMoney — Tela de Login iOS-Native & Responsive (WCAG 2.2 AA)
   Sem dependências externas · Sem border-radius: 9999px em tags
   ============================================================================ */

:root {
  color-scheme: light;
  --page: #042b33;
  --surface: #ffffff;
  --surface-subtle: #f3f8f9;
  --ink: #12262b;
  --ink-secondary: #435a60;
  --ink-muted: #586f75;
  --entry: #087487;
  --entry-bg: #e6f6f9;
  --line: #d6e4e7;
  --line-strong: #b4ccd0;
  --negative: #9d3237;
  --negative-bg: #fceeed;
  --focus: #087487;
  --hero-gradient: linear-gradient(145deg, #04323b 0%, #086476 54%, #13887d 100%);
  --cta-gradient: linear-gradient(118deg, #087487 0%, #0d90a2 58%, #15897c 100%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #071013;
    --surface: #111e22;
    --surface-subtle: #17272c;
    --ink: #eef8f9;
    --ink-secondary: #c1d4d7;
    --ink-muted: #98b1b5;
    --entry: #76deec;
    --entry-bg: rgba(27, 183, 208, 0.14);
    --line: rgba(99, 211, 228, 0.16);
    --line-strong: rgba(99, 211, 228, 0.3);
    --negative: #ff9c97;
    --negative-bg: rgba(190, 74, 69, 0.2);
    --focus: #63d3e4;
  }
}

[data-theme="dark"] {
  color-scheme: dark;
  --page: #071013;
  --surface: #111e22;
  --surface-subtle: #17272c;
  --ink: #eef8f9;
  --ink-secondary: #c1d4d7;
  --ink-muted: #98b1b5;
  --entry: #76deec;
  --entry-bg: rgba(27, 183, 208, 0.14);
  --line: rgba(99, 211, 228, 0.16);
  --line-strong: rgba(99, 211, 228, 0.3);
  --negative: #ff9c97;
  --negative-bg: rgba(190, 74, 69, 0.2);
  --focus: #63d3e4;
}

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

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-width: 320px;
}

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--hero-gradient);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.svg-library {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
}

.auth-stage {
  width: 100%;
  max-width: 980px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: var(--surface);
  border: 1px solid rgba(117, 234, 248, 0.2);
  border-radius: 26px;
  overflow: hidden;
  box-shadow: 0 28px 64px rgba(2, 24, 29, 0.44);
  animation: stageIn 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Showcase Panel */
.auth-showcase {
  position: relative;
  padding: 34px 32px;
  color: #ffffff;
  background: var(--hero-gradient);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 26px;
  overflow: hidden;
}

.showcase-glow {
  position: absolute;
  top: -90px;
  right: -70px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(77, 226, 244, 0.36), transparent 68%);
  pointer-events: none;
}

.auth-showcase > *:not(.showcase-glow) {
  position: relative;
  z-index: 1;
}

.showcase-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(140deg, #3cd8ea 0%, #0b8396 100%);
  color: #ffffff;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.brand-name {
  display: block;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.15;
}

.brand-sub {
  display: block;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.8);
}

.theme-chip {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  cursor: pointer;
  transition: background-color 160ms ease, transform 140ms cubic-bezier(0.32, 0.72, 0, 1);
}
.theme-chip:hover {
  background: rgba(255, 255, 255, 0.22);
}
.theme-chip:active {
  transform: scale(0.94);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #9df0f6;
}

.showcase-copy h1 {
  margin: 0 0 10px;
  font-size: clamp(24px, 2.7vw, 31px);
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1.18;
}

.lead {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.55;
}

.feature-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 11px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.feature-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.14);
  color: #9ff3fa;
}
.feature-item strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
}
.feature-item span {
  display: block;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

/* Auth Form Card */
.auth-card {
  padding: 36px 34px 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--surface);
}

.sheet-grabber {
  display: none;
}

.eyebrow-muted {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.9px;
  color: var(--entry);
}

.card-head h2 {
  margin: 0;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.6px;
}

.subtitle {
  margin: 6px 0 22px;
  font-size: 13.5px;
  color: var(--ink-muted);
}

.login-error {
  padding: 11px 13px;
  margin-bottom: 16px;
  border-radius: 10px;
  background: var(--negative-bg);
  color: var(--negative);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(157, 50, 55, 0.2);
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.input-box {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 13px;
  width: 18px;
  height: 18px;
  color: var(--ink-muted);
  pointer-events: none;
}

.input-box input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px 10px 42px;
  border-radius: 12px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface-subtle);
  color: var(--ink);
  font-size: 15px;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}
.input-box.has-trailing input {
  padding-right: 48px;
}
.input-box input:focus {
  outline: none;
  border-color: var(--entry);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(27, 183, 208, 0.18);
}

.eye-toggle {
  position: absolute;
  right: 4px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: color 140ms ease, transform 140ms cubic-bezier(0.32, 0.72, 0, 1);
}
.eye-toggle:hover {
  color: var(--entry);
}
.eye-toggle:active {
  transform: scale(0.92);
}

/* Native iOS UISwitch Style */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 22px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  cursor: pointer;
}
.switch-copy strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
}
.switch-copy small {
  display: block;
  font-size: 11.5px;
  color: var(--ink-muted);
}

.ios-switch {
  position: relative;
  width: 50px;
  height: 30px;
  flex: 0 0 auto;
}
.ios-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.ios-switch-track {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: var(--line-strong);
  transition: background-color 260ms cubic-bezier(0.32, 0.72, 0, 1);
}
.ios-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  transition: transform 300ms cubic-bezier(0.32, 0.72, 0, 1);
}
.ios-switch input:checked + .ios-switch-track {
  background: var(--entry);
}
.ios-switch input:checked + .ios-switch-track .ios-switch-knob {
  transform: translateX(20px);
}
.ios-switch input:focus-visible + .ios-switch-track {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.submit-btn {
  width: 100%;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 13px;
  background: var(--cta-gradient);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(8, 116, 135, 0.3);
  transition: transform 160ms cubic-bezier(0.32, 0.72, 0, 1), opacity 160ms ease, box-shadow 160ms ease;
}
.submit-btn:hover {
  box-shadow: 0 14px 30px rgba(8, 116, 135, 0.4);
}
.submit-btn:active {
  transform: scale(0.975);
}
.submit-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.auth-footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-muted);
}

.is-shaking {
  animation: shakeX 360ms ease;
}

@keyframes stageIn {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}

/* Smartphone Native Bottom-Sheet Experience */
@media (max-width: 860px) {
  .auth-shell {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
  }

  .auth-stage {
    flex: 1;
    max-width: none;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .auth-showcase {
    padding: calc(18px + env(safe-area-inset-top)) 20px 24px;
    gap: 14px;
  }

  .showcase-copy h1 {
    font-size: 22px;
    margin-bottom: 6px;
  }
  .lead {
    font-size: 13px;
  }
  .feature-list {
    display: none;
  }

  .auth-card {
    justify-content: flex-start;
    padding: 16px 20px calc(28px + env(safe-area-inset-bottom));
    border-radius: 26px 26px 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.22);
    animation: sheetUp 400ms cubic-bezier(0.32, 0.72, 0, 1) both;
  }

  .sheet-grabber {
    display: block;
    width: 38px;
    height: 4px;
    margin: 0 auto 14px;
    border-radius: 2px;
    background: var(--line-strong);
  }
}

@keyframes sheetUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}
