/* ========================================================================== */
/* Reset & Base                                                              */
/* ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #ffffff;
  color: #001f3f;
  font-size: 18px;
  line-height: 1.6;
}

/* Migliora lo scroll verso le anchor (sezione sotto il menu sticky) */
section { scroll-margin-top: 90px; }

/* Link */
a {
  color: #001f3f;
  text-decoration: none;
  transition: color 0.3s ease;
}
a:hover { color: #003366; }

/* Accessibilità: contenuti “solo per screen reader” */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* Focus visibile per tutti gli elementi focusabili */
*:focus {
  outline: 2px solid #001f3f;
  outline-offset: 2px;
}
button:focus, input:focus, textarea:focus, select:focus {
  outline: 2px solid #001f3f;
  outline-offset: 2px;
}

/* ========================================================================== */
/* Tipografia                                                                 */
/* ========================================================================== */
h1 { 
  font-size: clamp(2rem, 5vw, 3rem); 
  margin-bottom: 20px; 
  font-weight: 700; 
}
h2 { 
  font-size: clamp(1.8rem, 4vw, 2.5rem); 
  margin-bottom: 20px; 
  font-weight: 700; 
}
h3 { 
  font-size: clamp(1.4rem, 3vw, 1.8rem); 
  margin-bottom: 20px; 
  font-weight: 700; 
}
p { 
  font-size: 18px; 
  margin-bottom: 20px; 
  line-height: 1.7;
}

/* ========================================================================== */
/* Header                                                                     */
/* ========================================================================== */
.header {
  background: linear-gradient(135deg, #001f3f 0%, #003366 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 30px 40px;
  border-bottom: 5px solid #f6d1d1;
  flex-wrap: wrap;
  box-shadow: 0 4px 20px rgba(0, 31, 63, 0.3);
  position: relative;
}

.logo img {
  width: 250px;
  height: auto;
  border-radius: 10px;
  transition: transform 0.3s ease;
}
.logo img:hover { transform: scale(1.05); }

.header-text {
  flex: 1;
  margin-left: 20px;
  text-align: center;
}
.header-text h1 {
  font-size: 3rem;
  margin: 0 0 10px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
.header-text .sottotitolo {
  font-size: 1.3rem;
  margin: 5px 0;
  opacity: 0.9;
}

.header-image img.header-professional {
  width: 200px;
  height: auto;
  border-radius: 15px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
  transition: transform 0.3s ease;
}
.header-image img.header-professional:hover { transform: scale(1.05); }

/* ========================================================================== */
/* Menu principale                                                            */
/* ========================================================================== */
.menu {
  background: #f6d1d1;
  padding: 15px 0;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}
.menu ul {
  list-style: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
}
.menu ul li {
  margin: 0 15px;
  position: relative;
}
.menu ul li a {
  font-weight: 700;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  cursor: pointer;
  padding: 12px 18px;
  border-radius: 8px;
  display: block;
}
.menu ul li a:hover {
  color: #fff;
  background-color: #001f3f;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,31,63,0.3);
}

/* Dropdown */
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  background: #f6d1d1;
  border: 2px solid #e0c0c0;
  border-radius: 12px;
  list-style: none;
  margin: 0;
  padding: 10px 0;
  min-width: 220px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  z-index: 1000;
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
  transition: all 0.3s ease;
}
.menu ul li:hover .dropdown-menu,
.menu .dropdown.open-dropdown .dropdown-menu {
  display: block;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.dropdown-menu li { margin: 0; }
.dropdown-menu li a {
  display: block;
  padding: 12px 20px;
  font-size: 1rem;
  transition: all 0.3s ease;
  border-radius: 8px;
  margin: 2px 8px;
}
.dropdown-menu li a:hover {
  background: #001f3f;
  color: #fff;
  transform: translateX(5px);
}
.freccetta {
  font-size: 0.8rem;
  margin-left: 5px;
  transition: transform 0.3s ease;
}
.dropdown:hover .freccetta,
.menu .dropdown.open-dropdown .freccetta {
  transform: rotate(180deg);
}

/* ========================================================================== */
/* Sezioni                                                                    */
/* ========================================================================== */
section {
  padding: 60px 20px;
  max-width: 1200px;
  margin: 40px auto;
  border: 2px solid #f6d1d1;
  border-radius: 20px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  background: #ffffff;
}
section:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}
.always-visible { /* semantica: nulla di speciale, resta per compatibilità */ }

/* Header sezione con pulsante a destra (usato per Candidatura Spontanea e Offerte) */
.section-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
  flex-wrap:nowrap;              /* SEMPRE sulla stessa riga, anche su mobile */
}
.section-header h2{
  margin:0;
  flex:1 1 auto;
  min-width:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.section-header .btn-candidati{
  flex:0 0 auto;
  margin-left:auto;
  white-space:nowrap;
}

/* ========================================================================== */
/* Griglie: servizi e riquadri                                                */
/* ========================================================================== */
.servizi, .riquadri {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 30px;
  text-align: left;
}
.servizi { text-align: center; }

.servizio, .riquadro {
  padding: 35px;
  background: #ffffff;
  border: 2px solid #f6d1d1;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  /* per animazione in entrata */
  opacity: 0; transform: translateY(50px);
}
.servizio.animate, .riquadro.animate { opacity: 1; transform: translateY(0); }

.servizio::before, .riquadro::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 100%; height: 4px;
  background: linear-gradient(90deg, #001f3f, #f6d1d1);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}
.servizio:hover::before, .riquadro:hover::before { transform: scaleX(1); }
.servizio:hover, .riquadro:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 40px rgba(0,0,0,0.15);
  border-color: #001f3f;
}

/* ========================================================================== */
/* Sezione Chi Sono                                                           */
/* ========================================================================== */
.chi-sono-content {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  align-items: start;
}
.chi-sono-text {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
}
.chi-sono-image {
  position: sticky;
  top: 100px;
}
.chi-sono-image img {
  width: 100%; height: auto;
  border-radius: 20px;
  box-shadow: 0 15px 40px rgba(0,0,0,0.15);
  transition: transform 0.3s ease;
}
.chi-sono-image img:hover { transform: scale(1.05); }

/* ========================================================================== */
/* Offerte di Lavoro                                                          */
/* ========================================================================== */
.annuncio-lavoro {
  padding: 35px;
  background: #ffffff;
  border: 2px solid #f6d1d1;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
  margin-bottom: 30px;
  position: relative;
  /* animazione in entrata */
  opacity: 0; transform: translateY(50px);
}
.annuncio-lavoro.animate { opacity: 1; transform: translateY(0); }
.annuncio-lavoro:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}
.annuncio-lavoro h3 {
  color: #001f3f;
  border-bottom: 3px solid #f6d1d1;
  padding-bottom: 15px;
  margin-bottom: 20px;
}

/* Riga titolo annuncio con pulsante a destra, sempre in linea */
.job-title-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:nowrap;
}
.job-title-row .job-title{
  margin:0;
  flex:1 1 auto;
  min-width:0;
  white-space:normal; /* i titoli lunghi possono andare a capo */
}

