/* =========================================================
   RESET
========================================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  width: 100%;
  min-height: 100%;
  font-size: 16px;
}

body {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 24px;

  /* Si existe app/views/auth/fondo.webp se usa esa imagen; si no,
     queda el degradado navy como fondo (misma identidad del sistema). */
  background:
    url('fondo.jpg') center / cover no-repeat fixed,
    radial-gradient(ellipse at top, #262626 0%, #111111 60%, #000000 100%);

  font-family: 'Poppins', sans-serif;

  position: relative;

  overflow-x: hidden;
  overflow-y: auto;

  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* =========================================================
   OVERLAY
========================================================= */
body::before {
  content: '';

  position: fixed;
  inset: 0;

  background: rgba(0, 0, 0, 0.60);

  z-index: 0;

  pointer-events: none;
}
/* =========================================================
   LOADER
========================================================= */
.loader-overlay {
  position: fixed;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(0, 0, 0, 0.85);

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  z-index: 9999;

  transition: opacity 0.4s ease;
}

.loader-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;

  gap: 20px;

  text-align: center;
}

.loader-content img {
  width: 130px;
  height: auto;

  animation: pulseLogo 1.8s ease-in-out infinite alternate;
}

.loader-content .logo-black {
  display: none;
}

.loader-spinner {
  width: 48px;
  height: 48px;

  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: #ffffff;

  border-radius: 50%;

  animation: spin 1s linear infinite;
}

.loader-text {
  color: rgba(255, 255, 255, 0.70);

  font-size: 0.9rem;
  font-weight: 300;

  letter-spacing: 0.5px;
}

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

@keyframes pulseLogo {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }

  100% {
    transform: scale(1.06);
    opacity: 1;
  }
}


/* =========================================================
   WRAPPER
========================================================= */

.login-wrapper {
  position: relative;

  z-index: 1;

  width: 100%;

  min-height: 100vh;
  min-height: 100dvh;

  display: flex;

  align-items: center;
  justify-content: center;

  padding: 32px 20px;

  overflow: visible;
}


/* =========================================================
   LOGIN CARD
========================================================= */

.login-card {
  position: relative;

  width: min(100%, 460px);

  padding: 46px 36px 32px;

  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.14),
      rgba(255, 255, 255, 0.07)
    );

  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);

  border:
    1px solid rgba(255, 255, 255, 0.22);

  border-radius: 30px;

  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.45),
    0 8px 25px rgba(0, 0, 0, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);

  overflow: hidden;

  isolation: isolate;

  transition:
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.45s ease,
    border-color 0.35s ease;
}


/* =========================================================
   BRILLO SUPERIOR
========================================================= */

.login-card::before {
  content: '';

  position: absolute;

  top: 0;
  left: 8%;

  width: 84%;
  height: 1px;

  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(255, 255, 255, 0.70),
      transparent
    );

  opacity: 0.75;

  pointer-events: none;

  z-index: -1;
}


/* =========================================================
   HALO INTERNO
========================================================= */

.login-card::after {
  content: '';

  position: absolute;

  width: 220px;
  height: 220px;

  top: -120px;
  right: -100px;

  background:
    radial-gradient(
      circle,
      rgba(255, 255, 255, 0.12) 0%,
      rgba(255, 255, 255, 0.04) 35%,
      transparent 70%
    );

  border-radius: 50%;

  pointer-events: none;

  z-index: -1;

  animation:
    cardGlow 7s ease-in-out infinite alternate;
}

@keyframes cardGlow {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 0.6;
  }

  100% {
    transform: translate(-30px, 35px) scale(1.2);
    opacity: 1;
  }
}


/* =========================================================
   HOVER CARD
========================================================= */

.login-card:hover {
  transform: translateY(-4px);

  border-color:
    rgba(255, 255, 255, 0.28);

  box-shadow:
    0 38px 85px rgba(0, 0, 0, 0.52),
    0 12px 35px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}


/* =========================================================
   HEADER
========================================================= */

.login-header {
  position: relative;

  text-align: center;

  margin-bottom: 28px;
}

.login-header h2 {
  font-family:
    'Playfair Display',
    serif;

  font-weight: 700;

  font-size:
    clamp(1.9rem, 2.8vw, 2.5rem);

  line-height: 1.15;

  color: #ffffff;

  letter-spacing: 0.4px;

  text-shadow:
    0 4px 18px rgba(0, 0, 0, 0.40);

  animation:
    titleAppear 0.7s ease both;
}

