/* ============ RESET & TOKENS ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #1f6f54;
  --primary-dark: #155741;
  --primary-light: #e8f3ee;
  --accent: #f0a500;
  --ink: #1c2420;
  --muted: #5c6b63;
  --line: #dde5e0;
  --bg: #ffffff;
  --bg-alt: #f4f8f5;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(20, 60, 44, .10);
  --shadow-lg: 0 16px 48px rgba(20, 60, 44, .16);
}
html { scroll-behavior: smooth; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}
.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-block; padding: 12px 24px; border-radius: 999px;
  font-weight: 600; font-size: 15px; cursor: pointer; border: 2px solid transparent;
  transition: all .2s ease; text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-ghost:hover { background: var(--primary-light); }
.btn-lg { padding: 16px 32px; font-size: 17px; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { display: block; width: 100%; }
.btn-danger { background: #c0392b; color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-muted { background: #e9eeeb; color: var(--ink); }

/* ============ HEADER ============ */
.site-header {
  position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.logo { font-size: 24px; font-weight: 800; color: var(--ink); }
.logo span { color: var(--primary); }
.logo-light { color: #fff; }
.main-nav { display: flex; align-items: center; gap: 26px; }
.main-nav a:not(.btn) { font-weight: 500; color: var(--muted); }
.main-nav a:not(.btn):hover { color: var(--primary); }
.btn-nav { padding: 9px 20px; }

/* ============ HERO ============ */
.hero {
  background: linear-gradient(135deg, #10362a 0%, #1f6f54 60%, #2c8a68 100%);
  color: #fff; padding: 90px 0 100px; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -120px; top: -120px; width: 420px; height: 420px;
  background: rgba(255,255,255,.06); border-radius: 50%;
}
.hero-inner { display: grid; grid-template-columns: 1.5fr 1fr; gap: 60px; align-items: center; position: relative; z-index: 1; }
.eyebrow { text-transform: uppercase; letter-spacing: 2px; font-size: 13px; color: var(--accent); font-weight: 700; margin-bottom: 14px; }
.hero h1 { font-size: clamp(32px, 4.5vw, 52px); line-height: 1.15; margin-bottom: 18px; }
.hero h1 span { color: var(--accent); }
.lead { font-size: 18px; opacity: .92; max-width: 560px; margin-bottom: 30px; }
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 30px; }
.hero-actions .btn-ghost { color: #fff; border-color: rgba(255,255,255,.6); }
.hero-actions .btn-ghost:hover { background: rgba(255,255,255,.12); }
.hero-badges { display: flex; gap: 22px; flex-wrap: wrap; font-size: 14px; opacity: .9; }
.hero-card {
  background: #fff; color: var(--ink); border-radius: var(--radius);
  padding: 34px 30px; box-shadow: var(--shadow-lg); text-align: center;
}
.hero-card h3 { font-size: 30px; color: var(--primary); margin-bottom: 6px; }
.hero-card h3 small { font-size: 16px; color: var(--muted); font-weight: 500; }
.hero-card p { color: var(--muted); margin-bottom: 22px; font-size: 15px; }

/* ============ SECTIONS ============ */
.section { padding: 80px 0; }
.section-alt { background: var(--bg-alt); }
.section-title { font-size: clamp(26px, 3vw, 38px); text-align: center; margin-bottom: 10px; }
.section-sub { text-align: center; color: var(--muted); max-width: 640px; margin: 0 auto 48px; }

/* ============ MODELLI ============ */
.models-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 28px; max-width: 860px; margin: 0 auto; }
.model-card {
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius);
  padding: 34px 30px; position: relative; transition: all .2s ease;
}
.model-card.featured { border-color: var(--primary); box-shadow: var(--shadow-lg); }
.model-card h3 { font-size: 22px; margin-bottom: 4px; }
.model-tag { color: var(--primary); font-weight: 600; font-size: 14px; margin-bottom: 18px; }
.model-card ul { margin-bottom: 22px; }
.model-card li { padding: 6px 0 6px 26px; position: relative; color: var(--muted); }
.model-card li::before { content: "✔"; position: absolute; left: 0; color: var(--primary); font-weight: 700; }
.model-price { font-size: 15px; color: var(--muted); }
.model-price strong { font-size: 26px; color: var(--ink); }
.ribbon {
  position: absolute; top: -14px; right: 24px; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  padding: 6px 14px; border-radius: 999px;
}

/* ============ PROMO ============ */
.promo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.promo-card {
  background: #fff; border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow);
  border: 1px solid var(--line); position: relative; overflow: hidden;
}
.promo-badge {
  display: inline-block; background: var(--primary-light); color: var(--primary);
  font-weight: 700; font-size: 13px; padding: 5px 12px; border-radius: 999px; margin-bottom: 14px;
}
.promo-card h3 { font-size: 20px; margin-bottom: 8px; }
.promo-card p { color: var(--muted); font-size: 15px; }

/* ============ MODEL SWITCH ============ */
.model-switch-wrap { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 44px; flex-wrap: wrap; }
.model-switch-label { font-weight: 600; color: var(--muted); }
.model-switch { display: inline-flex; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 999px; padding: 5px; }
.model-btn {
  border: none; background: transparent; padding: 10px 26px; border-radius: 999px;
  font-weight: 600; font-size: 15px; color: var(--muted); cursor: pointer; transition: all .2s ease;
}
.model-btn.active { background: var(--primary); color: #fff; box-shadow: var(--shadow); }

/* ============ CONFIGURATORE ============ */
.config-layout { display: grid; grid-template-columns: 1fr 340px; gap: 36px; align-items: start; }
.configurator .loading { color: var(--muted); text-align: center; padding: 40px; }

.cat-block { margin-bottom: 40px; }
.cat-header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.cat-header .cat-icon { font-size: 26px; }
.cat-header h3 { font-size: 21px; }
.cat-header .cat-line { flex: 1; height: 1px; background: var(--line); }

.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }

.svc-card {
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius);
  padding: 20px; transition: all .2s ease; cursor: pointer;
}
.svc-card:hover { border-color: #b9d2c6; box-shadow: var(--shadow); }
.svc-card.on { border-color: var(--primary); background: linear-gradient(180deg, #ffffff 0%, var(--primary-light) 100%); box-shadow: var(--shadow); }

.svc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.svc-name { font-size: 17px; font-weight: 700; }
.svc-desc { font-size: 13.5px; color: var(--muted); margin-bottom: 12px; }

.svc-price { display: flex; align-items: baseline; gap: 8px; }
.svc-price .price { font-size: 22px; font-weight: 800; color: var(--primary); }
.svc-price .per { font-size: 12.5px; color: var(--muted); }

/* Toggle switch */
.switch { position: relative; width: 48px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: #c8d4cd; border-radius: 999px;
  transition: .25s; cursor: pointer;
}
.slider::before {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: .25s; box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(22px); }

/* Accessori */
.addons { margin-top: 14px; border-top: 1px dashed #c4d4cb; padding-top: 12px; display: none; }
.svc-card.on .addons { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.addon {
  display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px;
}
.addon input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.addon .addon-name { flex: 1; }
.addon .addon-name small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.addon .addon-price { font-weight: 700; color: var(--primary); white-space: nowrap; font-size: 13.5px; }
.addon.disabled { opacity: .45; pointer-events: none; }

/* ============ RIEPILOGO ============ */
.summary { position: sticky; top: 90px; }
.summary-inner {
  background: #fff; border: 2px solid var(--primary); border-radius: var(--radius);
  padding: 26px 24px; box-shadow: var(--shadow-lg);
}
.summary h3 { font-size: 20px; margin-bottom: 4px; }
.summary-model { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.summary-model strong { color: var(--primary); }
.summary-lines { max-height: 260px; overflow-y: auto; margin-bottom: 14px; }
.summary-line { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.summary-line span:last-child { font-weight: 600; white-space: nowrap; }
.summary-line .sub { padding-left: 16px; color: var(--muted); font-size: 13px; }
.summary-line.empty { color: var(--muted); font-style: italic; border: none; }
.summary-total { border-top: 2px solid var(--ink); padding-top: 12px; margin-bottom: 18px; }
.summary-total .row { display: flex; justify-content: space-between; font-size: 14.5px; padding: 3px 0; color: var(--muted); }
.summary-total .row.total { font-size: 22px; font-weight: 800; color: var(--ink); padding: 8px 0 2px; }
.summary-total .row.total span:last-child { color: var(--primary); }
.summary-total .row.annual { font-size: 14px; }
.summary-total .row.annual em { color: var(--accent); font-style: normal; font-weight: 700; }
.summary-note { font-size: 12px; color: var(--muted); margin-top: 12px; text-align: center; }

/* Barra mobile */
.mobile-bar { display: none; }

/* ============ FOOTER ============ */
.site-footer { background: #10271f; color: #cfe0d7; padding: 60px 0 0; }
.footer-inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; padding-bottom: 40px; }
.footer-inner p { margin-top: 12px; font-size: 14.5px; opacity: .8; max-width: 420px; }
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-links a:hover { color: #fff; }
.copyright { text-align: center; padding: 18px; border-top: 1px solid rgba(255,255,255,.1); font-size: 13px; opacity: .6; }

/* ============ ADMIN ============ */
.admin-body { background: var(--bg-alt); }
.admin-header { background: #10271f; color: #fff; padding: 16px 0; }
.admin-header .container { display: flex; justify-content: space-between; align-items: center; }
.admin-header a.back { color: #9fc6b5; font-size: 14px; }
.login-box {
  max-width: 400px; margin: 80px auto; background: #fff; border-radius: var(--radius);
  padding: 40px 34px; box-shadow: var(--shadow-lg); border: 1px solid var(--line);
}
.login-box h1 { font-size: 24px; margin-bottom: 6px; }
.login-box p { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.login-box .btn { margin-top: 8px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 14.5px; font-family: inherit; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); }
.field textarea { resize: vertical; min-height: 80px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.login-error { color: #c0392b; font-size: 13.5px; margin-top: 10px; display: none; }

.admin-main { padding: 40px 0 80px; }
.admin-toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  flex-wrap: wrap; margin-bottom: 28px;
}
.admin-toolbar h1 { font-size: 26px; }
.admin-toolbar .actions { display: flex; gap: 12px; flex-wrap: wrap; }
.admin-cat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 26px; overflow: hidden; }
.admin-cat-header {
  background: var(--primary); color: #fff; padding: 14px 22px;
  display: flex; align-items: center; gap: 10px; font-weight: 700;
}
.admin-cat-header .count { background: rgba(255,255,255,.2); font-size: 12px; padding: 2px 10px; border-radius: 999px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.admin-table th { background: var(--bg-alt); font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.admin-table input[type="text"], .admin-table input[type="number"] {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; font-family: inherit;
}
.admin-table input:focus { outline: none; border-color: var(--primary); }
.admin-table .price-input { max-width: 90px; }
.admin-table .status-select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.admin-table tr.inactive-row { opacity: .5; }
.admin-table tr.addon-row td:first-child { padding-left: 34px; font-size: 13px; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; }
.badge-addon { background: #fef3d8; color: #9a6a00; }
.addon-form { background: #fffdf5; border: 1.5px dashed var(--accent); border-radius: var(--radius); padding: 26px; margin-bottom: 30px; }
.addon-form h2 { font-size: 19px; margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--ink); color: #fff; padding: 13px 26px; border-radius: 999px;
  font-size: 14.5px; box-shadow: var(--shadow-lg); opacity: 0; transition: all .3s ease; z-index: 999;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: var(--primary); }
.toast.error { background: #c0392b; }

/* ============ MODALE ============ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 30, 22, .55); z-index: 200;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius); padding: 32px; max-width: 520px; width: 100%;
  max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal h2 { font-size: 22px; margin-bottom: 16px; }
.modal .modal-actions { display: flex; gap: 12px; margin-top: 20px; justify-content: flex-end; }
.modal pre { background: var(--bg-alt); padding: 14px; border-radius: 10px; font-size: 12.5px; overflow-x: auto; white-space: pre-wrap; }

/* ============ RESPONSIVE ============ */
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; }
  .config-layout { grid-template-columns: 1fr; }
  .summary { position: static; }
  .footer-inner { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .main-nav a:not(.btn) { display: none; }
  .hero { padding: 60px 0; }
  .section { padding: 56px 0; }
  .model-switch { width: 100%; }
  .model-btn { flex: 1; padding: 10px 8px; font-size: 13.5px; }
  .admin-toolbar { flex-direction: column; align-items: stretch; }
  .admin-table th:nth-child(2), .admin-table td:nth-child(2) { display: none; }
}
