@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg: #f7f9fc;
  --ink-950: #0d1b2f;
  --ink-900: #16233a;
  --ink-700: #3c4a63;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --ink-300: #cbd5e1;
  --ink-100: #e7ecf3;
  --ink-50: #f1f4f9;
  --white: #ffffff;
  --brand-400: #5e87ff;
  --brand-600: #1f43ed;
  --brand-700: #0033a0;
  --brand-800: #0a2c89;
  --ok: #059669;
  --err: #dc2626;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; overflow-x: clip; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink-900);
  position: relative;
  overflow-x: clip;
  max-width: 100vw;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(70vw 70vw at -10% -20%, rgba(0, 51, 160, 0.10), transparent 55%),
    radial-gradient(70vw 70vw at 120% 10%, rgba(94, 135, 255, 0.12), transparent 60%),
    radial-gradient(40vw 40vw at 60% 100%, rgba(168, 85, 247, 0.06), transparent 60%);
  filter: blur(70px);
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }

::selection { background: var(--brand-600); color: #fff; }

/* ---------- layout ---------- */
.container-page { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(20px);
  background: rgba(255, 255, 255, 0.75);
  border-bottom: 1px solid var(--ink-100);
}
.topbar-grid { display: flex; align-items: center; justify-content: space-between; height: 108px; }
.brand { display: flex; align-items: center; }
.brand img { height: 64px; width: auto; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.btn-accedi {
  display: inline-flex; align-items: center; font-size: 1.02rem; font-weight: 700;
  padding: 10px 18px; border-radius: 999px; background: var(--brand-700); color: #fff;
  transition: all .2s;
}
.btn-accedi:hover { background: var(--brand-800); }
.cart-icon-link svg { width: 26px; height: 26px; }
@media (max-width: 600px) {
  .topbar-grid { height: 84px; }
  .brand img { height: 44px; }
}
.cart-icon-link { position: relative; padding: 10px; }
.badge { position: absolute; top: 2px; right: 2px; background: var(--brand-700); color: #fff; border-radius: 999px; font-size: .62rem; font-weight: 700; padding: 1px 5px; min-width: 15px; text-align: center; line-height: 1.4; }

main { max-width: 1100px; margin: 0 auto; padding: 32px 16px 80px; }
.page-narrow { max-width: 520px; margin: 0 auto; }
.page-wide { max-width: 960px; margin: 0 auto; }
.center { text-align: center; }

h1 { font-size: 1.6rem; font-weight: 800; margin: 0 0 8px; letter-spacing: -0.01em; color: var(--ink-950); }
h2 { font-size: 1.15rem; font-weight: 700; margin: 24px 0 12px; color: var(--ink-950); }
.muted { color: var(--ink-500); }
.small { font-size: .78rem; }

/* ---------- steps intro ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0 28px; }
@media (max-width: 640px) { .steps { grid-template-columns: 1fr; } }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step-num {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-700));
  color: #fff; font-weight: 800; font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
}
.step-text strong { display: block; font-size: .88rem; color: var(--ink-950); }
.step-text span { font-size: .8rem; color: var(--ink-500); }

/* ---------- buttons ---------- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  color: #fff; font-weight: 800; font-size: 1rem; padding: 14px 22px; border: none;
  border-radius: 999px; cursor: pointer; transition: all .2s;
  text-align: center; box-shadow: 0 8px 24px -8px rgba(0,51,160,.45);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 12px 30px -8px rgba(0,51,160,.6); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }

.btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: #fff; box-shadow: inset 0 0 0 1.5px var(--ink-100);
  color: var(--ink-900); font-weight: 600; padding: 12px 20px; border-radius: 999px;
  border: none; cursor: pointer; width: 100%; text-align: center;
  transition: all .2s;
}
.btn-outline:hover { box-shadow: inset 0 0 0 1.5px var(--brand-400); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px; color: var(--ink-700);
  font-weight: 600; font-size: .9rem; padding: 8px 14px; border-radius: 999px;
  transition: all .2s;
}
.btn-ghost:hover { color: var(--brand-700); background: var(--ink-50); }

/* ---------- cards / surfaces ---------- */
.card {
  background: #fff;
  box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 16px 40px -24px rgba(0,51,160,.22);
  border: 1px solid var(--ink-100);
  border-radius: 24px;
  padding: 24px;
}
.surface {
  background: var(--ink-50);
  border: 1px solid var(--ink-100);
  border-radius: 16px;
}

.label { display: block; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-500); margin: 16px 0 6px; }

input, textarea, select {
  width: 100%; padding: 13px 16px; font-family: inherit; font-size: 16px;
  background: var(--ink-50); color: var(--ink-950);
  border: 1.5px solid transparent;
  border-radius: 14px; transition: all .2s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--brand-400); background: #fff;
}
input::placeholder, textarea::placeholder { color: var(--ink-400); }

/* ---------- configuratore ---------- */
.config { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 860px) { .config { grid-template-columns: 1fr 1.05fr; align-items: start; } }

.dropzone {
  border: 1.5px dashed var(--ink-300); border-radius: 20px; background: var(--ink-50);
  padding: 40px 20px; text-align: center; cursor: pointer; transition: all .2s;
}
.dropzone:hover, .dropzone.loading { border-color: var(--brand-400); background: #eef2ff; }
.dropzone .icon { color: var(--ink-400); margin-bottom: 10px; }
.dropzone strong { display: block; margin-bottom: 4px; color: var(--ink-950); }

.file-chip {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-top: 14px;
  border-radius: 16px; background: #ecfdf5; border: 1px solid #a7f3d0;
}
.file-chip .name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-950); }
.file-chip button { background: none; border: none; color: var(--ink-500); cursor: pointer; font-size: 1rem; }

