/* ==========================================================================
   ControlSisa · Login
   Cambiá los colores y la tipografía desde las variables de :root
   ========================================================================== */

:root {
  --brand: #1d6b43;
  --brand-dark: #165334;
  --brand-soft: rgba(29, 107, 67, 0.2);
  --ink: #16211c;
  --muted: #5a6860;
  --placeholder: #66746c;
  --line: #cfd8d3;
  --line-hover: #9fb0a7;
  --error: #b3261e;
  --error-bg: #fdf1f0;
  --error-line: #f0c4c0;
  --success-bg: #eef7f1;
  --success-line: #bfdcca;
  --bg: #ffffff;
  --radius: 10px;
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Base ------------------------------------------------------------------ */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  border-top: 4px solid var(--brand);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

/* Header / logo ---------------------------------------------------------- */

.site-header {
  display: flex;
  justify-content: center;
  padding: 28px 20px 0;
}

.logo {
  display: inline-block;
  border-radius: 6px;
}

.logo img {
  height: 200px;
  width: auto;
}

.logo:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
}

/* Main ------------------------------------------------------------------- */

.main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 48px;
}

.login {
  width: min(100%, 400px);
}

.login h1 {
  margin: 0 0 8px;
  font-size: 1.75rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.login__intro {
  margin: 0 0 28px;
  color: var(--muted);
}

/* Form ------------------------------------------------------------------- */

.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9375rem;
  font-weight: 600;
}

.field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1rem; /* 16px evita el zoom automático en iOS */
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder {
  color: var(--placeholder);
}

.field input:hover {
  border-color: var(--line-hover);
}

.field input:focus-visible {
  outline: 2px solid transparent; /* visible en modo alto contraste */
  outline-offset: 2px;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.field input[aria-invalid="true"] {
  border-color: var(--error);
}

.field input[aria-invalid="true"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.2);
}

.field__error {
  margin: 6px 0 0;
  color: var(--error);
  font-size: 0.875rem;
}

.field__error:empty {
  display: none;
}

/* Contraseña + botón mostrar/ocultar */

.password {
  position: relative;
}

.password input {
  padding-right: 52px;
}

.password__toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.password__toggle:hover {
  color: var(--ink);
}

.password__toggle:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -4px;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password__toggle .icon--eye-off,
.password__toggle[aria-pressed="true"] .icon--eye {
  display: none;
}

.password__toggle[aria-pressed="true"] .icon--eye-off {
  display: block;
}

/* Mensaje general del formulario */

.form__status {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.9375rem;
}

.form__status:empty {
  display: none;
}

.form__status.is-error {
  color: var(--error);
  background: var(--error-bg);
  border-color: var(--error-line);
}

.form__status.is-success {
  color: var(--brand-dark);
  background: var(--success-bg);
  border-color: var(--success-line);
}

/* Botón principal */

.btn {
  width: 100%;
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn:hover {
  background: var(--brand-dark);
}

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

.btn[aria-busy="true"] {
  cursor: progress;
  background: var(--brand-dark);
}

.btn__spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn[aria-busy="true"] .btn__spinner {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Footer ----------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 20px 36px;
  background: #333333;
}

.footer__inner {
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  gap: 28px;
}

.footer__name {
  margin: 0 0 10px;
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--line);
}

.footer__contact {
  display: grid;
  gap: 8px;
  font-style: normal;
  color: var(--line);
}

.footer__contact p {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.footer__contact .icon {
  margin-top: 2px;
  color: var(--brand);
}

.footer__contact a {
  text-underline-offset: 3px;
}

.footer__contact a:hover {
  color: var(--brand);
}

.footer__contact a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 3px;
}

.footer__member {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 0.875rem;
}

.footer__member img {
  height: 56px;
  width: auto;
  flex: none;
}

.footer__member p {
  margin: 0;
  max-width: 38ch;
  color: var(--line);
}

@media (min-width: 720px) {
  .footer__inner {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }

  .footer__member {
    justify-self: end;
  }
}

/* Movimiento reducido ---------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }

  .btn__spinner {
    animation-duration: 2s;
  }
}