.login-header p {
  margin-top: 7px;

  color:
    rgba(255, 255, 255, 0.68);

  font-size:
    clamp(0.82rem, 1vw, 0.94rem);

  line-height: 1.5;

  font-weight: 300;

  letter-spacing: 0.15px;

  animation:
    titleAppear 0.7s 0.08s ease both;
}

@keyframes titleAppear {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* =========================================================
   ALERT
========================================================= */

.alert {
  display: flex;
  align-items: center;

  gap: 11px;

  margin-bottom: 22px;

  padding: 12px 15px;

  background:
    linear-gradient(
      135deg,
      rgba(220, 38, 38, 0.22),
      rgba(220, 38, 38, 0.12)
    );

  border:
    1px solid rgba(248, 113, 113, 0.28);

  border-radius: 13px;

  color: #fecaca;

  font-size: 0.84rem;

  line-height: 1.4;

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 20px rgba(0, 0, 0, 0.10);

  animation:
    alertAppear 0.45s ease both;
}

.alert i {
  flex-shrink: 0;

  font-size: 1.05rem;

  color: #f87171;

  filter:
    drop-shadow(
      0 0 5px rgba(248, 113, 113, 0.35)
    );
}

@keyframes alertAppear {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}


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

.field {
  margin-bottom: 20px;

  animation:
    fieldAppear 0.5s ease both;
}

.field:nth-of-type(1) {
  animation-delay: 0.08s;
}

.field:nth-of-type(2) {
  animation-delay: 0.14s;
}

@keyframes fieldAppear {
  from {
    opacity: 0;
    transform: translateY(7px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.field label {
  display: block;

  margin-bottom: 7px;

  color:
    rgba(255, 255, 255, 0.84);

  font-size: 0.74rem;

  font-weight: 600;

  line-height: 1.3;

  letter-spacing: 0.65px;

  text-transform: uppercase;
}


/* =========================================================
   INPUT WRAPPER
========================================================= */

.input {
  position: relative;

  width: 100%;
}


/* =========================================================
   INPUT ICON
========================================================= */

.input > i:first-child {
  position: absolute;

  left: 16px;
  top: 50%;

  transform:
    translateY(-50%);

  color:
    rgba(255, 255, 255, 0.45);

  font-size: 1rem;

  z-index: 2;

  pointer-events: none;

  transition:
    color 0.3s ease,
    transform 0.3s ease,
    filter 0.3s ease;
}


/* =========================================================
   INPUT
========================================================= */

.input input {
  width: 100%;

  min-height: 51px;

  padding:
    13px
    48px
    13px
    44px;

  border:
    1px solid rgba(255, 255, 255, 0.18);

  border-radius: 14px;

  background:
    rgba(255, 255, 255, 0.055);

  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);

  color: #ffffff;

  font-family:
    'Poppins',
    sans-serif;

  font-size: 0.94rem;

  line-height: 1.4;

  outline: none;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04);

  transition:
    border-color 0.3s ease,
    background 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.25s ease;
}

.input input:hover {
  border-color:
    rgba(255, 255, 255, 0.30);

  background:
    rgba(255, 255, 255, 0.075);
}

.input input:focus {
  border-color:
    rgba(255, 255, 255, 0.62);

  background:
    rgba(255, 255, 255, 0.115);

  transform:
    translateY(-1px);

  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.045),
    0 8px 24px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.input input:focus ~ i:first-child {
  color:
    rgba(255, 255, 255, 0.95);

  transform:
    translateY(-50%) scale(1.05);

  filter:
    drop-shadow(
      0 0 6px rgba(255, 255, 255, 0.20)
    );
}

.input input::placeholder {
  color:
    rgba(255, 255, 255, 0.38);

  font-weight: 300;

  transition:
    opacity 0.25s ease;
}

.input input:focus::placeholder {
  opacity: 0.65;
}


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

.toggle {
  position: absolute;

  right: 8px;
  top: 50%;

  transform:
    translateY(-50%);

  width: 36px;
  height: 36px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;

  background: transparent;

  border: none;

  border-radius: 9px;

  color:
    rgba(255, 255, 255, 0.48);

  font-size: 1.03rem;

  cursor: pointer;

  z-index: 3;

  transition:
    color 0.25s ease,
    background 0.25s ease,
    transform 0.2s ease;
}

.toggle:hover {
  color: #ffffff;

  background:
    rgba(255, 255, 255, 0.10);

  transform:
    translateY(-50%) scale(1.04);
}

.toggle:active {
  transform:
    translateY(-50%) scale(0.92);
}

.toggle i {
  display: block;

  pointer-events: none;
}


/* =========================================================
   CHECKBOX
========================================================= */

.keep-row {
  display: flex;
  align-items: center;

  margin:
    4px 0
    24px;
}

.keep-row label {
  display: flex;
  align-items: center;

  gap: 9px;

  color:
    rgba(255, 255, 255, 0.76);

  font-size: 0.82rem;

  line-height: 1.4;

  cursor: pointer;
}

.keep-row input[type="checkbox"] {
  appearance: none;

  width: 18px;
  height: 18px;

  flex-shrink: 0;

  border:
    1.5px solid rgba(255, 255, 255, 0.32);

  border-radius: 5px;

  background:
    rgba(255, 255, 255, 0.05);

  cursor: pointer;

  position: relative;

  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    transform 0.2s ease,
    box-shadow 0.25s ease;
}

.keep-row input[type="checkbox"]:hover {
  border-color:
    rgba(255, 255, 255, 0.60);

  transform:
    scale(1.04);
}

.keep-row input[type="checkbox"]:checked {
  background: #ffffff;

  border-color: #ffffff;

  box-shadow:
    0 0 12px rgba(255, 255, 255, 0.12);
}

.keep-row input[type="checkbox"]:checked::after {
  content: '\f00c';

  position: absolute;

  top: 50%;
  left: 50%;

  transform:
    translate(-50%, -50%);

  font-family:
    'Font Awesome 6 Free';

  font-size: 11px;

  font-weight: 900;

  color: #1a1a2e;
}

.keep-row input[type="checkbox"]:focus-visible {
  outline:
    2px solid #ffffff;

  outline-offset: 2px;
}


/* =========================================================
   BUTTON
========================================================= */

.btn {
  position: relative;

  width: 100%;

  min-height: 51px;

  display: flex;
  align-items: center;
  justify-content: center;

  gap: 10px;

  padding:
    13px
    18px;

  border: none;

  border-radius: 14px;

  background:
    linear-gradient(
      135deg,
      #ffffff 0%,
      #e8ecf0 100%
    );

  color:
    #1a1a2e;

  font-family:
    'Poppins',
    sans-serif;

  font-size: 0.96rem;

  font-weight: 600;

  line-height: 1.3;

  letter-spacing: 0.2px;

  cursor: pointer;

  overflow: hidden;

  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.25);

  transition:
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.3s ease,
    filter 0.3s ease;
}


/* =========================================================
   REFLEJO DEL BOTÓN
========================================================= */

.btn::before {
  content: '';

  position: absolute;

  top: 0;
  left: -120%;

  width: 80%;
  height: 100%;

  background:
    linear-gradient(
      110deg,
      transparent,
      rgb(255, 255, 255),
      transparent
    );

  transform:
    skewX(-20deg);

  transition:
    left 0.65s ease;

  pointer-events: none;
}

.btn:hover::before {
  left: 140%;
}


/* =========================================================
   BORDE INTERNO BOTÓN
========================================================= */

.btn::after {
  content: '';

  position: absolute;

  inset: 0;

  border-radius: inherit;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85);

  pointer-events: none;
}


