/* Global custom styles for sections under hero images */

/* Global page behavior rules moved from base.html */
html, body, .main-content {
  overscroll-behavior-y: none;
}

body {
  /* Suggest to touch browsers to allow only upward panning */
  touch-action: pan-up;
  background-color: #132833; /* Avoid white flash on bounce */
}

/* Hero background styles for policy pages */
.hero-privacy-policy {
  background-image: url('/static/img/privacy-policy/privacy-policy.jpg');
  background-size: auto;
  background-position: center;
}

.hero-contacts {
  position: relative;
  height: 24rem; /* h-96 */
  margin-top: 70px; /* mt-[70px] */
  background-image: url('/static/img/contatti/contatti.jpg');
  background-size: auto;
  background-position: center;
  background-repeat: no-repeat;
}

.hero-contacts .hero-overlay {
  position: absolute;
  inset: 0; /* absolute inset-0 */
  background-color: #32AEB8;
  opacity: 0.3; /* bg-opacity-30 */
}

.hero-contacts .hero-inner {
  position: relative;
  z-index: 10;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* Slogan home page with Montserrat font */
.slogan-home {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Responsive slogan sizing - completamente fluido */
.slogan-responsive {
  font-size: clamp(1.2rem, calc(1.2rem + 2.8vw), 3.5rem);
  line-height: 1.2;
}

.slogan-responsive-large {
  font-size: clamp(1.8rem, calc(1.8rem + 3.2vw), 4.5rem);
  line-height: 1.1;
}

/* Typography for text blocks under hero */
.testo-principale {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  letter-spacing: 0.005em;
  text-align: justify;
}

/* Dimensioni tipografiche predefinite per il blocco e i paragrafi al suo interno */
.testo-principale,
.testo-principale p {
  font-size: 1rem; /* ~16px */
  line-height: 1.625rem; /* ~26px */
  text-align: justify;
}

@media (min-width: 768px) {
  .testo-principale,
  .testo-principale p {
    font-size: 1.125rem; /* ~18px */
    line-height: 1.75rem; /* ~28px */
  }
}

/* Titolo verde standard per sezioni (ispirato a Assessment: "UNA VISIONE CHIARA, PER STRATEGIE EFFICACI!") */
.titolo-verde {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #32AEB8;
  font-weight: 700; /* font-bold */
  font-size: 1.625rem; /* ~26px, leggero aumento */
  line-height: 2.125rem; /* ~34px */
  margin-bottom: 1.5rem; /* mb-6 */
  text-transform: uppercase; /* brand rule: titoli maiuscoli */
  text-align: center;
}

@media (min-width: 768px) {
  .titolo-verde {
    font-size: 2rem; /* ~32px, leggero aumento */
    line-height: 2.375rem; /* ~38px */
  }
}

/* Sottotitolo verde standard (ispirato a Assessment: "Check-up strategico della tua infrastruttura IT") */
.sottotitolo-verde {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #32AEB8;
  font-weight: 700; /* font-bold */
  font-size: 1.25rem; /* text-xl ~20px */
  line-height: 1.75rem; /* ~28px */
  text-align: center; /* come nel template */
  margin-bottom: 1rem; /* mb-4 */
}

/* Titolo scuro standard per sezioni (ispirato a Azienda: "PUNTI DI FORZA") */
.titolo-scuro {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #132833; /* blu molto scuro */
  font-weight: 800; /* font-extrabold */
  font-size: 1.625rem; /* ~26px, allineato a titolo-verde */
  line-height: 2.125rem; /* ~34px */
  text-align: center; /* centrato come richiesto */
  margin-bottom: 2rem; /* mb-8 */
}

@media (min-width: 768px) {
  .titolo-scuro {
    font-size: 2rem; /* ~32px, allineato a titolo-verde */
    line-height: 2.375rem; /* ~38px */
  }
}

/* Titolo chiaro (bianco) per sezioni su sfondo scuro
   Ispirato a enterprise-it-ot: "LA SCELTA DI AFFIDARSI A SERVIZI OT GESTITI..."
   Stesse dimensioni di titolo-verde/titolo-scuro per coerenza */
.titolo-chiaro {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #FFFFFF; /* testo bianco su sfondo scuro */
  font-weight: 700; /* font-bold per allineare la percezione di grandezza */
  font-size: 1.625rem; /* ~26px */
  line-height: 2.125rem; /* ~34px */
  text-align: center;
  margin-bottom: 2rem; /* mb-8 di default; sovrascrivibile nel template (es. mb-12) */
}

@media (min-width: 768px) {
  .titolo-chiaro {
    font-size: 2rem; /* ~32px */
    line-height: 2.375rem; /* ~38px */
  }
}

/* Sezione scura standard (sfondo blu scuro aziendale)
   - Background: #22394A
   - Padding verticale: py-8 mobile, py-12 su md+
   - Font: Montserrat
   - Testo: bianco di default (sovrascrivibile dagli elementi interni)
*/
.sezione-scura {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #22394A;
  color: #FFFFFF;
  padding-top: 2rem;   /* py-8 */
  padding-bottom: 2rem;/* py-8 */
}

@media (min-width: 768px) {
  .sezione-scura {
    padding-top: 3rem;    /* py-12 */
    padding-bottom: 3rem; /* py-12 */
  }
}

/* Sezione chiara standard (sfondo bianco)
   - Background: #FFFFFF
   - Padding verticale: py-8 mobile, py-12 su md+
   - Font: Montserrat
   - Testo: blu molto scuro per default (#132833), sovrascrivibile nei figli
*/
.sezione-chiara {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #FFFFFF;
  color: #132833;
  padding-top: 2rem;   /* py-8 */
  padding-bottom: 2rem;/* py-8 */
}

@media (min-width: 768px) {
  .sezione-chiara {
    padding-top: 3rem;    /* py-12 */
    padding-bottom: 3rem; /* py-12 */
  }
}

/* Box verdi (riutilizzabili per le card servizi) */
.box-verdi {
  background-color: #32AEB8; /* stesso verde brand */
  border-radius: 0.75rem; /* ~12px, leggero bordo smussato */
}

.box-verdi .cta-pill {
  border-radius: 9999px; /* pill per CTA, se usata */
}

/* Titolo sovrapposto a immagine (hero titles)
   - Font: Montserrat
   - Colore: bianco
   - Peso: extra-bold
   - Dimensioni: text-4xl (base), md:text-5xl
   - Stile: tutto MAIUSCOLO, centrato, con leggero text-shadow per leggibilità
*/
.titolo-immagine {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #FFFFFF;
  font-weight: 800; /* extra-bold */
  font-size: 2.5rem; /* ~40px, leggermente più grande di text-4xl */
  line-height: 3rem; /* ~48px */
  text-transform: uppercase;
  text-align: center;
  /* Ombra più netta per maggiore leggibilità su immagini */
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.6);
}

@media (min-width: 768px) {
  .titolo-immagine {
    font-size: 3.25rem; /* ~52px, leggermente più grande di text-5xl */
    line-height: 3.75rem; /* ~60px */
  }
}

/* Tipografia e CTA per i box verdi (servizi) */
.titolo-box-verde {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #ffffff;
  font-weight: 700; /* bold */
  text-transform: uppercase;
  text-align: center;
  font-size: 1.25rem; /* ~20px */
  line-height: 1.75rem; /* ~28px */
  margin-bottom: 0.5rem; /* simile a mb-2 */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); /* leggera ombra per leggibilità */
}

