/* ============================================================
   ContaPY — Login page styles
   Tema: minimalista premium, variables light/dark
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:            #F5FAFA;
  --surface:       #FFFFFF;
  --text:          #0F1C3F;
  --text-2:        #6B7A99;
  --accent:        #287E7E;
  --accent-dim:    rgba(40,126,126,0.10);
  --border:        #E2EEEE;
  --input-border:  #C8DCDC;
  --btn-bg:        #1A1A1A;
  --btn-text:      #FFFFFF;
  --shadow:        0 2px 40px rgba(0,0,0,0.06);
  --bar-bg:        #E0EAEA;
  --toggle-color:  #0F1C3F;
}

[data-theme="dark"] {
  --bg:            #0D1117;
  --surface:       #1C2333;
  --text:          #E6EDF3;
  --text-2:        #8B949E;
  --accent:        #37AFAA;
  --accent-dim:    rgba(55,175,170,0.10);
  --border:        #30363D;
  --input-border:  #3A4250;
  --btn-bg:        #E6EDF3;
  --btn-text:      #0D1117;
  --shadow:        0 2px 40px rgba(0,0,0,0.30);
  --bar-bg:        #30363D;
  --toggle-color:  #E6EDF3;
}

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

html { height: 100%; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.4s, color 0.4s;
  overflow: hidden; /* evita scroll durante splash */
}

body.ready { overflow: auto; }

/* ── Theme toggle (esquina superior derecha) ────────────────── */
.theme-btn {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 200;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--toggle-color);
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, opacity 0.2s;
  opacity: 0;
  animation: btnFadeIn 0.4s ease-out 1.6s forwards;
}

.theme-btn:hover { color: var(--accent); }

@keyframes btnFadeIn {
  to { opacity: 1; }
}

/* ── Splash Screen ──────────────────────────────────────────── */
.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: splashOut 0.5s ease-in 1.55s forwards;
  transition: background 0.4s;
}

@keyframes splashOut {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: logoIn 0.8s cubic-bezier(0.22, 0.61, 0.36, 1) 0.1s both;
}

@keyframes logoIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.splash-logo-img {
  height: 72px;
  width: auto;
  display: block;
}

[data-theme="dark"] .splash-logo-img {
  filter: brightness(0) invert(1);
}

.splash-bar-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1.5px;
  background: var(--bar-bg);
  overflow: hidden;
}

.splash-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  animation: barFill 1.3s cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards;
}

@keyframes barFill {
  from { width: 0; }
  to   { width: 100%; }
}

/* ── Login Card ─────────────────────────────────────────────── */
.login-wrap {
  width: 100%;
  max-width: 420px;
  padding: 24px 16px;
}

.login-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 44px 40px 40px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: background 0.4s, border-color 0.4s, box-shadow 0.4s;
}

/* ── Logo row ───────────────────────────────────────────────── */
.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  animation: fieldIn 0.55s ease-out 1.65s both;
}

.login-logo-img {
  height: 56px;
  width: auto;
  display: block;
}

[data-theme="dark"] .login-logo-img {
  filter: brightness(0) invert(1);
}

/* ── Divider ────────────────────────────────────────────────── */
.login-divider {
  height: 1px;
  background: var(--accent);
  opacity: 0.25;
  margin-bottom: 28px;
  animation: fieldIn 0.55s ease-out 1.75s both;
}

/* ── Title ──────────────────────────────────────────────────── */
.login-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.3;
  animation: fieldIn 0.55s ease-out 1.82s both;
}

.login-subtitle {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-2);
  margin-bottom: 32px;
  animation: fieldIn 0.55s ease-out 1.82s both;
}

/* ── Error message ──────────────────────────────────────────── */
.error-msg {
  background: rgba(220, 53, 53, 0.07);
  border-left: 2px solid #DC3535;
  padding: 10px 14px;
  color: #DC3535;
  font-size: 13px;
  border-radius: 4px;
  margin-bottom: 18px;
  display: none;
}
.error-msg.visible { display: block; }

/* ── Form fields ────────────────────────────────────────────── */
.field {
  margin-bottom: 24px;
}

.field label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 8px;
}

.field input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--input-border);
  border-radius: 0;
  padding: 8px 0 10px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 400;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.field input::placeholder { color: var(--text-2); opacity: 0.5; }

.field input:focus {
  border-bottom-color: var(--accent);
}

/* ── Field animations (cascada) ─────────────────────────────── */
.field-email   { animation: fieldIn 0.55s ease-out 1.90s both; }
.field-password{ animation: fieldIn 0.55s ease-out 2.00s both; }

.btn-login {
  width: 100%;
  padding: 13px;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 8px;
  animation: fieldIn 0.55s ease-out 2.10s both;
}

.btn-login:hover  { background: var(--accent); color: #fff; }
.btn-login:active { transform: scale(0.99); }
.btn-login:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Footer ─────────────────────────────────────────────────── */
.login-footer {
  margin-top: 28px;
  font-size: 11.5px;
  color: var(--text-2);
  text-align: center;
  animation: fieldIn 0.55s ease-out 2.20s both;
}

/* ── Field enter keyframe ───────────────────────────────────── */
@keyframes fieldIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  .login-card { padding: 36px 24px 32px; }
}