/* =========================================================
   BUTTON HOVER
========================================================= */

.btn:hover {
  transform:
    translateY(-3px);

  box-shadow:
    0 14px 32px rgba(0, 0, 0, 0.34);

  filter:
    brightness(1.02);
}

.btn:active {
  transform:
    translateY(-1px) scale(0.985);

  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.22);
}

.btn i {
  font-size: 1rem;

  transition:
    transform 0.3s ease;
}

.btn:hover i {
  transform:
    translateX(4px);
}

.btn:disabled {
  opacity: 0.65;

  cursor: not-allowed;

  transform: none !important;

  filter: none;
}


/* =========================================================
   FOOTER
========================================================= */

.footer {
  margin-top: 23px;

  padding-top: 15px;

  border-top:
    1px solid rgba(255, 255, 255, 0.08);

  text-align: center;

  color:
    rgba(255, 255, 255, 0.31);

  font-size: 0.67rem;

  font-weight: 300;

  line-height: 1.4;

  letter-spacing: 0.3px;
}


/* =========================================================
   TABLET  768px - 1023px
========================================================= */

@media (min-width: 768px) and (max-width: 1023px) {

  .login-wrapper {
    padding:
      30px
      20px;
  }

  .login-card {
    width:
      min(100%, 440px);

    padding:
      40px
      32px
      30px;

    border-radius:
      27px;
  }

  .login-header {
    margin-bottom:
      25px;
  }
}


