/* RESET BASE */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background: #f7f7f7;
  color: #111;
}

img, svg {
  display: block;
  max-width: 100%;
}

button, input {
  font: inherit;
}

/* CONTENITORE PRINCIPALE */
.card {
  width: 100%;
  max-width: 920px;
  margin: 40px auto;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.06);
}

/* HEADER */
.meta {
  margin-bottom: 28px;
}

.title {
  font-size: 32px;
  font-weight: 800;
  color: #111;
  line-height: 1.15;
  margin-bottom: 18px;
  letter-spacing: -0.5px;
}

.progress {
  width: 100%;
  height: 10px;
  background: #efefef;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #111 0%, #444 100%);
  transition: width 0.35s ease;
}

/* FORM */
#contactForm {
  width: 100%;
}

.contenitoreform {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.field label {
  font-size: 14px;
  font-weight: 700;
  color: #111;
  line-height: 1.4;
}

.field label + label {
  font-size: 13px;
  font-weight: 500;
  color: #555;
  margin-top: -2px;
}

.field input {
  width: 100%;
  height: 56px;
  border: 1px solid #dcdcdc;
  border-radius: 16px;
  padding: 0 16px;
  background: #fff;
  color: #111;
  font-size: 16px;
  outline: none;
  transition: all 0.25s ease;
}

.field input::placeholder {
  color: #999;
}

.field input:focus {
  border-color: #111;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.08);
}

.field input:hover {
  border-color: #999;
}

/* CHECKBOX PRIVACY */
.sr {
  width: 100%;
  align-items: flex-start;
  gap: 12px;
  background: #fafafa;
  border: 1px solid #e6e6e6;
  border-radius: 18px;
  padding: 16px 18px;
}

.sr input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin-top: 2px;
  accent-color: #111;
  cursor: pointer;
}

.sr label {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #222;
  font-weight: 500;
}

/* AZIONI */
.actions {
  margin-top: 26px;
  display: flex;
  justify-content: center;
}

#submitBtn {
  width: 100%;
  max-width: 340px;
  min-height: 56px;
  border: 0;
  border-radius: 16px;
  background: #111;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.6px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
}

#submitBtn:hover {
  background: #222;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
}

#submitBtn:active {
  transform: translateY(0);
}

#submitBtn:disabled {
  background: #b8b8b8;
  cursor: not-allowed;
  box-shadow: none;
}

/* OVERLAY LOADING */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.3s ease;
}

.overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.gear {
  width: 78px;
  height: 78px;
}

.spin {
  transform-origin: 32px 32px;
  animation: rotateGear 2s linear infinite;
}

@keyframes rotateGear {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.loader-text {
  font-size: 18px;
  font-weight: 700;
  color: #111;
  text-align: center;
}

.bar {
  width: 240px;
  max-width: 80vw;
  height: 10px;
  background: #e9e9e9;
  border-radius: 999px;
  overflow: hidden;
}

.bar span {
  display: block;
  width: 45%;
  height: 100%;
  background: linear-gradient(90deg, #111 0%, #555 100%);
  border-radius: 999px;
  animation: loadingBar 1.4s ease-in-out infinite;
}

@keyframes loadingBar {
  0% {
    transform: translateX(-120%);
    width: 35%;
  }
  50% {
    width: 55%;
  }
  100% {
    transform: translateX(320%);
    width: 35%;
  }
}

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.3s ease;
}

.modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal .box {
  width: 100%;
  max-width: 620px;
  background: #fff;
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal.active .box {
  transform: translateY(0);
}

.headboxx {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

#modalTitle {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  color: #111;
}

#closeboxs {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #f3f3f3;
  border: 1px solid #e2e2e2;
  position: relative;
  cursor: pointer;
  transition: all 0.25s ease;
}

#closeboxs::before,
#closeboxs::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2px;
  background: #111;
  border-radius: 10px;
}

#closeboxs::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

#closeboxs::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

#closeboxs:hover {
  background: #111;
  border-color: #111;
}

#closeboxs:hover::before,
#closeboxs:hover::after {
  background: #fff;
}

#modalSubtitle,
#modalSubtitles {
  margin: 0 0 14px 0;
  color: #222;
  line-height: 1.6;
}

.summary {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.summary > * {
  background: #fafafa;
  border: 1px solid #ececec;
  border-radius: 16px;
  padding: 14px 16px;
  color: #111;
}

/* ACCESSIBILITÀ */
input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(0, 0, 0, 0.15);
  outline-offset: 2px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .card {
    margin: 20px 0;
    padding: 22px 2%;
    border-radius: 20px;
  }

  .title {
    font-size: 26px;
  }

  .contenitoreform {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 14px;
  }

  .field input {
    height: 52px;
    font-size: 15px;
  }

  .sr {
    padding: 14px;
    border-radius: 16px;
  }

  .sr label {
    font-size: 13px;
    line-height: 1.5;
  }

  #submitBtn {
    max-width: 100%;
    width: 100%;
  }

  .modal .box {
    padding: 22px 16px;
    border-radius: 20px;
  }

  #modalTitle {
    font-size: 23px;
  }

  .loader-text {
    font-size: 16px;
    padding: 0 16px;
  }
}

@media (max-width: 480px) {
  .title {
    font-size: 22px;
  }

  .field label {
    font-size: 13px;
  }

  .field label + label {
    font-size: 12px;
  }

  .field input {
    padding: 0 14px;
  }

  .bar {
    width: 190px;
  }

  #closeboxs {
    width: 38px;
    height: 38px;
  }
}