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

:root {
  --bg-dark: #1c2433;
  --teal: #5ecfbd;
  --teal-hover: #4dbfad;
  --white: #ffffff;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --border: #cbd5e1;
  --error: #ef4444;
  --error-bg: #fef2f2;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

html,
body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
}

/* ===== LAYOUT ===== */

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

.login-hero {
  position: relative;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
  overflow: hidden;
}

.hero-gradient {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 2rem;
  text-align: left;
}

.hero-content h1 {
  color: var(--white);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 2rem;
  white-space: nowrap;
}

.btn-outline {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: var(--teal);
  color: var(--white);
  font-size: 0.938rem;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s;
}

.btn-outline:hover {
  background: var(--teal-hover);
}

/* ===== PANEL DERECHO ===== */

.login-panel {
  width: 630px;
  min-width: 380px;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 3rem 3rem 4rem;
}

.login-form-wrapper {
  width: 100%;
  max-width: 410px;
}

/* ===== BRAND ===== */

.brand {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 5rem;
  margin-left: -36px;
}

.brand-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand-name {
  font-size: 1.0417rem;
  font-weight: 700;
  color: var(--text-dark);
}

.brand-label {
  font-size: 1.0417rem;
  font-weight: 600;
  color: var(--teal);
}

/* ===== FORMULARIO ===== */

.form-content {
  margin-left: 0;
}

.form-title {
  font-size: 1.0417rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.form-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.form-subtitle a {
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
}

.form-subtitle a:hover {
  text-decoration: underline;
}

/* ===== CAMPOS ===== */

.field {
  margin-bottom: 1.25rem;
}

.input-wrap {
  position: relative;
  border: 2px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.2s;
}

.input-wrap:focus-within {
  border-color: var(--teal);
}

.input-wrap.error {
  border-color: var(--error);
  border-width: 3px;
}

.input-wrap.error label {
  color: var(--error);
}

.input-wrap input {
  width: 100%;
  padding: 1.65rem 1rem 0.55rem;
  font-size: 0.938rem;
  font-family: var(--font);
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-dark);
  font-weight: 500;
}

.input-wrap label {
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  font-size: 0.938rem;
  color: var(--text-muted);
  pointer-events: none;
  transition: all 0.2s ease;
}

.input-wrap input:focus ~ label {
  top: 0.55rem;
  transform: translateY(0);
  font-size: 0.75rem;
  color: var(--teal);
}

.input-wrap input:not(:placeholder-shown) ~ label {
  top: 0.55rem;
  transform: translateY(0);
  font-size: 0.75rem;
}

.input-wrap.error input:focus ~ label,
.input-wrap.error input:not(:placeholder-shown) ~ label {
  color: var(--error);
}

.input-wrap.valid {
  border-color: var(--border);
}

.input-wrap.valid label {
  color: var(--text-muted);
}

.input-wrap.valid:focus-within {
  border-color: var(--teal);
}

.field-error {
  display: block;
  font-size: 0.8rem;
  color: var(--error);
  margin-top: 0.35rem;
  padding-left: 0.25rem;
}

.input-wrap.valid + .field-error {
  display: none;
}

/* ===== TOGGLE PASSWORD ===== */

.toggle-pass {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.toggle-pass svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* ===== BOTÓN SUBMIT ===== */

.btn-submit {
  width: 100%;
  padding: 0.85rem;
  background: var(--teal);
  color: var(--white);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 0.5rem;
}

.btn-submit:hover {
  background: var(--teal-hover);
}

.btn-submit:disabled,
.btn-submit.is-loading {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: default;
}

/* ===== ENLACE OLVIDÓ CONTRASEÑA ===== */

.forgot-link {
  display: block;
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--teal);
  text-decoration: none;
}

.forgot-link:hover {
  text-decoration: underline;
}

/* ===== OTP ===== */

.otp-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 0.75rem;
  transition: color 0.2s;
}

.otp-label.error {
  color: var(--error);
}

.otp-group {
  display: flex;
  gap: 15px;
  margin-bottom: 0.35rem;
}

.otp-input {
  flex: 1;
  aspect-ratio: 1;
  max-width: 56px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
  font-size: 15px;
  font-weight: 300;
  font-family: var(--font);
  color: var(--text-dark);
  outline: none;
  transition: border-color 0.2s, border-width 0.2s;
}

.otp-input:focus {
  border: 3px solid var(--teal);
}

.otp-input.error {
  border: 3px solid var(--error);
}

.otp-error {
  display: block;
  font-size: 0.8rem;
  color: var(--error);
  margin-bottom: 1.25rem;
  padding-left: 0.25rem;
  min-height: 1.2rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.otp-error.visible {
  opacity: 1;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
  .login-container {
    flex-direction: column-reverse;
  }

  .login-hero {
    min-height: 280px;
  }

  .hero-content h1 {
    font-size: 1.5rem;
  }

  .login-panel {
    width: 100%;
    min-width: unset;
    padding: 2.5rem 1.5rem;
  }
}