/* =========================================================
   DESKTOP ≥ 1024px
========================================================= */

@media (min-width: 1024px) {

  .login-card {
    width:
      min(100%, 460px);
  }
}
/* =========================================================
   MONITORES GRANDES / 4K   ≥ 1921px
========================================================= */

@media (min-width: 1921px) {

  .login-wrapper {
    padding:
      40px;
  }

  .login-card {
    width:
      460px;

    padding:
      48px
      38px
      34px;

    border-radius:
      30px;
  }

  .login-header h2 {
    font-size:
      2.55rem;
  }
}
/* =========================================================
   MOBILE  ≤ 767px
========================================================= */

@media (max-width: 767px) {

  body {
    padding:
      max(12px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));

    background-attachment:
      scroll;
  }

  .login-wrapper {
    min-height:
      100dvh;

    padding:
      20px
      0;

    align-items:
      center;
  }

  .login-card {
    width:
      100%;

    padding:
      36px
      20px
      25px;

    border-radius:
      23px;

    box-shadow:
      0 22px 55px rgba(0, 0, 0, 0.45),
      inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }

  .login-card:hover {
    transform:
      none;
  }

  .login-header {
    margin-bottom:
      23px;
  }

  .login-header h2 {
    font-size:
      clamp(1.75rem, 8vw, 2.05rem);
  }

  .login-header p {
    font-size:
      0.81rem;
  }

  .alert {
    margin-bottom:
      19px;

    padding:
      11px
      13px;

    font-size:
      0.79rem;

    border-radius:
      11px;
  }

  .field {
    margin-bottom:
      17px;
  }

  .field label {
    margin-bottom:
      6px;

    font-size:
      0.69rem;
  }

  .input input {
    min-height:
      49px;

    padding:
      12px
      44px
      12px
      41px;

    font-size:
      0.89rem;

    border-radius:
      13px;
  }

  .input > i:first-child {
    left:
      14px;

    font-size:
      0.94rem;
  }

  .toggle {
    right:
      7px;

    width:
      34px;

    height:
      34px;
  }

  .keep-row {
    margin:
      4px 0
      20px;
  }

  .keep-row label {
    font-size:
      0.79rem;
  }

  .btn {
    min-height:
      49px;

    padding:
      12px
      16px;

    font-size:
      0.90rem;

    border-radius:
      13px;
  }

  .footer {
    margin-top:
      19px;

    padding-top:
      13px;

    font-size:
      0.63rem;
  }

  .loader-content {
    gap:
      16px;
  }

  .loader-content img {
    width:
      100px;
  }

  .loader-spinner {
    width:
      40px;

    height:
      40px;

    border-width:
      3px;
  }

  .loader-text {
    font-size:
      0.80rem;
  }
}
/* =========================================================
   MOBILE PEQUEÑO ≤ 380px
========================================================= */

@media (max-width: 380px) {

  .login-wrapper {
    padding:
      16px
      0;
  }

  .login-card {
    padding:
      30px
      16px
      21px;

    border-radius:
      20px;
  }

  .login-header {
    margin-bottom:
      20px;
  }

  .login-header h2 {
    font-size:
      1.65rem;
  }

  .login-header p {
    font-size:
      0.75rem;
  }

  .field {
    margin-bottom:
      15px;
  }

  .input input {
    min-height:
      47px;

    padding:
      11px
      42px
      11px
      39px;

    font-size:
      0.85rem;
  }

  .input > i:first-child {
    left:
      13px;

    font-size:
      0.88rem;
  }

  .btn {
    min-height:
      47px;

    font-size:
      0.86rem;
  }

  .footer {
    font-size:
      0.59rem;
  }
}


