/* Stato attivo pulsanti categorie */
.mta-category-buttons button.active {
  background-color: #005b99;
}

@media (max-width: 992px) {
  .mta-product {
    width: calc(50% - 20px);
  }
}

@media (max-width: 600px) {
  .mta-product {
    width: 100%;
  }
}

/* HEADER / STRUTTURA BASE */
.site-header {
  position: relative;
  background-color: rgba(0, 116, 194, 0.9);
  color: white;
  text-align: center;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.header-left {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
}

/* SFONDO GENERALE SITO */
body {
  font-family: 'Roboto', sans-serif;
  margin: 0;
  min-height: 100vh; /* copre sempre tutta l'altezza */
  background: url('img/sfondo_officina_pulito.png') center center / cover no-repeat;
  background-attachment: fixed;
}

header {
  background-color: rgba(0, 116, 194, 0.9);
  color: white;
  text-align: center;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

header img {
  height: 25px;
}

h1 {
  font-size: 1.8rem;
  text-transform: uppercase;
}

/* CONTENITORE PRINCIPALE (pannello semitrasparente) */
.mta-container {
  max-width: 1200px;
  padding-bottom: 2rem;
  margin: auto;
  background: rgba(255, 255, 255, 0.95); /* semitrasparente */
  padding: 2rem;
  border-radius: 10px;
}

.top-bar {
  text-align: right;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* PULSANTI CATEGORIE DESKTOP */
.mta-category-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.mta-category-buttons button {
  background-color: #005b99;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  line-height: 1.2;
  text-align: center;
  min-height: 50px;
}

/* GRID PRODOTTI */
.mta-product-grid {
  display: none;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  padding-left: 20px;
  padding-right: 20px;
}

.mta-product {
  background: white;
  width: calc(33.333% - 20px);
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  text-align: center;
  padding: 15px;
}

.mta-product img {
  max-height: 100px;
  margin-bottom: 10px;
  transition: transform 0.3s ease;
}

.mta-product img:hover {
  transform: scale(2);
  z-index: 10;
}

.mta-btn-group {
  margin-top: 10px;
}

.mta-btn-group a {
  background-color: #005b99;
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  margin: 0 4px;
  text-decoration: none;
  font-size: 0.8rem;
}

#popupClose {
  position: absolute;
  top: -20px;
  right: 80px;
  background: white;
  color: black;
  font-weight: bold;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 5px 5px rgba(0,0,0,0.5);
}

.top-bar a:hover img {
  filter: brightness(0) saturate(100%) invert(19%) sepia(91%) saturate(6365%) hue-rotate(359deg) brightness(97%) contrast(119%);
}

.mta-category-buttons button:focus,
.mta-btn-group a:focus {
  outline: 2px solid #005b99;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(0,116,194,0.3);
}

.mta-category-buttons button:hover,
.mta-category-buttons button:active {
  background-color: #005b99;
  transform: scale(1.02);
}

.mta-btn-group a:hover,
.mta-btn-group a:active {
  background-color: #005b99;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* HEADER RIGHT */
.header-right {
  text-align: right;
  font-size: 0.85rem;
  color: white;
  font-weight: bold;
  flex: 1;
  min-width: 250px;
}

/* SITE HEADER responsive */
.site-header {
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

@media (max-width: 768px) {
  .header-left, .header-right {
    flex: 100%;
    text-align: center;
    justify-content: center;
  }

  .header-right {
    margin-top: 10px;
  }
}

/* CARD MODERNE */
.mta-product {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: fadeUp 0.6s ease;
}

.mta-product::after {
  content: '';
  display: block;
  height: 4px;
  background-color: #005b99;
  margin-top: 10px;
  border-radius: 0 0 6px 6px;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive migliorato per mobile (generale) */
@media (max-width: 768px) {
  .mta-product h3 {
    font-size: 1.1rem;
  }

  .mta-product p,
  .mta-product-grid p {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  .mta-product {
    width: 100% !important;
    margin-bottom: 1rem;
  }

  .mta-product-grid {
    padding: 0 10px;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  h3 {
    font-size: 1.1rem;
  }
}

/* Barra categorie sticky */
.mta-category-buttons {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.98);
  z-index: 1000;
  padding-top: 1rem;
  padding-bottom: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
}

/* ANIMAZIONI POPUP IMMAGINE */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes zoomIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 5000;
  animation: fadeIn 0.3s ease;
  padding: 2rem;
  box-sizing: border-box;
}

.popup-overlay img {
  max-width: 100%;
  max-height: 100%;
  border: 8px solid white;
  border-radius: 20px;
  box-shadow: 0 0 30px rgba(0,0,0,0.7);
  animation: zoomIn 0.3s ease;
  object-fit: contain;
}

/* HOME / BLOCCO TESTO */
#testo {
  background: url('img/home_bg.jpg') no-repeat center center;
  background-size: cover;
  padding: 3rem;
  border-radius: 10px;
  position: relative;
  z-index: 1;
}

#testo .mta-product {
  background-color: rgba(255, 255, 255, 0.9);
}

/* KEYWORDS FISSE IN BASSO */
.keywords-fixed {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 10px 14px;
  border: 2px solid white;
  border-radius: 12px;
  pointer-events: none; /* non interferisce coi click/scroll */
}

.keyword-large {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 2.2rem;
  color: white;
  font-weight: 900;
  position: relative;
  transition: all 0.3s ease;
}

.keyword-large::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0%;
  height: 3px;
  background-color: white;
  transition: width 0.3s ease;
}

.keyword-large:hover {
  color: #ffd700;
  transform: scale(1.05);
}

.keyword-large:hover::after {
  width: 100%;
}

@keyframes slideFadeIn {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.site-header h1 {
  animation: slideFadeIn 0.8s ease-out forwards;
}

/* Specifico per pulsante RIPARAZIONI MANUTENZIONE */
.mta-category-buttons button:nth-child(7) {
  font-size: 0.9rem;
  line-height: 1.2;
}

/* --- Ottimizzazioni layout mobile (iOS / Android) --- */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }

  .mta-container {
    padding: 1.5rem 1rem 1.5rem; /* bottom ridotto */
  }

  .top-bar {
    text-align: left;
    font-size: 0.8rem;
  }

  .top-bar p {
    margin-bottom: 0.25rem;
  }

  .top-bar a {
    display: inline-block;
    margin-bottom: 0.25rem;
  }

  .header-left img {
    height: 50px;
  }

  .site-header {
    padding: 1rem;
  }

  h1 {
    font-size: 1.4rem;
  }

  .mta-product-grid {
    padding: 0 4px;
  }
}

@media (max-width: 480px) {
  .header-right {
    font-size: 0.75rem;
  }

  .keyword-large {
    font-size: 1.4rem;
    text-align: center;
  }
}

/* --- Rifiniture extra per smartphone (iOS / Android) --- */
@media (max-width: 768px) {
  /* Contenitore leggermente più compatto sui lati */
  .mta-container {
    padding: 1.5rem 1rem 1.5rem;
  }

  /* HOME (CHI SIAMO) meno "larga" sul telefono */
  #testo {
    padding: 1.5rem;
  }

  /* Scritta AFFIDABILITÀ un po' più compatta e bassa */
  .keywords-fixed {
    bottom: 0;
    padding: 8px 12px;
  }

  .keyword-large {
    font-size: 1.4rem;
  }

  /* Barra contatti in alto più leggibile su mobile */
  .top-bar {
    text-align: center;
    font-size: 0.8rem;
  }

  .top-bar a {
    display: inline-block;
    margin-bottom: 4px;
  }

  /* Pulsante chiusura popup in posizione più comoda sul telefono */
  #popupClose {
    top: 10px;
    right: 10px;
  }
}