@media (min-width: 768px) {
  .titolo-box-verde {
    font-size: 1.25rem; /* resta coerente con le card esistenti */
    line-height: 1.75rem;
  }
}

.testo-box-verde {
  color: #ffffff;
  text-align: center;
}

.pulsante-box-verde {
  display: inline-block;
  border: 1px solid #ffffff;
  border-radius: 9999px; /* pill */
  padding: 0.5rem 1.25rem; /* ~py-2 px-5 */
  color: #ffffff;
  font-weight: 600; /* semibold */
  transition: all 150ms ease-in-out;
  cursor: pointer;
}

.pulsante-box-verde:hover {
  background-color: #ffffff;
  color: #32AEB8; /* inverti colore come nelle card */
}

/* Hero Azienda: immagine di sfondo e overlay gestiti via CSS */
.hero-azienda {
  position: relative;
  height: 24rem; /* h-96 */
  margin-top: 70px; /* mt-[70px] */
  display: flex;
  align-items: center;
  justify-content: center;
  /* Background image provided per-page via CSS variable --hero-bg */
  background-image: var(--hero-bg);
  background-size: auto; /* mantiene dimensioni originali */
  background-position: top; /* bg-top */
  background-repeat: no-repeat;
}

.hero-azienda .hero-overlay {
  position: absolute;
  inset: 0; /* absolute inset-0 */
  background-color: #32AEB8;
  opacity: 0.2; /* bg-opacity-30 */
}