/* =========================================================
   ALTURA REDUCIDA  ≤ 700px
========================================================= */

@media (max-height: 700px) {

  .login-wrapper {
    padding:
      16px
      0;
  }

  .login-card {
    padding:
      30px
      30px
      25px;
  }

  .login-header {
    margin-bottom:
      20px;
  }

  .field {
    margin-bottom:
      15px;
  }

  .keep-row {
    margin-bottom:
      18px;
  }

  .footer {
    margin-top:
      17px;
  }
}


/* =========================================================
   ALTURA MUY REDUCIDA  ≤ 550px
========================================================= */

@media (max-height: 550px) {

  body {
    align-items:
      flex-start;
  }

  .login-wrapper {
    min-height:
      100dvh;

    align-items:
      flex-start;

    padding:
      10px
      0;
  }

  .login-card {
    padding:
      22px
      24px
      18px;
  }

  .login-header {
    margin-bottom:
      14px;
  }

  .login-header h2 {
    font-size:
      1.55rem;
  }

  .login-header p {
    font-size:
      0.72rem;
  }

  .alert {
    margin-bottom:
      12px;

    padding:
      8px
      10px;

    font-size:
      0.70rem;
  }

  .field {
    margin-bottom:
      10px;
  }

  .field label {
    margin-bottom:
      4px;

    font-size:
      0.60rem;
  }

  .input input {
    min-height:
      41px;

    padding:
      8px
      38px
      8px
      36px;

    font-size:
      0.78rem;

    border-radius:
      11px;
  }

  .input > i:first-child {
    left:
      11px;

    font-size:
      0.78rem;
  }

  .toggle {
    width:
      29px;

    height:
      29px;

    font-size:
      0.82rem;
  }

  .keep-row {
    margin:
      1px 0
      12px;
  }

  .keep-row label {
    font-size:
      0.70rem;
  }

  .keep-row input[type="checkbox"] {
    width:
      15px;

    height:
      15px;
  }

  .btn {
    min-height:
      41px;

    padding:
      8px
      13px;

    font-size:
      0.78rem;

    border-radius:
      11px;
  }

  .footer {
    margin-top:
      11px;

    padding-top:
      7px;

    font-size:
      0.54rem;
  }
}


/* =========================================================
   ALTURA EXTREMADAMENTE PEQUEÑA   ≤ 450px
========================================================= */

@media (max-height: 450px) {

  .login-wrapper {
    padding:
      7px
      0;
  }

  .login-card {
    padding:
      17px
      20px
      13px;
  }

  .login-header {
    margin-bottom:
      9px;
  }

  .login-header h2 {
    font-size:
      1.30rem;
  }

  .login-header p {
    display:
      none;
  }

  .alert {
    margin-bottom:
      9px;

    padding:
      7px
      9px;
  }

  .field {
    margin-bottom:
      7px;
  }

  .field label {
    font-size:
      0.55rem;
  }

  .input input {
    min-height:
      36px;

    padding:
      6px
      34px
      6px
      32px;

    font-size:
      0.73rem;
  }

  .input > i:first-child {
    left:
      9px;

    font-size:
      0.70rem;
  }

  .toggle {
    width:
      26px;

    height:
      26px;

    font-size:
      0.76rem;
  }

  .keep-row {
    margin-bottom:
      8px;
  }

  .btn {
    min-height:
      36px;

    padding:
      7px
      11px;

    font-size:
      0.72rem;
  }

  .footer {
    margin-top:
      7px;

    padding-top:
      5px;

    font-size:
      0.48rem;
  }
}


/* =========================================================
   REDUCIR ANIMACIONES SI EL USUARIO LO SOLICITA
========================================================= */

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration:
      0.01ms !important;

    animation-iteration-count:
      1 !important;

    transition-duration:
      0.01ms !important;
  }
}


/* =========================================================
   DISPOSITIVOS TÁCTILES
========================================================= */

@media (hover: none) and (pointer: coarse) {

  .login-card:hover {
    transform:
      none;
  }

  .btn:hover {
    transform:
      none;
  }

  .btn:hover i {
    transform:
      none;
  }

  .toggle:hover {
    transform:
      translateY(-50%);
  }
}
