/* =========================
   Pala assemblaggi - style.css
   Theme: Blu Tech
   ========================= */

/* Reset base */
* { box-sizing: border-box; }

:root{
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --text: #111827;
  --muted: #475569;
  --border: #E2E8F0;

  --primary: #0A58CA;
  --primary-dark: #084298;
  --accent: #38BDF8;

  --hero-1: #EEF2FF;
  --hero-2: #F8FAFC;
}

body{
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

img{
  max-width: 100%;
  display: block;
}

/* Layout */
.container{
  width: min(1100px, 92%);
  margin: 0 auto;
}

/* Header */
header{
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}

.header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
}

.logo{
  font-weight: 800;
  text-decoration: none;
  color: var(--primary);
}

nav a{
  text-decoration: none;
  color: var(--text);
  margin-left: 14px;
  font-weight: 600;
}

nav a:hover{
  color: var(--primary);
}

/* Hero */
.hero{
  padding: 80px 0;
  background: linear-gradient(135deg, var(--hero-1) 0%, var(--hero-2) 60%);
}

.hero h1{
  font-size: 42px;
  margin: 0 0 10px;
}

.hero p{
  max-width: 700px;
  margin: 0 0 18px;
  color: var(--muted);
}

/* Sections */
.section{ padding: 56px 0; }
.section.alt{ background: #F1F5F9; } /* leggero grigio/azzurro */

h1, h2{ color: var(--text); }
.section h2{ color: var(--primary); }

/* Grid */
.grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

/* Cards */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover{
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(0,0,0,0.08);
}

.card h3{ margin: 6px 0 0; }
.card p{ margin: 0; color: var(--muted); font-size: 14px; }

/* Images inside cards (Portfolio) */
.card img{
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 12px;
}

/* Buttons */
.btn{
  display: inline-block;
  padding: 10px 14px;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(10, 88, 202, 0.25);
  transition: transform 0.2s ease, background 0.2s ease;
}

.btn:hover{
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn.ghost{
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: none;
}

.btn.ghost:hover{
  background: rgba(10, 88, 202, 0.08);
  transform: translateY(-1px);
}

/* Form */
.form{
  display: grid;
  gap: 12px;
  max-width: 560px;
  margin-top: 14px;
}

label{
  display: grid;
  gap: 6px;
  font-weight: 600;
}

input, select, textarea{
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font: inherit;
  background: var(--surface);
}

input:focus, select:focus, textarea:focus{
  outline: none;
  border-color: rgba(10, 88, 202, 0.55);
  box-shadow: 0 0 0 3px rgba(10, 88, 202, 0.12);
}

.note{
  color: var(--muted);
  font-size: 14px;
}

/* Contacts + footer */
.contacts{ padding-left: 18px; }

footer{
  border-top: 1px solid var(--border);
  padding: 18px 0;
}

/* Links */
a{ color: var(--primary); }
a:hover{ color: var(--primary-dark); }

/* Portfolio link cards */
.card-link{
  text-decoration: none;
  color: inherit;
}

/* Portfolio hover (stronger than default card hover) */

.portfolio-grid .card{
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
}

.portfolio-grid .card:hover{
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(0,0,0,0.15);
}

.portfolio-grid .card img{
  transition: transform 0.4s ease;
}

.portfolio-grid .card:hover img{
  transform: scale(1.08);
}

.portfolio-grid .card:hover h3{
  color: var(--accent);
}

/* Build pages */
.detail-grid{
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
  margin-top: 14px;
}

@media (max-width: 900px){
  .detail-grid{ grid-template-columns: 1fr; }
}

/* Mobile */
@media (max-width: 800px){
  nav a{ margin-left: 10px; }
  .hero h1{ font-size: 34px; }
}

/* Animazione campo "Altro" nel form */
#usoAltroBox{
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transform: translateY(-8px);
  transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.3s ease;
}

#usoAltroBox.show{
  opacity: 1;
  max-height: 120px;
  transform: translateY(0);
}

/* ===== Dark mode manuale (solo se selezionata) ===== */
body.dark {
  --bg: #0B1220;
  --surface: #0F172A;
  --text: #E5E7EB;
  --muted: #A1A1AA;
  --border: #1F2A44;

  --primary: #38BDF8;
  --primary-dark: #0EA5E9;
  --accent: #60A5FA;

  --hero-1: #0F172A;
  --hero-2: #0B1220;
}