.warnings { margin-top: 12px; border-radius: 14px; padding: 12px 14px; font-size: .82rem; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.error { color: var(--err); font-size: .85rem; margin-top: 10px; }
.flash { border-radius: 14px; padding: 12px 16px; margin-bottom: 20px; background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }

.dims-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.price-box { margin-top: 20px; border-radius: 18px; padding: 18px 20px; background: var(--ink-50); border: 1px solid var(--ink-100); }
.price-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: .92rem; color: var(--ink-700); }
.price-row.total { font-weight: 800; font-size: 1.3rem; border-top: 1px solid var(--ink-100); margin-top: 8px; padding-top: 10px; background: linear-gradient(90deg, var(--brand-700), #7c3aed); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- carrello ---------- */
.cart-list { list-style: none; padding: 0; margin: 20px 0; }
.cart-item { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--ink-100); }
.cart-item-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cart-item-info strong { color: var(--ink-950); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb { width: 46px; height: 46px; border-radius: 12px; background: var(--ink-50); border: 1px solid var(--ink-100); flex-shrink: 0; }
.cart-item-price { font-weight: 700; white-space: nowrap; color: var(--ink-950); }
.remove-btn { background: none; border: none; color: var(--err); cursor: pointer; font-size: 1.1rem; padding: 4px; }
.cart-total { font-size: 1.2rem; margin: 20px 0; text-align: right; font-weight: 800; color: var(--ink-950); }

/* ---------- admin table ---------- */
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.admin-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--ink-100); font-size: .88rem; }
.admin-table th { color: var(--ink-500); font-weight: 700; text-transform: uppercase; font-size: .7rem; letter-spacing: .08em; }
.admin-table a { color: var(--brand-700); font-weight: 600; }
.status { padding: 3px 10px; border-radius: 999px; background: var(--ink-100); font-size: .72rem; font-weight: 700; color: var(--ink-700); }
.status-pagato { background: #d1fae5; color: var(--ok); }
.status-annullato { background: #fee2e2; color: var(--err); }
.inline-form { margin: 20px 0; max-width: 260px; }
