/* CleanyHost — design system */
:root {
  --color-primary: #0a7c66;
  --color-primary-dark: #065a4a;
  --color-primary-light: #e6f4f0;
  --color-accent: #f59e0b;
  --color-accent-light: #fef3c7;
  --color-bg: #fafaf7;
  --color-card: #ffffff;
  --color-border: #e5e7eb;
  --color-text: #1a1a1a;
  --color-text-muted: #6b7280;
  --color-text-light: #9ca3af;
  --color-success: #059669;
  --color-danger: #dc2626;
  --color-warning: #d97706;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

html { -webkit-text-size-adjust: 100%; }
/* Mobile viewport height fix per iOS (evita salti con tastiera) */
body { min-height: 100vh; min-height: 100dvh; }

/* Riserva spazio per bottom-nav su mobile quando presente */
body.has-bottom-nav main { padding-bottom: 80px; }
@media (min-width: 768px) {
  body.has-bottom-nav main { padding-bottom: 0; }
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

button { font-family: inherit; cursor: pointer; }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;       /* touch target ≥44px */
  min-height: 44px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.25;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-secondary { background: white; color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { border-color: var(--color-text-muted); }
.btn-accent { background: var(--color-accent); color: white; }
.btn-accent:hover { background: #d97706; }
.btn-ghost { background: transparent; color: var(--color-text); }
.btn-ghost:hover { background: var(--color-bg); }
.btn-danger { background: var(--color-danger); color: white; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }
.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- FORM ---------- */
.form-group { display: flex; flex-direction: column; gap: 0.375rem; margin-bottom: 1rem; }
.form-label { font-weight: 500; font-size: 0.9rem; color: var(--color-text); }
.form-help { font-size: 0.85rem; color: var(--color-text-muted); }
.form-input,
.form-textarea,
.form-select {
  padding: 0.75rem 0.875rem;
  min-height: 44px;                /* touch target mobile */
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 16px;                 /* evita zoom iOS su focus */
  font-family: inherit;
  background: white;
  color: var(--color-text);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
@media (min-width: 768px) {
  .form-input, .form-textarea, .form-select { font-size: 0.95rem; }
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgb(10 124 102 / 0.1);
}
.form-textarea { min-height: 6rem; resize: vertical; }
.form-error {
  color: var(--color-danger);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* ---------- CARDS ---------- */
.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.card-hover { transition: box-shadow 0.15s, transform 0.15s; }
.card-hover:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* ---------- BADGES / PILLS ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25;
}
.badge-verified { background: var(--color-primary-light); color: var(--color-primary-dark); }
.badge-new { background: var(--color-accent-light); color: #92400e; }
.badge-muted { background: #f3f4f6; color: #4b5563; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* ---------- LAYOUT ---------- */
.container { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
.container-sm { max-width: 40rem; margin: 0 auto; padding: 0 1rem; }

.stack { display: flex; flex-direction: column; }
.stack-sm > * + * { margin-top: 0.5rem; }
.stack-md > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 1.5rem; }
.stack-xl > * + * { margin-top: 2rem; }

/* Responsive h1 per non uscire dal viewport mobile */
h1 { font-size: clamp(1.35rem, 5vw, 1.875rem); line-height: 1.2; word-break: break-word; }
h2 { font-size: clamp(1.1rem, 3.5vw, 1.5rem); line-height: 1.25; }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.flex-gap-sm { gap: 0.5rem; }
.flex-gap { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }

/* ---------- HEADER / NAV ---------- */
.site-header {
  background: white;
  border-bottom: 1px solid var(--color-border);
  padding: 0.875rem 0;
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
}
.site-header-inner { display: flex; align-items: center; justify-content: space-between; }
.site-logo {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--color-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.site-logo:hover { text-decoration: none; }
.site-nav { display: flex; gap: 0.5rem; align-items: center; }
.site-nav a {
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
}
.site-nav a:hover { background: var(--color-bg); text-decoration: none; }

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 9999px;
  background: white;
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.9rem;
}
.user-menu-trigger:hover { border-color: var(--color-text-muted); }
.user-avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  background: var(--color-primary);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}
.user-menu-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.5rem;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 12rem;
  padding: 0.375rem;
  display: none;
  z-index: 50;
}
.user-menu-dropdown.open { display: block; }
.user-menu-dropdown a,
.user-menu-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--color-text);
  border: 0;
  background: transparent;
  cursor: pointer;
}
.user-menu-dropdown a:hover,
.user-menu-dropdown button:hover {
  background: var(--color-bg);
  text-decoration: none;
}
.user-menu-wrap { position: relative; }

/* Hamburger on mobile */
.nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  padding: 0.5rem;
  cursor: pointer;
}
@media (max-width: 768px) {
  .site-nav a:not(.btn) { display: none; }
  .nav-toggle { display: inline-flex; }
  .site-nav.mobile-open { position: absolute; top: 100%; right: 0; left: 0; background: white; flex-direction: column; padding: 1rem; border-bottom: 1px solid var(--color-border); }
  .site-nav.mobile-open a { display: block !important; width: 100%; padding: 0.75rem; }
}

/* ---------- BOTTOM NAV (mobile only, utenti loggati) ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  background: white;
  border-top: 1px solid var(--color-border);
  padding: .4rem 0 calc(.4rem + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  box-shadow: 0 -1px 6px rgba(0,0,0,.05);
  transform: translateY(0);
  transition: transform 0.25s ease;
}
.bottom-nav.hidden-on-scroll { transform: translateY(110%); }
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: .7rem;
  color: var(--color-text-muted);
  text-decoration: none;
  padding: .25rem .25rem;
  min-height: 44px;
}
.bottom-nav a:hover { text-decoration: none; }
.bottom-nav a.active { color: var(--color-primary); }
.bottom-nav a .bn-icon { font-size: 1.3rem; line-height: 1; }
.bottom-nav a .bn-label { font-weight: 500; }
@media (min-width: 768px) {
  .bottom-nav { display: none; }
}

/* Su mobile nascondi nav-links del site-header (lasciamo solo logo + user menu) */
@media (max-width: 767px) {
  .site-nav-desktop-only { display: none; }
}

/* ---------- BOTTOM SHEET MENU (mobile "Io") ---------- */
.bottom-sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.bottom-sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.bottom-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: white;
  border-radius: 1.25rem 1.25rem 0 0;
  padding: .75rem 1rem calc(1rem + env(safe-area-inset-bottom));
  z-index: 61;
  transform: translateY(100%);
  transition: transform .25s ease;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 -4px 20px rgba(0,0,0,.15);
}
.bottom-sheet.open { transform: translateY(0); }
.bottom-sheet .sheet-handle {
  width: 3rem; height: 4px; background: #d1d5db; border-radius: 2px;
  margin: 0 auto .75rem;
}
.bottom-sheet .sheet-user {
  display: flex; align-items: center; gap: .75rem; padding: .5rem 0 1rem;
  border-bottom: 1px solid var(--color-border);
}
.bottom-sheet .sheet-user .user-avatar {
  width: 2.5rem; height: 2.5rem; font-size: 1rem;
}
.bottom-sheet .sheet-user-info { min-width: 0; }
.bottom-sheet .sheet-user-info .name { font-weight: 600; }
.bottom-sheet .sheet-user-info .email { font-size: .85rem; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bottom-sheet .sheet-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .9rem .5rem;
  text-decoration: none; color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  font-size: .95rem;
  min-height: 48px;
}
.bottom-sheet .sheet-item:last-child { border-bottom: 0; }
.bottom-sheet .sheet-item:hover { background: var(--color-bg); text-decoration: none; }
.bottom-sheet .sheet-item.danger { color: var(--color-danger); }
.bottom-sheet .sheet-item-ico { font-size: 1.25rem; width: 1.5rem; text-align: center; }
.site-footer {
  padding: 3rem 1rem 2rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  text-align: center;
  border-top: 1px solid var(--color-border);
  margin-top: 4rem;
  background: white;
}
.site-footer a { color: var(--color-text-muted); }

/* ---------- HERO ---------- */
.hero {
  padding: 5rem 1rem 4rem;
  text-align: center;
  background: linear-gradient(180deg, var(--color-primary-light) 0%, var(--color-bg) 100%);
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  margin: 0 0 1rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-text);
}
.hero h1 .accent { color: var(--color-primary); }
.hero p.lead {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--color-text-muted);
  margin: 0 auto 2rem;
  max-width: 38rem;
}