.hero-azienda .hero-inner {
  position: relative;
  z-index: 10;
  text-align: center;
}

/* Elenco puntato riutilizzabile (ispirato ai punti con icona in assessment.html)
   Struttura HTML raccomandata:
   <div class="elenco-puntato">
     <div class="elenco-item">
       <div class="elenco-icona">[svg]</div>
       <div class="elenco-testo">Testo punto</div>
     </div>
   </div>
*/
.elenco-puntato {
  /* Consente override del colore icona per contesto */
  --elenco-icon-bg: #32AEB8;
  display: grid;
  row-gap: 1rem; /* space-y-4 */
  text-align: left;
}

.elenco-puntato .elenco-item {
  display: flex;
  align-items: flex-start;
  column-gap: 1rem; /* gap-4 */
}

.elenco-puntato .elenco-icona {
  flex-shrink: 0;
  background-color: var(--elenco-icon-bg);
  border-radius: 9999px; /* rounded-full */
  padding: 0.25rem; /* p-1 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.elenco-puntato .elenco-icona svg {
  width: 1rem; /* h-4 */
  height: 1rem; /* w-4 */
  color: #FFFFFF; /* icona bianca */
}

.elenco-puntato .elenco-testo {
  font-size: 15px; /* text-[15px] coerente con assessment */
  line-height: 1.5rem; /* ~24px */
  text-align: left;
}

/* Variante dimensionale più grande */
.elenco-puntato.elenco-puntato--lg .elenco-icona {
  padding: 0.5rem; /* p-2 */
}

.elenco-puntato.elenco-puntato--lg .elenco-icona svg {
  width: 1.25rem; /* ~20px */
  height: 1.25rem;
}

/* News Layout - Tailwind Enhancement Only */

#news-cards > div {
  /* Enhanced hover effect */
  transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

#news-cards > div:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
}

/* Admin Forms - Inline form display */
.inline-form {
  display: inline;
}

/* News Hero Background */
.news-hero-bg {
  background-image: url('/static/img/news/it-news.jpg');
}

/* Admin Hero Background */
.admin-hero-bg {
  --hero-bg: url('/static/img/azienda/azienda-hero.jpg');
}

/* Company Hero Background */
.company-hero-bg {
  --hero-bg: url('/static/img/azienda/team.jpg');
}

/* Enterprise IT Hero Background */
.enterprise-it-hero-bg {
  background-image: url('/static/img/servizi/enterprise-it.jpg');
  background-size: auto;
  background-position: center 20%;
}

/* Enterprise IT/OT Hero Background */
.enterprise-it-ot-hero-bg {
  background-image: url('/static/img/servizi/enterprise-it-ot.jpg');
  background-size: auto;
}

