/* ============================================================
   Abitare Co. – Digital Content Tool (Web)
   styles.css — Design system completo
   ============================================================ */

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:        #c4162b;
  --red-dark:   #b01527;
  --red-press:  #980e22;
  --pink-bg:    #fff5f5;
  --white:      #ffffff;
  --gray-50:    #f9fafb;
  --gray-100:   #f3f4f6;
  --gray-200:   #e5e7eb;
  --gray-300:   #d1d5db;
  --gray-400:   #9ca3af;
  --gray-500:   #6b7280;
  --gray-700:   #374151;
  --gray-900:   #111827;
  --sidebar-w:  248px;
  --radius:     10px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.10);
  --font:       'Manrope', system-ui, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-900);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ─── App shell ─────────────────────────────────────────────── */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  padding: 24px 0 0;
  overflow-y: auto;
}

.logo {
  width: 140px;
  display: block;
  margin: 0 auto 28px;
  object-fit: contain;
}

.menu {
  list-style: none;
  padding: 0 12px;
  flex: 1;
}

.menu li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
  transition: background .15s, color .15s;
  margin-bottom: 2px;
  user-select: none;
}

.menu li:hover { background: var(--gray-100); }

.menu li.active {
  background: var(--pink-bg);
  color: var(--red);
  font-weight: 600;
}

.menu li .mi {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.menu li .mi img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.menu li .txt { flex: 1; }

/* ─── Main ──────────────────────────────────────────────────── */
main {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Scrollable area */
.content > .cards-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 40px 40px 24px;
}

/* ─── Card ──────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.card h2, .card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.card h3 { font-size: 16px; }

.card .muted {
  color: var(--gray-500);
  font-size: 13px;
}

/* ─── Label + Input ─────────────────────────────────────────── */
label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--gray-900);
}

.input, input[type="text"], input[type="number"], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color .15s;
  outline: none;
  margin-bottom: 16px;
  height: 41px;
}

.input:hover, input[type="text"]:hover, input[type="number"]:hover {
  border-color: var(--red);
}

.input:focus, input[type="text"]:focus, input[type="number"]:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(196,22,43,.08);
}

textarea.input, textarea {
  height: auto;
  min-height: 200px;
  resize: vertical;
  font-family: 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.5;
}

/* ─── Radios / Checkboxes ───────────────────────────────────── */
.radios label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 0;
}

input[type="radio"], input[type="checkbox"] {
  accent-color: var(--red);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ─── Row ───────────────────────────────────────────────────── */
.row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.row > * { flex: 1; min-width: 160px; }

/* ─── Drop area ─────────────────────────────────────────────── */
.drop {
  border: 1.5px dashed var(--gray-300);
  border-radius: var(--radius);
  background: var(--gray-50);
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  margin-top: 12px;
}

.drop:hover, .drop.drag-over {
  border-color: var(--red);
  background: var(--pink-bg);
}

.drop-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gray-500);
  font-size: 14px;
}

.btn-small {
  background: var(--gray-200);
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
}

.btn-small:hover { background: var(--gray-300); }

/* ─── Action bar (footer) ───────────────────────────────────── */
.actionbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px 24px;
  border-top: 1px solid var(--gray-200);
  background: var(--white);
  gap: 20px;
}

.action-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.action-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.action-progress .muted {
  font-size: 12px;
  color: var(--red);
  font-weight: 500;
}

.progress {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--gray-200);
  overflow: hidden;
}

.progress::-webkit-progress-bar   { background: var(--gray-200); border-radius: 3px; }
.progress::-webkit-progress-value { background: var(--red); border-radius: 3px; transition: width .2s; }
.progress::-moz-progress-bar      { background: var(--red); border-radius: 3px; }