/* ---------- SECTIONS ---------- */
.section { padding: 4rem 0; }
.section-heading {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}
.section-subheading { color: var(--color-text-muted); margin-bottom: 2.5rem; }

/* ---------- IMPRESA CARD ---------- */
.impresa-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s, transform 0.15s;
}
.impresa-card:hover {
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.impresa-card h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.impresa-card .impresa-location { color: var(--color-text-muted); font-size: 0.9rem; }
.impresa-card .impresa-desc {
  color: var(--color-text);
  font-size: 0.9rem;
  margin-top: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.impresa-card .impresa-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: auto;
  padding-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.rating-stars { color: #f59e0b; font-weight: 600; }

/* ---------- STEPPER (onboarding) ---------- */
.stepper { display: flex; gap: 1rem; justify-content: center; margin: 2rem 0; }
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.step.active { color: var(--color-primary); font-weight: 600; }
.step-circle {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: var(--color-border);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}
.step.active .step-circle { background: var(--color-primary); }
.step.done .step-circle { background: var(--color-success); }

/* ---------- TOAST ---------- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 100;
  max-width: 22rem;
}
.toast {
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  background: var(--color-text);
  color: white;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s ease-out;
}
.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-danger); }
.toast-warning { background: var(--color-warning); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(1rem); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---------- MODAL ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 32rem;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-head {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  font-size: 1.05rem;
}
.modal-body { padding: 1.5rem; }
.modal-foot {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* ---------- ALERT ---------- */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  border-left: 4px solid;
}
.alert-info { background: #eff6ff; border-color: #2563eb; color: #1e40af; }
.alert-success { background: #ecfdf5; border-color: var(--color-success); color: #065f46; }
.alert-warning { background: #fffbeb; border-color: var(--color-warning); color: #92400e; }
.alert-danger { background: #fef2f2; border-color: var(--color-danger); color: #991b1b; }

/* ---------- EMPTY STATE ---------- */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-muted);
}
.empty h3 { color: var(--color-text); margin: 0.5rem 0; }

/* ---------- UTILITY ---------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--color-text-muted); }
.text-small { font-size: 0.85rem; }
.text-lg { font-size: 1.125rem; }
.text-bold { font-weight: 600; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden { display: none !important; }
@media (max-width: 768px) {
  .md\:hidden { display: none !important; }
}