/* Piccoli aggiustamenti per dark */
body.dark .section.alt { background: #0D1628; }

body.dark .card:hover {
  box-shadow: 0 14px 30px rgba(0,0,0,0.35);
}

body.dark header {
  backdrop-filter: blur(8px);
}

/* Bottone toggle (se lo metti nel nav) */
.theme-toggle {
  margin-left: 14px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}
.theme-toggle:hover {
  border-color: rgba(56, 189, 248, 0.45);
}

/* ===== STELLE RECENSIONI ===== */
.stars {
  display: flex;
  gap: 4px;
  font-size: 20px;
  color: #fbbf24; /* oro */
  line-height: 1;
}

.dark .stars {
  color: #fde68a;
}

/* Card recensioni */
.review-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ===== Fix MENU mobile: più spazio e più leggibilità ===== */
@media (max-width: 800px) {

  .header{
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
  }

  nav{
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px 12px;          /* spazio tra righe e colonne */
    line-height: 1.3;
  }

  nav a{
    margin-left: 0;          /* elimina il margine desktop */
    padding: 8px 10px;       /* aumenta area cliccabile */
    border-radius: 12px;
    background: rgba(255,255,255,0.06); /* leggero “pill” in dark */
  }

  body:not(.dark) nav a{
    background: rgba(10,88,202,0.06);  /* pill chiaro in light */
  }

  .theme-toggle{
    margin-left: 0;
    padding: 8px 10px;
  }
}

/* ===== Fix MENU mobile: più spazio e più leggibilità ===== */
@media (max-width: 800px) {

  .header{
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
  }

  nav{
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px 12px;          /* spazio tra righe e colonne */
    line-height: 1.3;
  }

  nav a{
    margin-left: 0;          /* elimina il margine desktop */
    padding: 8px 10px;       /* aumenta area cliccabile */
    border-radius: 12px;
    background: rgba(255,255,255,0.06); /* leggero “pill” in dark */
  }

  body:not(.dark) nav a{
    background: rgba(10,88,202,0.06);  /* pill chiaro in light */
  }

  .theme-toggle{
    margin-left: 0;
    padding: 8px 10px;
  }
}

/* ===== Spazio corretto tra i bottoni HERO (mobile) ===== */
.cta {
  display: flex;
  gap: 14px;           /* spazio tra i bottoni */
  flex-wrap: wrap;    /* va a capo se serve */
}

@media (max-width: 800px) {
  .cta {
    gap: 18px;        /* più spazio su mobile */
  }

  .cta .btn {
    width: 100%;      /* bottoni uno sotto l’altro */
    text-align: center;
  }
}

.cta .btn:first-child {
  padding: 14px;
  font-size: 16px;
}

/* ===== WhatsApp Floating Button ===== */
.whatsapp-float {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 56px;
  height: 56px;
  background: #25D366;
  color: white;
  font-size: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(0,0,0,0.25);
  z-index: 999;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.whatsapp-float:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 36px rgba(0,0,0,0.35);
}

/* Dark mode */
.dark .whatsapp-float {
  box-shadow: 0 12px 28px rgba(0,0,0,0.6);
}

/* Mobile leggermente più grande */
@media (max-width: 800px) {
  .whatsapp-float {
    width: 62px;
    height: 62px;
    font-size: 30px;
  }
}

/* ===== Cookie Banner ===== */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  z-index: 999;
}

.cookie-banner p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.cookie-banner a {
  text-decoration: underline;
}

.cookie-banner button {
  white-space: nowrap;
}

.dark .cookie-banner {
  background: #0f172a;
}

/* ===== COOKIE BANNER ===== */
.cookie-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 720px;
  width: calc(100% - 32px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  z-index: 9999;
}

.cookie-content {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.cookie-content p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.cookie-content a {
  color: var(--primary);
  text-decoration: underline;
}

.cookie-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.cookie-banner.hidden {
  display: none;
}

/* Dark mode */
body.dark .cookie-banner {
  background: #0f172a;
  border-color: #1e293b;
}

body.dark .cookie-content p {
  color: #cbd5f5;
}

/* ===== FORM: mobile spacing + leggibilità ===== */
.form {
  gap: 14px;
}

.form label {
  gap: 8px;
  line-height: 1.35;
}

input, select, textarea {
  width: 100%;
  min-height: 44px;            /* comodo per touch */
  padding: 12px 14px;
}

textarea {
  min-height: 120px;
}

/* Bottone e note */
.form .btn {
  width: 100%;
  padding: 12px 16px;
}

.note {
  margin-top: 6px;
  line-height: 1.45;
}

/* Campo "Altro" ben distanziato e animazione */
#usoAltroBox {
  margin-top: 6px;
}

/* CTA: bottoni non attaccati (mobile) */
.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

@media (max-width: 520px) {
  .cta a.btn {
    width: 100%;
    text-align: center;
  }
}

/* ===== HEADER MOBILE FIX ===== */
@media (max-width: 768px) {
  header {
    padding-bottom: 10px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
  }

  nav a,
  .theme-toggle {
    display: block;
    width: 100%;
    text-align: center;
    padding: 8px 10px;
    font-size: 14px;
    border-radius: 12px;
    background: rgba(0,0,0,0.04);
  }

  body.dark nav a,
  body.dark .theme-toggle {
    background: rgba(255,255,255,0.08);
  }
}

/* ===== ACCESSIBILITY ===== */
.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;
}

/* ===== NAV BASE ===== */
.nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-menu a {
  text-decoration: none;
  font-weight: 600;
}

/* Desktop: menu in linea */
@media (min-width: 769px) {
  .nav-toggle { display: none; }
  .nav-menu {
    display: flex;
    align-items: center;
    gap: 14px;
  }
}

/* Mobile: hamburger + menu a tendina */
@media (max-width: 768px) {
  .header {
    align-items: center;
  }

  .nav {
    margin-left: auto;
  }

  .nav-toggle {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border, #e2e8f0);
    background: var(--surface, #fff);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
  }

  .nav-toggle__bar {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text, #111827);
    border-radius: 2px;
  }

  .nav-menu {
    position: absolute;
    top: 64px;               /* sotto header */
    right: 16px;
    left: 16px;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 16px;
    padding: 12px;
    display: none;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.12);
    z-index: 9999;
  }

  .nav-menu.is-open {
    display: flex;
  }

  .nav-menu a,
  .nav-menu .theme-toggle {
    width: 100%;
    text-align: center;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(0,0,0,0.04);
    color: var(--text, #111827);
    border: 1px solid transparent;
  }

  body.dark .nav-menu a,
  body.dark .nav-menu .theme-toggle {
    background: rgba(255,255,255,0.08);
  }
}