.copyright {
  font-size: 11px;
  color: var(--gray-400);
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn-primary {
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 10px 28px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
  min-width: 150px;
  height: 40px;
}

.btn-primary:hover    { background: var(--red-dark); }
.btn-primary:active   { background: var(--red-press); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }

.btn-outline {
  background: transparent;
  color: var(--red);
  border: 2px solid var(--red);
  border-radius: 8px;
  padding: 8px 20px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.btn-outline:hover { background: var(--pink-bg); }

/* ─── Brand Pills (BV) ──────────────────────────────────────── */
.brand-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.brand-pill {
  background: var(--white);
  color: var(--gray-700);
  border: 1.5px solid var(--gray-300);
  border-radius: 20px;
  padding: 7px 18px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}

.brand-pill:hover  { border-color: var(--red); color: var(--red); }
.brand-pill.active { background: var(--red); color: var(--white); border-color: var(--red); }

/* ─── Form sections ─────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { margin-bottom: 6px; }

.form-section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.form-section-sub {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 18px;
}

/* ─── QR preview ────────────────────────────────────────────── */
.qr-preview-label {
  font-size: 13px;
  font-weight: 600;
  margin: 12px 0 6px;
  color: var(--gray-700);
}

#TxtQrPreview {
  font-size: 12px;
  color: var(--gray-500);
  word-break: break-all;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 10px 12px;
  min-height: 48px;
  line-height: 1.6;
}

/* ─── Iubenda code preview ──────────────────────────────────── */
#TxtIubPreview {
  font-family: 'Consolas', monospace;
  font-size: 11.5px;
  min-height: 220px;
  background: var(--gray-50);
  border-color: var(--gray-200);
  color: var(--gray-700);
  height: 220px;
  margin-bottom: 12px;
}

/* ─── Video desktop note ────────────────────────────────────── */
.video-desktop-note {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13px;
  color: #7a5e00;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 12px;
}

.video-desktop-note .icon { font-size: 18px; flex-shrink: 0; }

/* ─── Toast notifications ───────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--gray-900);
  color: var(--white);
  border-radius: 10px;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  max-width: 340px;
  z-index: 9999;
  transform: translateY(16px);
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast strong { font-size: 14px; font-weight: 700; }
.toast-ok   { border-left: 4px solid #22c55e; }
.toast-error{ border-left: 4px solid var(--red); }

/* ─── Modal overlay ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.40);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  animation: fadeIn .2s;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--white);
  border-radius: 12px;
  padding: 28px 32px;
  width: 420px;
  max-width: 94vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  animation: slideUp .2s ease;
}

@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.modal p  { font-size: 14px; color: var(--gray-500); margin-bottom: 16px; }

.modal-options { display: flex; flex-direction: column; gap: 10px; }

.modal-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--gray-200);
  transition: border-color .15s;
}

.modal-radio:hover         { border-color: var(--red); }
.modal-radio input         { width: 16px; height: 16px; accent-color: var(--red); }
.modal-radio em            { font-style: normal; color: var(--gray-500); font-size: 13px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ─── Utility ───────────────────────────────────────────────── */
.hidden { display: none !important; }

.muted { color: var(--gray-500); font-size: 13px; }

/* ─── Scrollbar personalizzata ──────────────────────────────── */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ─── Responsive (breakpoint base) ─────────────────────────── */
@media (max-width: 900px) {
  .sidebar { width: 200px; }
}

@media (max-width: 680px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--gray-200); padding: 12px; }
  .menu { display: flex; overflow-x: auto; gap: 4px; padding: 0; }
  .menu li { flex-shrink: 0; white-space: nowrap; }
  .logo { margin: 0 auto 12px; }
  .content > .cards-scroll { padding: 20px 16px; }
  .actionbar { padding: 12px 16px 16px; }
}

/* ============================================================
   AUTH / PRELOADER (minimal) — Added 2026-04-03
   ============================================================ */
#AuthPreloader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  z-index: 99999;
  opacity: 1;
  transition: opacity .35s ease;
}
#AuthPreloader.fade-out {
  opacity: 0;
  pointer-events: none;
}
.auth-bounce {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: authBounce 1.05s infinite ease-in-out;
}
.auth-bounce img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}
@keyframes authBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

#AuthOverlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(27, 41, 61, 0.58);
  z-index: 99998;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
#AuthOverlay.show {
  opacity: 1;
  pointer-events: all;
}

.auth-modal {
  width: 460px;
  max-width: calc(100vw - 32px);
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  padding: 26px 28px 20px;
  position: relative;
  text-align: center;
}
.auth-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -48px auto 10px;
  box-shadow: 0 10px 22px rgba(0,0,0,.10);
}
.auth-icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}
.auth-title {
  font-weight: 800;
  font-size: 14px;
  margin: 8px 0 4px;
  color: var(--gray-700);
}
.auth-sub {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 14px;
}
#AuthError {
  font-size: 12px;
  color: var(--red);
  margin: 8px 0 0;
  min-height: 16px;
}
.auth-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}
.auth-actions .btn-outline,
.auth-actions .btn-primary {
  min-width: 150px;
  height: 40px;
}