/* Text Shadow for Hero Titles */
.hero-text-shadow {
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* Security Hero Background */
.security-hero-bg {
  --hero-bg: url('/static/img/soluzioni/cybersecurity.jpg');
}

/* News Detail Hero Background */
.news-detail-hero-bg {
  --hero-bg: url('/static/img/news/it-news.jpg');
}

/* Physical Security Management Hero Background */
.physical-security-hero-bg {
  background-image: url('/static/img/soluzioni/security.jpg');
  background-size: auto;
}

/* Scroll Anchor Positioning */
.scroll-anchor {
  padding-top: 80px;
  margin-top: -80px;
}

/* Consulenza Hero Background */
.consulenza-hero-bg {
  background-image: url('/static/img/servizi/consulenza.jpg');
  background-size: auto;
}

/* Workplace Management Hero Background */
.workplace-hero-bg {
  background-image: url('/static/img/servizi/workplace.jpg');
  background-size: auto;
}

/* Grid Width Utility */
.grid-width-66 {
  width: 66.666667%;
}

/* Footer Styles */
footer {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

footer * {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Cookie Consent Banner */
.cookie-consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: rgba(19, 40, 51, 0.98); /* brand dark */
  color: #ffffff;
  padding: 1.1rem 1.5rem;
  padding-left: calc(1.5rem + env(safe-area-inset-left));
  padding-right: calc(1.5rem + env(safe-area-inset-right));
  padding-bottom: calc(1.1rem + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.25);
  transform: translateY(100%);
  opacity: 0;
  transition: transform 250ms ease, opacity 250ms ease;
  box-sizing: border-box;
}

.cookie-consent-banner.visible {
  transform: translateY(0);
  opacity: 1;
}

.cookie-consent-content {
  max-width: 1800px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column; /* text on top, buttons below */
  gap: 0.9rem;
  align-items: center; /* center content */
}

/* Keep vertical layout also on larger screens */
@media (min-width: 640px) {
  .cookie-consent-content {
    flex-direction: column;
    align-items: center; /* keep centered on larger screens */
    justify-content: flex-start;
  }
}

.cookie-consent-content p {
  margin: 0;
  line-height: 1.4;
  flex: 1 1 auto;
  text-align: center; /* center text */
}

.cookie-consent-buttons {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  flex-wrap: nowrap; /* keep in a single row */
  white-space: nowrap; /* avoid button wrapping */
  overflow-x: auto; /* allow scroll if extremely tight */
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px; /* avoid scrollbar overlap on iOS */
  flex: 0 1 auto; /* allow scroll instead of clipping */
  scrollbar-gutter: stable both-edges; /* reserve space for scrollbar */
  padding-right: calc(env(safe-area-inset-right) + 6px);
  justify-content: center; /* center buttons */
}

/* On very small screens, make buttons slightly more compact while staying on one line */
@media (max-width: 420px) {
  .cookie-consent-buttons .cookie-info-btn,
  .cookie-consent-buttons .cookie-accept-btn,
  .cookie-consent-buttons .cookie-reject-btn {
    padding: 0.38rem 0.68rem;
    font-size: 0.88rem;
  }
  .cookie-consent-buttons { gap: 0.6rem; }
}

.cookie-info-btn,
.cookie-accept-btn,
.cookie-reject-btn {
  display: inline-block;
  padding: 0.42rem 0.85rem;
  font-weight: 600;
  border-radius: 9999px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  flex: 0 0 auto; /* keep buttons on one row */
}

.cookie-info-btn {
  color: #32AEB8; /* brand verde */
  border-color: #32AEB8;
  background: transparent;
}

.cookie-accept-btn {
  background: #32AEB8;
  color: #0b1b25;
}

.cookie-reject-btn {
  background: transparent;
  color: #ffffff;
  border-color: #ffffff;
}

.cookie-info-btn:hover {
  background: rgba(50, 174, 184, 0.12);
}

.cookie-accept-btn:hover {
  filter: brightness(1.05);
}

.cookie-reject-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
