/* --- LOGIN CARD --- */
.login-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 40px 35px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-soft);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.8);
  margin: 0px auto;
}

.lang-switcher-container {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  /* Visual Style of the Button */
  background-color: var(--primary-light);
  border-radius: 20px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

/* Prefix Select Styling */
.prefix-select {
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background-color: #f8fafc;
  color: var(--dark-slate);
  font-weight: 600;
  padding: 0 35px 0 15px;
  /* Spazio per la freccia */
  height: calc(3.5rem + 2px);
  /* Match input height */
  white-space: nowrap;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
  min-width: 110px;
}

.prefix-select:focus,
.prefix-select:hover {
  border-color: var(--primary-brand);
  background-color: white;
}

.lang-switcher-container:hover {
  background-color: #fff;
  border-color: var(--primary-brand);
  box-shadow: 0 4px 10px rgba(var(--bs-primary-rgb), 0.15);
}

.lang-icon {
  color: var(--primary-deep);
  font-size: 0.9rem;
}

.lang-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-deep);
  min-width: 20px;
  text-align: center;
}

.lang-arrow {
  font-size: 0.7rem;
  color: var(--primary-deep);
  opacity: 0.7;
}

/* The Invisible Select on Top */
.lang-select-hidden {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  /* Invisibile */
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

/* Brand Logo */
.brand-logo {
  text-align: center;
  margin-bottom: 25px;
  margin-top: 10px;
}

.brand-text {
  font-size: 2rem;
  font-weight: 800;
  color: var(--dark-slate);
  letter-spacing: -1px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.brand-text i {
  font-size: 1.8rem;
  color: var(--primary-brand);
}

.brand-text span {
  color: var(--primary-brand);
}

.welcome-text {
  text-align: center;
  color: var(--mid-slate);
  margin-bottom: 25px;
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.5;
}

/* --- TABS SWITCHER --- */
.nav-pills {
  background: #f8fafc;
  padding: 4px;
  border-radius: var(--radius-main);
  margin-bottom: 25px;
  border: 1px solid #e2e8f0;
}

.nav-pills .nav-link {
  color: var(--mid-slate);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-main);
  transition: all 0.2s;
  padding: 8px 0;
}

.nav-pills .nav-link.active {
  background-color: white;
  color: var(--primary-brand);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* Form Elements */
.form-floating {
  margin-bottom: 15px;
}

.form-floating > .form-control {
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding-top: 1.625rem;
  padding-bottom: 0.625rem;
  height: calc(3.5rem + 2px);
  font-size: 1rem;
  color: var(--dark-slate);
  background-color: #f8fafc;
  transition: all 0.2s;
}

.form-floating > .form-control:focus {
  border-color: var(--primary-brand);
  background-color: #fff;
  box-shadow: 0 0 0 4px var(--primary-light);
}

.form-floating > label {
  color: #64748b;
  padding-top: 0.8rem;
}

/* Phone Input Group */
.phone-group {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.btn-prefix {
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background-color: #f8fafc;
  color: var(--dark-slate);
  font-weight: 600;
  padding: 0 15px;
  display: flex;
  align-items: center;
  gap: 5px;
  height: calc(3.5rem + 2px);
  /* Match input height */
  white-space: nowrap;
}

.btn-prefix:hover,
.btn-prefix.show {
  border-color: var(--primary-brand);
  background-color: white;
}

/* Password Toggle */
.password-group {
  position: relative;
}

.btn-toggle-pass {
  position: absolute;
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: #64748b;
  cursor: pointer;
  z-index: 5;
  padding: 5px;
  display: flex;
}

.btn-toggle-pass:hover {
  color: var(--primary-brand);
}

/* Options Row */
.options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  font-size: 0.85rem;
}

.form-check-input {
  border-color: #cbd5e1;
  cursor: pointer;
}

.form-check-input:checked {
  background-color: var(--primary-brand);
  border-color: var(--primary-brand);
}

.link-forgot {
  color: var(--mid-slate);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.link-forgot:hover {
  color: var(--primary-brand);
}

/* Login Button */
.btn-login {
  background: var(--colore-button);
  color: white;
  border-radius: 50px;
  padding: 14px;
  font-weight: 700;
  width: 100%;
  border: none;
  text-transform: uppercase;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
}

/* Footer */
.login-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--mid-slate);
  border-top: 1px solid #f1f5f9;
  padding-top: 20px;
  line-height: 1.4;
  opacity: 0.8;
}

/* RTL Specific Adjustments */
html[dir="rtl"] {
  text-align: right;
}

html[dir="rtl"] .lang-dropdown {
  left: 20px;
  right: auto;
}

html[dir="rtl"] .form-floating > label {
  left: auto;
  right: 0;
  transform-origin: 100% 0;
}

html[dir="rtl"] .form-control {
  text-align: right;
}

html[dir="rtl"] .btn-toggle-pass {
  right: auto;
  left: 15px;
}
/* Footer */
.auth-footer {
  text-align: center;
  font-size: 0.9rem;
  color: var(--mid-slate);
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid #f1f5f9;
}
.auth-footer a {
  color: var(--dark-slate);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 0.2s;
}
.auth-footer a:hover {
  color: var(--primary-brand);
}

/* --- CAPTCHA STYLE --- */
.captcha-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 15px;
  margin-bottom: 20px;
}

