@import url("https://fonts.googleapis.com/css2?family=Funnel+Sans:wght@300;400;500;600;700;800&family=Montserrat:wght@400;500;600;700&display=swap");

/* ============================================================
   CiaoDott Onboarding Client – Styles
   ============================================================ */

:root {
  --primary: #0063a3;
  --primary-light: #0a9eed;
  --primary-dark: #055587;
  --accent: #34b6fc;
  --bg: #f9fafb;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-brand: #f0f8ff;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --success: #15803d;
  --success-bg: #f0fdf4;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --warning: #b45309;
  --warning-bg: #fffbeb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 10px 25px rgba(15, 23, 42, 0.08);
  --ring: rgba(10, 158, 237, 0.18);
  --transition: .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: "Funnel Sans", "Montserrat", sans-serif;
  letter-spacing: -0.02em;
}

a {
  color: var(--primary);
  text-decoration: none;
}

strong {
  color: var(--text);
}

/* ---- Layout ---- */

.page-header {
  position: relative;
  margin: 0;
  padding: 22px 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.page-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 50%, var(--accent) 100%);
}
.page-header h1 {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.page-header .logo {
  display: block;
  line-height: 0;
}
.page-header .logo img {
  height: 38px;
  width: auto;
  display: block;
}

.page-header #userBar {
  position: absolute;
  top: 16px;
  right: 20px;
  margin-left: 0 !important;
  display: flex;
  align-items: center;
}

.container {
  max-width: 720px;
  margin: 28px auto 48px;
  padding: 0 20px;
}
.container.wide { max-width: 1100px; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 24px 28px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #072c4a;
}

.card h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

/* ---- Stepper ---- */

.stepper {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  padding: 0 8px 30px;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

.stepper-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 0;
  padding: 0;
  font-size: inherit;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  cursor: default;
}

.stepper-item::before {
  content: attr(data-num);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  z-index: 1;
  transition: all var(--transition);
}

.stepper-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 50%;
  left: calc(50% + 16px);
  right: calc(-50% + 16px);
  height: 2px;
  background: var(--border);
  transform: translateY(-50%);
  transition: background-color var(--transition);
}

.stepper-item span {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 4px;
  z-index: 10;
}

.stepper-item.active::before {
  border-color: var(--primary);
  background: var(--surface-brand);
  color: var(--primary-dark);
  box-shadow: 0 0 0 4px var(--ring);
}
.stepper-item.active span {
  opacity: 1;
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 11px;
}

.stepper-item.done::before {
  content: '\2713';
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  font-size: 14px;
}
.stepper-item.done:not(:last-child)::after {
  background: var(--primary);
}

.stepper-item:hover span {
  opacity: 1;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

/* ---- Form ---- */

.form-step { display: none; }
.form-step.active { display: block; }

.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: #374151;
}
.form-group .hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="time"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px var(--ring);
}

input::placeholder,
textarea::placeholder {
  color: #9ca3af;
}

input[readonly] {
  background: #f9fafb;
  color: #6b7280;
}
textarea { resize: vertical; min-height: 80px; }

.char-count {
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.row { display: flex; gap: 16px; }
.row > * { flex: 1; }

/* ---- Checkboxes ---- */

.checkbox-group { display: flex; flex-direction: column; gap: 10px; }

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  background: var(--surface);
}
.checkbox-item:hover {
  border-color: rgba(10, 158, 237, 0.35);
  background: var(--surface-muted);
}
.checkbox-item input { width: 18px; height: 18px; accent-color: var(--primary); }
.checkbox-item.required::after {
  content: "Obbligatorio";
  margin-left: auto;
  font-size: 11px;
  color: var(--primary-dark);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #b9e3fe;
  background: var(--surface-brand);
}

/* ---- Radio cards ---- */

