/* ====================================
   AUTH PAGES STYLES — Sliding Panels
   Login, Register, Reset Password
   File dedicato: caricato solo su login.html e reset-password.html
   ==================================== */

/* ---- Wrapper principale ---- */
.auth-wrapper {
  position: relative;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
  background: #f8fafc;
}

/* Nascondi scrollbar ovunque */
.auth-wrapper {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.auth-wrapper::-webkit-scrollbar {
  display: none;
}

.auth-panel {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.auth-panel::-webkit-scrollbar {
  display: none;
}

/* ====================================
   PANNELLI FORM (50% ciascuno)
   Login a DESTRA (default), Register nascosto
   ==================================== */

.auth-panel {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 3rem;
  transition: all 0.6s ease-in-out;
  overflow-y: auto;
}

/* Login: visibile a DESTRA (default) */
.sign-in-panel {
  left: 50%;
  z-index: 2;
}

/* Register: nascosto a destra */
.sign-up-panel {
  left: 50%;
  opacity: 0;
  z-index: 1;
}

/* Attivo: Login scivola a sinistra e scompare */
.auth-wrapper.right-panel-active .sign-in-panel {
  transform: translateX(-100%);
  opacity: 0;
}

/* Attivo: Register scivola a sinistra e appare */
.auth-wrapper.right-panel-active .sign-up-panel {
  transform: translateX(-100%);
  opacity: 1;
  z-index: 5;
  animation: authShow 0.6s;
}

@keyframes authShow {
  0%, 49.99% { opacity: 0; z-index: 1; }
  50%, 100%  { opacity: 1; z-index: 5; }
}

/* ====================================
   CONTENUTO FORM
   ==================================== */

.auth-panel-content {
  width: 100%;
  max-width: 420px;
}

.auth-panel-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text-dark);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.auth-panel-brand span:first-child {
  font-size: 1.4rem;
}

.auth-form-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 0.2rem;
}

.auth-form-subtitle {
  color: var(--text-light);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

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

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-form-group {
  margin-bottom: 0;
}

.auth-form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-form-label i {
  margin-right: 0.35rem;
  color: var(--text-light);
}

.auth-input-wrapper {
  position: relative;
}

.auth-form-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.9rem;
  transition: border-color 0.3s, box-shadow 0.3s;
  background: #fff;
  font-family: inherit;
}

.auth-form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(251, 75, 57, 0.1);
}

.auth-input-icon {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  cursor: pointer;
  transition: color 0.3s;
}

.auth-input-icon:hover {
  color: var(--text-dark);
}

.auth-input-hint {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-top: 0.2rem;
}

/* Row 2 colonne (Nome/Cognome) */
.auth-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

/* ====================================
   REMEMBER & FORGOT
   ==================================== */

.auth-remember-forgot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-remember-label {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.auth-remember-label input {
  width: 1rem;
  height: 1rem;
  margin-right: 0.5rem;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.auth-remember-label span {
  font-size: 0.8rem;
  color: var(--text-light);
}

.auth-forgot-link {
  font-size: 0.8rem;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s;
}

.auth-forgot-link:hover {
  color: #c0392b;
}

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

.auth-submit-btn {
  width: 100%;
  padding: 0.7rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(251, 75, 57, 0.3);
  font-family: inherit;
}

.auth-submit-btn:hover {
  background: #e03e2d;
  box-shadow: 0 6px 20px rgba(251, 75, 57, 0.4);
  transform: translateY(-1px);
}

.auth-submit-btn i {
  margin-right: 0.5rem;
}

/* ====================================
   OVERLAY — Pannello rosso con bordo arrotondato
   Parte a SINISTRA, scivola a DESTRA
   ==================================== */

.auth-overlay-container {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  width: calc(50% - 1.5rem);
  height: calc(100% - 1.5rem);
  border-radius: 24px;
  overflow: hidden;
  z-index: 100;
  transition: transform 0.6s ease-in-out;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
}

.auth-wrapper.right-panel-active .auth-overlay-container {
  transform: translateX(calc(100% + 1.5rem));
}

/* Background gradient */
.auth-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #ff6b56 0%, var(--primary-color) 50%, #c0392b 100%);
}

/* Decorazioni cerchi */
.auth-overlay::before,
.auth-overlay::after {
  content: '';
  position: absolute;
  border-radius: 50%;
}

.auth-overlay::before {
  width: 280px;
  height: 280px;
  background: rgba(255, 255, 255, 0.08);
  top: -60px;
  right: -40px;
}

.auth-overlay::after {
  width: 180px;
  height: 180px;
  background: rgba(255, 255, 255, 0.06);
  bottom: -40px;
  left: -30px;
}

/* Pannelli interni — cross-fade */
.auth-overlay-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  text-align: center;
  transition: opacity 0.5s ease-in-out;
  color: white;
}

/* Pannello "Registrati" — visibile di default (login attivo) */
.overlay-panel-register {
  opacity: 1;
}

