* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

/* ================= DESKTOP ================= */

.bg {
  min-height: 100vh;
  background: url("img/bg-login.png") no-repeat center center;
  background-size: cover;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mobile-hero {
  display: none;
}

.logo-area {
  padding-top: 40px;
  padding-bottom: 30px;
}

.logo {
  max-width: 220px;
  height: auto;
}

.center-area {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 20px;
}

.login-box {
  max-width: 600px;
  width: 100%;
  padding: 40px 60px;
  background: rgba(255, 230, 244, 0.92);
  border-radius: 22px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.18);
  color: #7a297e;
}

.login-title {
  text-align: center;
  font-size: 26px;
  margin-bottom: 8px;
}

.login-subtitle {
  text-align: center;
  font-size: 14px;
  margin-bottom: 30px;
  color: #9b3f9e;
}

.field {
  margin-bottom: 22px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #7a297e;
}

.input-wrapper {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #c27ccc;
  padding: 6px 0;
}

.icon-left {
  margin-right: 8px;
  font-size: 18px;
  color: #9b3f9e;
}

.input-wrapper input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  padding: 6px 0;
  color: #7a297e;
}

.input-wrapper input::placeholder {
  color: #bd86c5;
}

.icon-right {
  border: none;
  background: transparent;
  cursor: pointer;
  padding-left: 8px;
  font-size: 18px;
  color: #9b3f9e;
  display: flex;
  align-items: center;
}

.error-msg {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #d62839;
}

.btn-login {
  width: 100%;
  margin-top: 20px;
  padding: 14px 0;
  border: none;
  border-radius: 999px;
  background: #b97ccc;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-login:disabled {
  opacity: 0.6;
}

.btn-login:hover:not(:disabled) {
  background: #a35bb9;
}

@media (min-width: 1024px) {
  .bg {
    justify-content: center;
  }

  .center-area {
    max-width: 900px;
  }
}

/* ================= LOADING ================= */

#loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  z-index: 99999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.loading-wrapper {
  position: relative;
  width: 110px;
  height: 110px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.loading-spinner {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: #7a297e;
  border-right-color: #b97ccc;
  animation: girar 1s linear infinite;
}

.loading-logo {
  width: 70px;
  height: 70px;
  object-fit: contain;
  border-radius: 50%;
  animation: pulsar 1s ease-in-out infinite;
}

@keyframes girar {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes pulsar {
  0%, 100% { opacity: 1;   transform: scale(1);    }
  50%       { opacity: 0.4; transform: scale(0.88); }
}

/* ================= MOBILE (ATÉ 640px) ================= */

@media (max-width: 640px) {

  html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
  }

  body {
    background: #ffffff;
  }

  .bg {
    min-height: 100vh;
    background: #ffffff;
    align-items: stretch;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
  }

  .mobile-hero {
    display: block;
    width: 140%;
    height: 540px;
    margin-left: -20%;
    margin-top: 0;
    flex-shrink: 0;
    background: url("img/home-crediffato.png") no-repeat center -40px;
    background-size: cover;
    border-bottom-left-radius: 50% 20%;
    border-bottom-right-radius: 50% 20%;
  }

  .logo-area {
    display: none;
  }

  .center-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
  }

  .login-box {
    max-width: none;
    width: 100%;
    padding: 0;
    background: #ffffff;
    border-radius: 0;
    box-shadow: none;
    color: #222222;
    display: flex;
    flex-direction: column;
  }

  .login-box::before {
    display: none;
  }

  .login-title,
  .login-subtitle,
  #login-form {
    padding-left: 20px;
    padding-right: 20px;
  }

  .login-title {
    text-align: left;
    font-size: 22px;
    margin-top: 16px;
    margin-bottom: 4px;
    color: #222222;
  }

  .login-subtitle {
    text-align: left;
    font-size: 14px;
    margin-bottom: 24px;
    color: #777777;
  }

  .field {
    margin-bottom: 12px;
  }

  .field label {
    display: none;
  }

  .input-wrapper {
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    padding: 0 14px;
    height: 48px;
  }

  .icon-left {
    display: none;
  }

  .input-wrapper input {
    padding: 0;
    font-size: 14px;
    color: #333333;
  }

  .input-wrapper input::placeholder {
    color: #9c9c9c;
  }

  .icon-right {
    position: static;
    font-size: 18px;
    color: #9c9c9c;
  }

  .error-msg {
    padding-left: 20px;
  }

  .btn-login {
    margin: 16px 20px 0;
    width: calc(100% - 40px);
    height: 48px;
    border-radius: 8px;
    background: #e1003c;
    font-size: 16px;
    padding: 0;
  }
}
