@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap");

/* ===== RESET E VARIABILI GLOBALI ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
  text-decoration: none;
  list-style: none;
}

/* ===== COLORI ===== */
:root {
  --primary-purple: #9e3ffd;
  --primary-dark: #7c3aed;
  --light-bg: #f0e6ff;
  --white: #fff;
  --dark-text: #333;
  --light-text: #888;
  --error-bg: #ffe6e6;
  --error-color: #ff4444;
  --error-dark: #cc0000;
  --success-bg: #e6ffe6;
  --success-color: #44dd44;
  --success-dark: #00aa00;
}

/* ===== BODY ===== */
body {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  min-height: 100vh;
  background: linear-gradient(
    180deg,
    #f0e6ff 0%,
    #e8d5ff 15%,
    #d4b0f5 30%,
    #c080e8 50%,
    #a855f7 70%,
    #9d4edd 85%,
    #7c3aed 100%
  );
  background-attachment: fixed;
}

/* ===== INTRO/OUTRO ===== */
.intro {
  margin-bottom: 30px;
  text-align: center;
  color: var(--dark-text);
}

.intro h1 {
  font-size: 40px;
  margin-bottom: 10px;
}

.intro p {
  font-size: 14.5px;
}

.outro {
  margin-top: 30px;
  text-align: center;
  font-size: 14.5px;
  color: var(--white);
}

.outro a {
  color: var(--white);
}

/* ===== CONTAINER PRINCIPALE ===== */
.container {
  position: relative;
  width: 950px;
  height: 650px;
  background: var(--white);
  margin: 20px;
  border-radius: 30px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.container h1 {
  font-size: 36px;
  margin: -10px 0;
}

.container p {
  font-size: 14.5px;
  margin: 15px 0;
}

/* ===== FORM BOX ===== */
form {
  width: 100%;
}

.form-box {
  position: absolute;
  right: 0;
  width: 50%;
  height: 100%;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--dark-text);
  text-align: center;
  padding: 40px;
  z-index: 1;
  transition: 0.6s ease-in-out 1.2s;
  visibility: hidden;
}

.form-box.login {
  visibility: visible;
}

.container.active .form-box {
  right: 50%;
}

.container.active .form-box.register {
  visibility: visible;
}

/* ===== INPUT BOX ===== */
.input-box {
  position: relative;
  margin: 30px 0;
}

.input-box input {
  width: 100%;
  padding: 13px 50px 13px 20px;
  background: #eee;
  border: none;
  border-radius: 8px;
  outline: none;
  font-size: 16px;
  color: var(--dark-text);
  font-weight: 500;
  transition: 0.3s;
}

.input-box input::placeholder {
  color: var(--light-text);
  font-weight: 400;
}

.input-box input:focus {
  background: #f5f5f5;
}

.input-box i {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--light-text);
}

/* ===== PASSWORD INPUT BOX ===== */
.password-input-box {
  position: relative;
}

/* Icona toggle password */
.toggle-password {
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
}

/* ===== LINK E CHECKBOX ===== */
.forget-link {
  margin: -15px 0 15px;
}

.forget-link a {
  font-size: 14.5px;
  color: var(--dark-text);
  transition: 0.3s;
}

.forget-link a:hover {
  color: var(--primary-purple);
}

.check-box {
  display: flex;
  align-items: center;
  margin: -15px 0 15px;
  font-size: 14.5px;
  color: var(--dark-text);
}

.check-box input {
  margin-right: 8px;
  accent-color: var(--primary-purple);
}

.check-box a {
  color: var(--primary-purple);
  transition: 0.3s;
}

.check-box a:hover {
  text-decoration: underline;
}

/* ===== BUTTON ===== */
.btn {
  width: 100%;
  height: 48px;
  background: var(--primary-purple);
  border: none;
  border-radius: 8px;
  color: var(--white);
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: 0.3s;
}

.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
  transform: translateY(0);
}

/* ===== TOGGLE BOX ===== */
.toggle-box {
  position: absolute;
  width: 100%;
  height: 100%;
}

.toggle-box::before {
  content: "";
  position: absolute;
  left: -250%;
  width: 300%;
  height: 100%;
  background: var(--primary-purple);
  border-radius: 150px;
  z-index: 2;
  transition: 1.8s ease-in-out;
}

.container.active .toggle-box::before {
  left: 50%;
}

.toggle-panel {
  position: absolute;
  width: 50%;
  height: 100%;
  color: var(--white);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2;
  transition: 0.6s ease-in-out;
}

.toggle-panel.toggle-left {
  left: 0;
  transition-delay: 1.2s;
}

.container.active .toggle-panel.toggle-left {
  left: -50%;
  transition-delay: 0.6s;
}

.toggle-panel.toggle-right {
  right: -50%;
  transition-delay: 0.6s;
}

.container.active .toggle-panel.toggle-right {
  right: 0;
  transition-delay: 1.2s;
}

.toggle-panel h1 {
  font-size: 32px;
  margin-bottom: 10px;
}

.toggle-panel p {
  margin-bottom: 20px;
  font-size: 14.5px;
}

.toggle-panel .btn {
  width: 160px;
  height: 46px;
  background: transparent;
  border: 2px solid var(--white);
  box-shadow: none;
}

.toggle-panel .btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ===== MESSAGGI DI ERRORE ===== */
.error-messages {
  margin: 15px 0;
  padding: 10px;
  background-color: var(--error-bg);
  border: 1px solid var(--error-color);
  border-radius: 5px;
  display: none;
  text-align: center;
}

.error-messages:not(:empty) {
  display: block;
}

.error-message {
  color: var(--error-dark);
  font-size: 14px;
  margin: 5px 0;
  font-weight: 500;
}

/* Input con errore */
.input-error {
  border: 2px solid var(--error-color) !important;
  background-color: #fff5f5 !important;
}

.input-error:focus {
  border: 2px solid var(--error-color) !important;
  box-shadow: 0 0 5px rgba(255, 68, 68, 0.5);
}

/* ===== MODALE ===== */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background-color: var(--white);
  padding: 40px;
  border-radius: 10px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-content h2 {
  color: var(--dark-text);
  font-size: 24px;
  margin-bottom: 15px;
  margin-top: 0;
}

.modal-content p {
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 20px;
  color: var(--dark-text);
}

.close {
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: #999;
  transition: 0.3s;
}

.close:hover {
  color: var(--dark-text);
}

/* ===== MODALE BUTTON GROUP ===== */
.modal-button-group {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 10px;
  margin-top: 20px;
  margin-bottom: 15px;
}

.btn-modal-cancel {
  background: var(--white);
  color: var(--dark-text);
  border: 1px solid var(--error-color);
  box-shadow: none;
}

.btn-modal-cancel:hover {
  background: #fff5f5;
  border-color: var(--error-color);
  color: var(--error-color);
  transform: translateY(-2px);
}

/* ===== MESSAGGI DI SUCCESSO ===== */
.success-message {
  margin-top: 15px;
  padding: 10px;
  background-color: var(--success-bg);
  border: 1px solid var(--success-color);
  border-radius: 5px;
  color: var(--success-dark);
  font-weight: 500;
  text-align: center;
  animation: slideUp 0.3s ease;
}