.auth-wrapper.right-panel-active .overlay-panel-register {
  opacity: 0;
  pointer-events: none;
}

/* Pannello "Accedi" — visibile quando register attivo */
.overlay-panel-login {
  opacity: 0;
  pointer-events: none;
}

.auth-wrapper.right-panel-active .overlay-panel-login {
  opacity: 1;
  pointer-events: auto;
}

/* Contenuto overlay */
.auth-overlay-title {
  font-size: 1.85rem;
  font-weight: 800;
  margin-bottom: 0.6rem;
  line-height: 1.2;
}

.auth-overlay-text {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 1.5rem;
  line-height: 1.5;
  max-width: 280px;
}

/* Feature list con emoji */
.auth-overlay-features {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.75rem;
  width: 100%;
  max-width: 260px;
}

.auth-overlay-feature {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-align: left;
  padding: 0.45rem 0.7rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  backdrop-filter: blur(4px);
  transition: background 0.3s;
}

.auth-overlay-feature:hover {
  background: rgba(255, 255, 255, 0.2);
}

.auth-overlay-feature-emoji {
  font-size: 1.3rem;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
}

.auth-overlay-feature span:last-child {
  font-size: 0.85rem;
  font-weight: 500;
}

/* Bottone ghost */
.auth-overlay-btn {
  padding: 0.65rem 2.5rem;
  border: 2px solid white;
  background: transparent;
  color: white;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
  letter-spacing: 0.5px;
}

.auth-overlay-btn:hover {
  background: white;
  color: var(--primary-color);
}

/* Copyright */
.auth-overlay-footer {
  position: absolute;
  bottom: 1.25rem;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.7rem;
}

/* ====================================
   REGISTER DESKTOP — tutto nel viewport
   ==================================== */

@media (min-width: 768px) {
  .sign-up-panel {
    padding: 1.5rem 3rem;
  }

  .sign-up-panel .auth-panel-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-height: 100vh;
  }

  .sign-up-panel .auth-panel-brand {
    margin-bottom: 0.6rem;
  }

  .sign-up-panel .auth-form-title {
    font-size: 1.4rem;
    margin-bottom: 0.15rem;
  }

  .sign-up-panel .auth-form-subtitle {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
  }

  .sign-up-panel .auth-form {
    gap: 0.5rem;
  }

  .sign-up-panel .auth-form-label {
    font-size: 0.7rem;
    margin-bottom: 0.2rem;
  }

  .sign-up-panel .auth-form-input {
    padding: 0.55rem 0.85rem;
    font-size: 0.9rem;
  }

  .sign-up-panel .auth-submit-btn {
    padding: 0.6rem;
    font-size: 0.9rem;
    margin-top: 0.15rem;
  }

  .sign-up-panel .auth-form-row {
    gap: 0.5rem;
  }
}

/* ====================================
   MOBILE TOGGLE (visibile solo < 768px)
   ==================================== */

.auth-mobile-toggle {
  display: none;
  text-align: center;
  margin-top: 1rem;
  color: var(--text-light);
  font-size: 0.85rem;
}