.captcha-canvas {
  background-color: #fff;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  cursor: pointer;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05);
}

.btn-refresh {
  background: none;
  border: none;
  color: var(--mid-slate);
  font-size: 1.2rem;
  transition: transform 0.3s;
  padding: 5px;
}
.btn-refresh:hover {
  color: var(--primary-brand);
  transform: rotate(180deg);
}

.captcha-input {
  border: none;
  background: transparent;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 2px;
  width: 90%;
  text-align: center;
  color: var(--dark-slate);
  outline: none;
  border-bottom: 2px solid #e2e8f0;
  transition: border-color 0.2s;
}
.captcha-input:focus {
  border-color: var(--primary-brand);
}
.captcha-input::placeholder {
  font-weight: 400;
  letter-spacing: 0;
  font-size: 0.8rem;
}

/*NOTIFICHE*/
#pwa-install-prompt {
  position: fixed;
  /* in alto, sotto l'eventuale notch */
  top: calc(env(safe-area-inset-top, 0px) + 16px);
  left: 50%;
  transform: translateX(-50%);
  width: 92%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
  color: black;
  padding: 20px;
  border-radius: 22px;
  z-index: 10000;
  display: none;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
/* titolo del banner nel colore primario */
#pwa-install-prompt .pwa-title {
  color: var(--primary-brand);
  font-size: 1.05rem;
}
/* bottone installa: colore secondario, a contrasto con il bottone di login */
.btn-install {
  background: var(--colore-secondario);
  color: #ffffff;
  border: none;
  border-radius: 50px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition:
    filter 0.2s,
    transform 0.2s;
}
.btn-install:hover,
.btn-install:focus,
.btn-install:active {
  background: var(--colore-secondario);
  color: #ffffff;
}
.btn-install:hover {
  filter: brightness(0.94);
}
.btn-install:active {
  transform: scale(0.98);
}
.pwa-close {
  background: none;
  border: 0;
  padding: 0;
  line-height: 1;
  position: absolute;
  top: 12px;
  right: 18px;
  cursor: pointer;
  color: #5c6670;
  font-size: 24px;
}
/* Icone Apple */
.ios-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #007aff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  vertical-align: middle;
  border: 1px solid #007aff;
  margin: 0 2px;
  font-size: 16px;
}
.ios-plus {
  border: 1px solid #007aff;
  color: #007aff;
}

/* Pagina centrata verticalmente (login) */
body.page-center {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
body.page-center > .container {
  width: 100%;
}

/* Requisiti password (cambio / reset password) */
.pw-rules {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 15px;
  font-size: 0.85rem;
  color: var(--dark-slate);
}
.pw-rules-title {
  font-weight: 700;
  margin-bottom: 6px;
}
.pw-rules-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.pw-rules-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  color: var(--mid-slate);
}
.pw-rules-list li i {
  flex-shrink: 0;
}
.pw-rules-list li.ok {
  color: #146c43;
}
.pw-rules-list li.pw-rule-info {
  color: var(--mid-slate);
}
.pw-classes {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 22px;
}
.pw-class {
  padding: 2px 10px;
  border-radius: 50px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--mid-slate);
}
.pw-class.ok {
  background: #198754;
  border-color: #198754;
  color: #fff;
}
.btn-login:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
