:root {
  --color-bg: #000000;
  --color-surface: rgba(8, 8, 8, 0.82);
  --color-primary: #111111;
  --color-secondary: #d0d8d0;
  --color-accent: #d0d8d0;
  --color-text: #ffffff;
  --color-error: #ff6b6b;

  --radius-lg: 24px;
  --radius-pill: 999px;

  --shadow-soft: 0 40px 120px rgba(0, 0, 0, 0.85);
  --blur-strong: 28px;

  --transition-fast: 160ms ease-out;
  --transition-med: 260ms cubic-bezier(0.19, 1, 0.22, 1);
  --transition-slow: 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.login-body {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  overflow: hidden;
}

.bg-layer {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 0% 0%, #202020 0, transparent 55%),
    radial-gradient(circle at 100% 100%, #050505 0, transparent 60%),
    linear-gradient(135deg, #050505 0, #111111 40%, #050505 100%);
  z-index: 0;
}

.bg-sheen {
  position: fixed;
  inset: -40%;
  background: linear-gradient(
    135deg,
    rgba(208, 216, 208, 0) 0%,
    rgba(208, 216, 208, 0.12) 45%,
    rgba(208, 216, 208, 0.28) 50%,
    rgba(208, 216, 208, 0.12) 55%,
    rgba(208, 216, 208, 0) 100%
  );
  mix-blend-mode: screen;
  opacity: 0.65;
  transform: translate3d(-40%, -40%, 0);
  animation: sheen-diagonal 9s linear infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes sheen-diagonal {
  0% {
    transform: translate3d(-40%, -40%, 0);
  }
  50% {
    transform: translate3d(10%, 10%, 0);
  }
  100% {
    transform: translate3d(60%, 60%, 0);
  }
}

.login-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 2.5rem 2.25rem 2.25rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.06),
      rgba(17, 17, 17, 0.96)
    ),
    var(--color-surface);
  border: 1px solid rgba(208, 216, 208, 0.18);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(var(--blur-strong)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--blur-strong)) saturate(140%);
  transform-origin: 50% 60%;
  transform: translate3d(0, 40px, 0) scale(0.96) rotateX(12deg);
  opacity: 0;
  animation: card-enter 680ms var(--transition-slow) forwards;
}

@keyframes card-enter {
  0% {
    opacity: 0;
    transform: translate3d(0, 40px, 0) scale(0.94) rotateX(18deg);
  }
  60% {
    opacity: 1;
    transform: translate3d(0, -4px, 0) scale(1.01) rotateX(2deg);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1) rotateX(0deg);
  }
}

.login-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2.25rem;
}

.login-logo {
  max-width: 300px;
  height: auto;
  filter: drop-shadow(0 18px 45px rgba(0, 0, 0, 0.85));
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field-label {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.field-input {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(208, 216, 208, 0.25);
  background: radial-gradient(circle at 0 0, #151515, #050505);
  color: var(--color-text);
  font-size: 0.95rem;
  outline: none;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast),
    transform 120ms ease-out;
}

.field-input::placeholder {
  color: rgba(255, 255, 255, 0.32);
}

.field-input:focus-visible {
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 1px rgba(208, 216, 208, 0.9),
    0 0 0 16px rgba(208, 216, 208, 0.08);
  transform: translateY(-1px);
}

.field-input:invalid:focus-visible {
  border-color: var(--color-error);
  box-shadow: 0 0 0 1px rgba(255, 107, 107, 0.9),
    0 0 0 16px rgba(255, 107, 107, 0.15);
}

.field-error {
  min-height: 1em;
  font-size: 0.75rem;
  color: var(--color-error);
}

.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius-pill);
  border: 0;
  cursor: pointer;
  background: linear-gradient(
    135deg,
    var(--color-secondary),
    #f0f4f0 30%,
    #9aa29a 100%
  );
  color: #050505;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.8rem;
  box-shadow:
    0 18px 45px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(0, 0, 0, 0.7);
  transition:
    transform var(--transition-med),
    box-shadow var(--transition-med),
    filter 120ms ease-out,
    background-position 220ms ease-out;
  background-size: 160% 160%;
  background-position: 0% 50%;
}

.btn-primary:hover {
  transform: translateY(-1px);
  background-position: 100% 50%;
  box-shadow:
    0 26px 70px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(0, 0, 0, 0.8);
  filter: brightness(1.04);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(0, 0, 0, 0.9);
}

.btn-primary:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.btn-label {
  position: relative;
  z-index: 1;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.16);
  border-top-color: rgba(0, 0, 0, 0.7);
  animation: spinner 650ms linear infinite;
  opacity: 0;
  transform: scale(0.4);
  transition:
    opacity var(--transition-fast),
    transform var(--transition-fast);
}

.btn-primary.is-loading .btn-spinner {
  opacity: 1;
  transform: scale(1);
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

.form-status {
  margin-top: 0.75rem;
  min-height: 1em;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.76);
}

.form-status--error {
  color: var(--color-error);
}

.form-status--success {
  color: var(--color-secondary);
}

@media (max-width: 600px) {
  .login-card {
    padding: 2rem 1.75rem 1.85rem;
    border-radius: 20px;
  }
}

/* —— Tema claro (Fase 7) —— */
html[data-theme="light"] {
  --color-bg: #e8ebe8;
  --color-surface: rgba(255, 255, 255, 0.96);
  --color-primary: #f2f4f2;
  --color-secondary: #2c362c;
  --color-accent: #3d4d3d;
  --color-text: #121812;
  --color-error: #b71c1c;
  --shadow-soft: 0 28px 90px rgba(18, 24, 18, 0.14);
}

html[data-theme="light"] .bg-layer {
  background:
    radial-gradient(circle at 0% 0%, #dce3dc 0, transparent 55%),
    radial-gradient(circle at 100% 100%, #cfd6cf 0, transparent 60%),
    linear-gradient(135deg, #dde2dd 0, #eef1ee 45%, #e2e6e2 100%);
}

html[data-theme="light"] .bg-sheen {
  opacity: 0.35;
  mix-blend-mode: multiply;
}

html[data-theme="light"] .login-card {
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.95),
      rgba(248, 250, 248, 0.98)
    ),
    var(--color-surface);
  border: 1px solid rgba(45, 58, 45, 0.14);
  box-shadow: var(--shadow-soft);
}

html[data-theme="light"] .field-label,
html[data-theme="light"] .field-input {
  color: var(--color-text);
}

html[data-theme="light"] .field-input {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(45, 58, 45, 0.2);
}

html[data-theme="light"] .form-status {
  color: rgba(18, 24, 18, 0.72);
}

html[data-theme="light"] .theme-toggle--login {
  color: var(--color-text);
  border-color: rgba(45, 58, 45, 0.25);
  background: rgba(255, 255, 255, 0.55);
}