.auth-mobile-toggle a {
  color: var(--primary-color);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.auth-mobile-toggle a:hover {
  color: #c0392b;
  text-decoration: underline;
}

/* Mobile header con tocco rosso */
.auth-mobile-header {
  display: none;
  text-align: center;
  background: linear-gradient(135deg, #ff6b56 0%, var(--primary-color) 50%, #c0392b 100%);
  padding: 1.25rem 1rem;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  box-shadow: 0 4px 20px rgba(251, 75, 57, 0.25);
}

.auth-mobile-header-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: white;
  font-size: 1.2rem;
  font-weight: 700;
}

.auth-mobile-header-brand span:first-child {
  font-size: 1.4rem;
}

/* ====================================
   ALERT FIXED TOAST
   ==================================== */

.auth-alert-fixed {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  width: 90%;
  max-width: 400px;
}

/* ====================================
   PASSWORD STRENGTH (compatto)
   ==================================== */

.password-strength-container {
  display: none;
  margin-top: 0.35rem;
  padding: 0.5rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.password-strength-container.show {
  display: block;
}

.password-strength-bar-container {
  width: 100%;
  height: 3px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.3rem;
}

.password-strength-bar {
  height: 100%;
  width: 0;
  transition: all 0.3s;
  border-radius: 3px;
}

.password-strength-text {
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.password-requirements {
  list-style: none;
  font-size: 0.65rem;
  padding-left: 0;
  columns: 2;
  column-gap: 0.5rem;
}

.password-requirements li {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.15rem;
  color: var(--text-light);
  break-inside: avoid;
}

.password-requirements li.met {
  color: var(--success);
}

.password-requirements li span:first-child {
  flex-shrink: 0;
  font-size: 0.6rem;
}

/* ====================================
   LOADING OVERLAY AUTH
   ==================================== */

.auth-loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

.auth-loading-overlay.show {
  display: flex;
}

.auth-spinner {
  width: 3rem;
  height: 3rem;
  border: 4px solid #e2e8f0;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ====================================
   RESPONSIVE MOBILE (< 768px)
   ==================================== */

@media (max-width: 767px) {
  /* Blocca viewport — login non scorre MAI */
  html, body {
    height: 100%;
    overflow: hidden;
  }

  body {
    display: flex;
    flex-direction: column;
  }

  /* Header rosso: altezza fissa */
  .auth-mobile-header {
    display: block;
    flex-shrink: 0;
  }

  /* Wrapper: riempie spazio restante, NO min-height: 100vh */
  .auth-wrapper {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  /* Quando register attivo: permetti scroll */
  .auth-wrapper.right-panel-active {
    overflow-y: auto;
  }

  /* Pannelli base */
  .auth-panel {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 1rem 1.5rem 1.5rem;
    left: 0 !important;
  }

  /* Login: fisso nel viewport */
  .sign-in-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  /* Register: altezza automatica, scorre */
  .sign-up-panel {
    display: none;
    opacity: 1;
    height: auto;
    overflow-y: visible;
    padding-bottom: 2rem;
  }

  .auth-wrapper.right-panel-active .sign-in-panel {
    display: none;
    transform: none;
    opacity: 1;
  }

  .auth-wrapper.right-panel-active .sign-up-panel {
    display: flex;
    transform: none;
    animation: none;
  }

  /* Overlay desktop nascosto */
  .auth-overlay-container {
    display: none;
  }

  /* Toggle e brand */
  .auth-mobile-toggle {
    display: block;
  }

  .auth-panel-brand {
    display: none;
  }

  .auth-panel-content {
    max-width: 100%;
    width: 100%;
  }

  .auth-form-title {
    font-size: 1.4rem;
    text-align: center;
  }

  .auth-form-subtitle {
    text-align: center;
    font-size: 0.85rem;
  }

  /* Linea rossa sotto il titolo */
  .auth-form-title::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px;
    margin: 0.5rem auto 0;
  }

  .auth-submit-btn {
    margin-top: 0.5rem;
    padding: 0.8rem;
    font-size: 1rem;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(251, 75, 57, 0.35);
  }

  .auth-form-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .auth-form-input:focus {
    box-shadow: 0 0 0 3px rgba(251, 75, 57, 0.15);
  }
}

/* Schermi molto piccoli */
@media (max-width: 380px) {
  .auth-form-row {
    grid-template-columns: 1fr;
  }
}

/* ====================================
   RESET PASSWORD — Layout come login
   ==================================== */

.reset-panel {
  position: relative;
  width: 50%;
  height: 100%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 3rem;
}

.reset-overlay-position {
  /* Overlay a SINISTRA (fisso, non scorre) */
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  width: calc(50% - 1.5rem);
  height: calc(100% - 1.5rem);
  border-radius: 24px;
  overflow: hidden;
  z-index: 100;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
}

.reset-expired {
  display: none;
  text-align: center;
  padding: 1.5rem 0;
}

.reset-expired.show {
  display: block;
}

.reset-expired-icon {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: #fef2f2;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.reset-expired-icon i {
  font-size: 1.8rem;
  color: var(--primary-color);
}

.reset-expired h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.reset-expired p {
  color: var(--text-light);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ====================================
   MODALE FORGOT PASSWORD
   ==================================== */

.forgot-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.forgot-modal-card {
  background: #fff;
  border-radius: 20px;
  padding: 2rem;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  text-align: center;
}

.forgot-modal-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b56, #e11d48);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.forgot-modal-icon i {
  font-size: 1.3rem;
  color: white;
}

.forgot-modal-title {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
}

.forgot-modal-text {
  margin: 0 0 1.25rem;
  color: var(--text-light);
  font-size: 0.88rem;
  line-height: 1.5;
}

.forgot-modal-card .auth-form-input {
  text-align: left;
}

.forgot-modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.forgot-modal-btn-cancel {
  flex: 1;
  padding: 0.7rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.3s;
}

.forgot-modal-btn-cancel:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: var(--text-dark);
}

.forgot-modal-btn-confirm {
  flex: 1;
  padding: 0.7rem;
  border: none;
  border-radius: 10px;
  background: var(--primary-color);
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(251, 75, 57, 0.3);
}

.forgot-modal-btn-confirm:hover {
  background: #e03e2d;
  box-shadow: 0 6px 20px rgba(251, 75, 57, 0.4);
  transform: translateY(-1px);
}

.forgot-modal-btn-confirm i {
  margin-right: 0.3rem;
}

/* ====================================
   RESPONSIVE RESET PASSWORD (< 768px)
   ==================================== */

@media (max-width: 767px) {
  .reset-panel {
    position: relative;
    width: 100%;
    height: 100%;
    left: 0;
    padding: 1rem 1.5rem 1.5rem;
  }

  .reset-overlay-position {
    display: none;
  }
}