@media (max-width: 480px) {
  .keywords-fixed {
    bottom: 0;
    padding: 8px 10px;
    border-width: 1px;
  }

  .keyword-large {
    font-size: 1.1rem;
  }
}

/* --- MENU CATEGORIE MOBILE: SCORRIMENTO ORIZZONTALE PULITO --- */
@media (max-width: 768px) {

  .mta-category-buttons {
    display: flex;
    flex-wrap: nowrap;          /* tutti su una sola riga */
    overflow-x: auto;           /* scroll orizzontale */
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding: 0;                 /* niente padding laterale */
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
  }

  .mta-category-buttons button {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 0.85rem;
    padding: 10px 14px;
    min-height: 44px;
  }

  .mta-category-buttons::-webkit-scrollbar {
    height: 4px;
  }
}

/* --- Forza comportamento sfondo anche su mobile iPhone / Android --- */
@media (max-width: 768px) {
  body {
    background-attachment: scroll !important;
  }
}

/* ===========================
   LAYOUT TABLET (iPad / Tablet)
   769px – 1024px
   =========================== */
@media (min-width: 769px) and (max-width: 1024px) {

  /* Contenitore un po' più largo ma sempre centrato */
  .mta-container {
    max-width: 1000px;
    padding: 2rem 1.5rem 2.5rem;
  }

  /* Header leggermente più compatto, ma non “mobile” completo */
  .site-header {
    padding: 1.25rem 1.5rem;
  }

  .header-left img {
    height: 60px;
  }

  h1 {
    font-size: 1.6rem;
  }

  /* Top bar più leggibile */
  .top-bar {
    font-size: 0.85rem;
    text-align: right;
  }

  /* Categorie: nessuno scroll orizzontale, vanno a capo se serve */
  .mta-category-buttons {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.98);
    z-index: 1000;
    padding: 0.75rem 0 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    overflow-x: visible;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  }

  .mta-category-buttons button {
    flex: 0 1 auto;
    white-space: normal;      /* il testo può andare a capo */
    font-size: 0.9rem;
    padding: 10px 18px;
    min-height: 48px;
  }

  /* Prodotti: due per riga (già gestito da max-width:992, ma ribadiamo) */
  .mta-product {
    width: calc(50% - 20px);
  }

  .mta-product-grid {
    padding: 0 16px;
  }

  /* Keyword in basso leggermente ridotta */
  .keywords-fixed {
    bottom: 15px;
    padding: 10px 16px;
  }

  .keyword-large {
    font-size: 1.6rem;
  }
}


/* --- Language switcher --- */
.lang-switch{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.lang-switch select{
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.25);
  background: white;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 768px){
  .lang-switch{
    width: 100%;
    justify-content: center;
  }
}


/* =======================
   SPLASH SCREEN
   ======================= */
.splash{
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.9s ease;
}

.splash.hide{
  opacity: 0;
}

.splash-bg{
  position: absolute;
  inset: 0;
  background: url("img/copertina.png") center center / cover no-repeat;
}

.splash::after{
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.25);
}

.splash-logo{
  position: relative;
  width: min(420px, 90vw);   /* LOGO PIÙ GRANDE */
  opacity: 0.45;            /* PIÙ TRASPARENTE */
  z-index: 1;
}

.site-content{
  visibility: hidden;
}

.site-content.show{
  visibility: visible;
}