.radio-cards { display: flex; gap: 16px; }
.radio-card {
  flex: 1;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.radio-card:hover {
  border-color: rgba(10, 158, 237, 0.35);
  background: #fbfdff;
}
.radio-card.selected {
  border-color: #b9e3fe;
  background: var(--surface-brand);
  box-shadow: inset 0 0 0 1px rgba(10, 158, 237, 0.2);
}
.radio-card h3 { font-size: 1rem; margin-bottom: 6px; color: var(--text); }
.radio-card p { font-size: 13px; color: var(--text-muted); }

/* ---- Schedules ---- */

.schedule-grid { display: flex; flex-direction: column; gap: 8px; }
.schedule-day {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}
.schedule-day .day-name { width: 88px; font-weight: 600; font-size: 13px; color: var(--text); }
.schedule-day .times { display: flex; gap: 8px; align-items: center; flex: 1; flex-wrap: wrap; }
.schedule-day input[type="time"] { width: 110px; padding: 6px 8px; font-size: 13px; background: #fff; }
.schedule-day .sep { color: var(--text-muted); font-size: 13px; }
.closed-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  padding: 6px 10px;
  border: 1px solid #fecaca;
  border-radius: 999px;
  background: #fff7ed;
  font-size: 11px;
  color: var(--danger);
  cursor: pointer;
  user-select: none;
  font-weight: 600;
}
.closed-toggle.is-closed {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ---- File upload ---- */

.file-drop {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  background: var(--surface-muted);
}
.file-drop:hover, .file-drop.dragover {
  border-color: rgba(10, 158, 237, 0.45);
  background: var(--surface-brand);
}
.file-drop .icon { font-size: 36px; margin-bottom: 8px; }
.file-drop .name { font-size: 13px; }
.file-drop .selected-file {
  color: var(--primary-dark);
  font-weight: 600;
  margin-top: 10px;
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.2;
  box-shadow: var(--shadow);
  transition: background-color var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-secondary {
  background: #fff;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-secondary:hover:not(:disabled) { background: #dff1ff; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #166534; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #8e0000; }

.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-block { width: 100%; }

.btn-group {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

/* ---- Alerts ---- */

.alert {
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-bg); color: var(--success); border-color: #bbf7d0; }
.alert-danger { background: var(--danger-bg); color: var(--danger); border-color: #fecaca; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: #fde68a; }
.alert-info { background: var(--surface-brand); color: var(--primary-dark); border-color: #b9e3fe; }

/* ---- Summary ---- */

.summary-section {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}
.summary-section h3 {
  font-size: 16px;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 0;
  border-bottom: none;
}
.summary-row { display: flex; gap: 12px; padding: 6px 0; font-size: 14px; }
.summary-row .label { width: 180px; font-weight: 500; flex-shrink: 0; color: var(--text-muted); }
.summary-row .value { color: var(--text); }

/* ---- Progress bar ---- */

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  margin-bottom: 24px;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  transition: width .4s ease;
}

/* ---- Admin panel ---- */

.admin-login { max-width: 400px; margin: 80px auto; }

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
}
.tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  color: var(--text-muted);
  transition: var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.tab .badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  background: #e8eef3;
  margin-left: 6px;
}

.reg-list { display: flex; flex-direction: column; gap: 12px; }

.reg-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
}
.reg-item:hover { box-shadow: var(--shadow-hover); }
.reg-item .info { flex: 1; }
.reg-item .name { font-weight: 600; font-size: 15px; }
.reg-item .email { font-size: 13px; color: var(--text-muted); }
.reg-item .meta { font-size: 12px; color: var(--text-muted); }

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.status-badge.pending_verification { background: #fff3e0; color: #e65100; }
.status-badge.pending_approval { background: #e3f2fd; color: #1565c0; }
.status-badge.approved_creating { background: var(--warning-bg); color: var(--warning); }
.status-badge.completed { background: var(--success-bg); color: var(--success); }
.status-badge.rejected { background: var(--danger-bg); color: var(--danger); }
.status-badge.expired { background: #f5f5f5; color: #9e9e9e; }

/* ---- Detail panel ---- */

.detail-panel {
  display: none;
  position: fixed;
  top: 0; right: 0;
  width: 520px;
  height: 100vh;
  background: var(--surface);
  box-shadow: -4px 0 24px rgba(0,0,0,.12);
  overflow-y: auto;
  z-index: 100;
  padding: 28px;
}
.detail-panel.open { display: block; }
.detail-panel .close-btn {
  position: absolute;
  top: 16px; right: 16px;
  background: none; border: none;
  font-size: 24px; cursor: pointer;
  color: var(--text-muted);
}
.detail-panel h2 { font-size: 18px; margin-bottom: 20px; }
.detail-panel .actions { display: flex; gap: 10px; margin-top: 24px; }

.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 99; }
.overlay.open { display: block; }

/* ---- Verify page ---- */

.verify-card {
  max-width: 500px;
  margin: 80px auto;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
}
.verify-card h2 { margin-bottom: 12px; }
.verify-card p { color: var(--text-muted); margin-bottom: 20px; }
.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Responsive ---- */

/* ---- Landing page ---- */

a.landing-card {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: var(--transition);
}
a.landing-card:hover {
  border-color: rgba(10, 158, 237, 0.35);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* ---- Google Sign-In ---- */

.google-signin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 16px;
  font-family: "Montserrat", -apple-system, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}
.google-signin-btn:hover {
  background: var(--bg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.google-signin-success {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 16px;
}

/* ---- Save status indicator ---- */

.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.progress-row .progress-bar {
  flex: 1;
  margin-bottom: 0;
}

.save-status {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--transition);
}
.save-status:empty { display: none; }
.save-status--saved { color: var(--success); }
.save-status--saving { color: var(--text-muted); }
.save-status--unsaved { color: var(--warning); }
.save-status--error { color: var(--danger); }
.save-status--offline { color: var(--text-muted); }

/* ---- Share / outline button ---- */

.btn-outline {
  background: #fff;
  color: #374151;
  border-color: var(--border-strong);
  padding: 10px 16px;
}
.btn-outline:hover:not(:disabled) {
  border-color: rgba(10, 158, 237, 0.35);
  background: var(--surface-brand);
}
.btn-outline--success {
  border-color: var(--success) !important;
  color: var(--success) !important;
  background: var(--success-bg) !important;
}

.landing-shell {
  max-width: 640px;
  margin: 0 auto;
}

.landing-intro {
  text-align: center;
  margin-bottom: 28px;
}

.landing-intro h2 {
  font-size: 1.75rem;
  font-weight: 600;
  color: #072c4a;
  margin-bottom: 6px;
}

.landing-intro p {
  color: var(--text-muted);
  font-size: 14px;
}

.landing-option-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: var(--surface-brand);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: inset 0 0 0 1px rgba(10, 158, 237, 0.16);
}

/* ---- Responsive ---- */

@media (max-width: 640px) {
  .container { padding: 0 12px; }
  .card { padding: 20px; }
  .page-header { padding: 16px 12px 12px; }
  .page-header .logo img { height: 30px; }
  .page-header h1 { font-size: 0.75rem; }
  .row { flex-direction: column; gap: 0; }
  .radio-cards { flex-direction: column; }
  .btn-group { flex-direction: column; }
  .stepper { padding: 0 2px 26px; }
  .stepper-item::before { width: 26px; height: 26px; min-width: 26px; font-size: 10px; }
  .stepper-item:not(:last-child)::after { left: calc(50% + 13px); right: calc(-50% + 13px); }
  .stepper-item span { font-size: 9px; }
  .stepper-item.active span { font-size: 10px; }
  .stepper-item.done::before { font-size: 12px; }
  .detail-panel { width: 100%; }
  .summary-row { flex-direction: column; }
  .summary-row .label { width: auto; }
  .schedule-day { align-items: flex-start; flex-direction: column; }
  .schedule-day .day-name { width: auto; }
  .landing-intro h2 { font-size: 1.5rem; }
}