/* Dettagli annuncio (pannello collassabile) */
.job-details[hidden] { display: none !important; }
.job-details {
  border-top: 2px dashed #f6d1d1;
  margin-top: 18px;
  padding-top: 18px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.job-details.open {
  opacity: 1;
  transform: translateY(0);
}

.sede {
  font-weight: 700;
  color: #001f3f;
  margin-top: 20px;
  padding: 10px;
  background: rgba(246, 209, 209, 0.3);
  border-radius: 8px;
  display: inline-block;
}

/* ========================================================================== */
/* Pulsanti                                                                   */
/* ========================================================================== */
.btn-candidati, .btn-submit {
  background: linear-gradient(135deg, #001f3f 0%, #003366 100%);
  color: #fff;
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.btn-candidati::before, .btn-submit::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}
.btn-candidati:hover::before, .btn-submit:hover::before { left: 100%; }
.btn-candidati:hover, .btn-submit:hover {
  background: linear-gradient(135deg, #003366 0%, #004080 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,31,63,0.3);
}

/* ========================================================================== */
/* Form                                                                       */
/* ========================================================================== */
.form-candidatura { max-width: 700px; margin: 0 auto; }

.form-candidatura-offerta[hidden] { display: none !important; }
.form-candidatura-offerta {
  margin-top: 25px;
  padding: 25px;
  background: #f9f9f9;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.form-group { margin-bottom: 22px; }
.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  color: #001f3f;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 14px;
  border: 2px solid #f6d1d1;
  border-radius: 10px;
  font-size: 16px;
  transition: all 0.25s ease;
  font-family: inherit;
  background: #fff;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #001f3f;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0,31,63,0.1);
  transform: translateY(-2px);
}

/* Checkbox privacy sulla stessa riga della label */
.form-consent label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.form-consent input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: #001f3f;
}

/* Messaggi */
.success-message[hidden],
.error-message[hidden] { display: none !important; }

.success-message {
  background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
  border: 1px solid #c3e6cb;
  color: #155724;
  padding: 16px;
  border-radius: 12px;
  margin: 16px 0;
}

.error-message {
  background: #fdecea;
  border: 1px solid #f5c2c0;
  color: #842029;
  padding: 14px 16px;
  border-radius: 12px;
  margin: 14px 0;
  font-weight: 600;
}

/* ========================================================================== */
/* Sezione Consulenza / Calendly                                              */
/* ========================================================================== */
.sezione-consulenza {
  background: linear-gradient(135deg, #f9f9f9 0%, #ffffff 100%);
  text-align: center;
  border-radius: 20px;
}
.calendly-wrapper .calendly-inline-widget {
  border-radius: 15px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

/* ========================================================================== */
/* Contatti                                                                   */
/* ========================================================================== */
.contatti-inline {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  flex-wrap: wrap;
  margin: 30px 0;
}
.contatti-inline p {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: rgba(246,209,209,0.3);
  border-radius: 25px;
  transition: all 0.3s ease;
}
.contatti-inline p:hover {
  background: rgba(246,209,209,0.5);
  transform: translateY(-2px);
}

/* ========================================================================== */
/* Footer                                                                     */
/* ========================================================================== */
footer {
  background: linear-gradient(135deg, #001f3f 0%, #003366 100%);
  color: #ffffff;
  text-align: center;
  padding: 40px 20px;
  font-size: 14px;
  margin-top: 60px;
}
footer a { color: #ffffff; }
footer a:hover { color: #f6d1d1; }

.footer-links { margin-top: 20px; }
.footer-links a {
  margin: 0 15px;
  text-decoration: underline;
  padding: 5px 10px;
  border-radius: 5px;
  transition: all 0.3s ease;
}
.footer-links a:hover {
  background: rgba(246, 209, 209, 0.2);
  text-decoration: none;
}

/* ========================================================================== */
/* Privacy Policy                                                             */
/* ========================================================================== */
.privacy-policy {
  background: #f8f9fa;
  padding: 40px 20px;
  margin: 40px auto;
  max-width: 800px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.08);
  line-height: 1.8;
}
.privacy-policy h2 {
  color: #001f3f;
  margin-bottom: 30px;
  text-align: center;
}
.privacy-policy h3 {
  color: #001f3f;
  margin-top: 30px;
  margin-bottom: 15px;
}
.privacy-policy p { margin-bottom: 15px; }
.privacy-policy ul { margin-left: 20px; margin-bottom: 15px; }

/* ========================================================================== */
/* Responsive                                                                 */
/* ========================================================================== */
@media (max-width: 900px) {
  .header {
    padding: 20px;
    text-align: center;
    flex-direction: column;
    gap: 14px;
  }
  .logo { order: 1; }
  .header-text { order: 2; margin: 0; }
  .header-image { order: 3; }
  .header-text h1 { font-size: 2.2rem; }
  .header-text .sottotitolo { font-size: 1.05rem; }

  .chi-sono-content {
    grid-template-columns: 1fr;
  }
  .chi-sono-image { position: static; }
  .chi-sono-image img { max-width: 360px; margin: 0 auto; display: block; }

  .form-row { grid-template-columns: 1fr; }
}

/* Mantieni in riga i pulsanti accanto ai titoli anche su schermi piccoli */
@media (max-width: 600px) {
  .section-header { flex-direction: row; align-items: center; }
  .section-header .btn-candidati { align-self: auto; }
}

/* ====== FIX MOBILE-ONLY ====== */
@media (max-width: 600px) {
  /* 1) "Chiedimi info" — sistema la label privacy */
  #info-form .form-group > label {
    display: flex;              /* gestisci checkbox + testo */
    align-items: flex-start;    /* allinea il testo all’inizio */
    gap: 8px;                   /* spazio tra checkbox e testo */
    line-height: 1.4;
    flex-wrap: wrap;            /* consenti a testo/link di andare a capo */
    white-space: normal;        /* evita che rimanga su una riga sola */
  }
  #info-form .form-group > label > input[type="checkbox"] {
    margin-top: 3px;            /* allinea visivamente alla prima riga di testo */
    flex: 0 0 auto;
  }
  #info-form .form-group > label a {
    word-break: break-word;     /* se il link è lungo, vai a capo senza sformattare */
  }

  /* 2) "Offerte di Lavoro" — mostra tutto il titolo e tieni il bottone a destra */
  #offerte-lavoro .section-header {
    align-items: flex-start;    /* bottone allineato in alto, titolo può andare su 2+ righe */
  }
  #offerte-lavoro .section-header h2 {
    white-space: normal;        /* permetti al titolo di andare a capo */
    overflow: visible;          /* niente ellissi */
    text-overflow: clip;
    line-height: 1.25;
    min-width: 0;               /* evita spinta anomala del bottone */
  }
  #offerte-lavoro .section-header .btn-candidati {
    font-size: 14px;            /* bottone più compatto su mobile */
    padding: 8px 12px;
    flex: 0 0 auto;             /* non comprimere il bottone */
    white-space: nowrap;        /* bottone sempre su una sola riga */
    margin-left: 8px;           /* piccolo distacco dal titolo */
  }

  /* 3) "Candidatura Spontanea" — stesso comportamento del punto 2 */
  #candidatura-spontanea .section-header {
    align-items: flex-start;
  }
  #candidatura-spontanea .section-header h2 {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.25;
    min-width: 0;
  }
  #candidatura-spontanea .section-header .btn-candidati {
    font-size: 14px;
    padding: 8px 12px;
    flex: 0 0 auto;
    white-space: nowrap;
    margin-left: 8px;
  }
}
