/* =========================================================
   MAIA STUDIO — CSS (FULL)
   Fix: ripristino layout 2-colonne + progress pillole
   ========================================================= */

/* -----------------------------
   RESET & BASE
----------------------------- */
:root{
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e5e7eb;

  --brand-900:#020617;
  --brand-800:#0f172a;

  --primary:#3b82f6;
  --primary2:#0ea5e9;

  --shadow: 0 10px 30px rgba(15,23,42,.06);
  --radius: 16px;

  --container: 1100px;
}

*{
  box-sizing:border-box;
  margin:0;
  padding:0;
  font-family:'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body{ height:100%; }

body{
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a{
  color: var(--primary);
  text-decoration: none;
}
a:hover{ text-decoration: underline; }

/* -----------------------------
   WRAP
----------------------------- */
.wrap{
  width:100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0; /* topbar full width */
}

/* -----------------------------
   TOPBAR (FULL WIDTH)
----------------------------- */
.topbar{
  width:100%;
  background: linear-gradient(90deg, var(--brand-800), var(--brand-900));
  color:#fff;
  padding: 22px 20px 18px;
  border-radius: 0; /* full width senza bordi arrotondati */
  box-shadow: 0 6px 20px rgba(15,23,42,.12);
}

.topbar-inner{
  max-width: var(--container);
  margin: 0 auto;
}

.topbar h1{
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .2px;
}

.topbar p{
  font-size: 13px;
  color: #cbd5e1;
  margin-top: 4px;
}

/* -----------------------------
   PROGRESS (PILLS)
   (NOTA: niente vecchia progress-bar)
----------------------------- */
.progress{
  display:flex;
  gap: 8px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.stepPill{
  background: rgba(255,255,255,0.12);
  color: #cbd5e1;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
  display:flex;
  align-items:center;
  gap: 6px;
  transition: all .18s ease;
  user-select: none;
}

.stepPill strong{
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size: 11px;
}

.stepPill.active{
  background: var(--primary);
  color:#fff;
  font-weight: 700;
}

.stepPill.active strong{
  background: rgba(255,255,255,0.35);
}

/* -----------------------------
   MAIN GRID (CARD + SIDEBAR)
----------------------------- */
.grid{
  max-width: var(--container);
  margin: 24px auto 0;
  padding: 0 16px 40px;
  display:grid;
  grid-template-columns: 1.6fr .8fr;
  gap: 18px;
  align-items: start;
}

/* mobile-first: sotto i 980px va in colonna */
@media (max-width: 980px){
  .grid{
    grid-template-columns: 1fr;
  }
}

/* -----------------------------
   CARD
----------------------------- */
.card{
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  width: 100%;
}

/* -----------------------------
   SIDEBAR (RIGHT BOX)
----------------------------- */
.sideBox{
  background: transparent;
}

.kpi{
  background: var(--card);
  border: 1px solid rgba(229,231,235,.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.kpi .k{
  display:flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(229,231,235,.9);
}
.kpi .k:last-child{ border-bottom: none; }

.kpi .t{
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.kpi .v{
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-align:right;
}

.kpi .note{
  margin-top: 12px;
  color: #334155;
  font-size: 13px;
  background: #f8fafc;
  border: 1px solid rgba(229,231,235,.9);
  border-radius: 12px;
  padding: 12px;
}

/* -----------------------------
   FORM LAYOUT
----------------------------- */
label{
  display:block;
  font-weight: 700;
  font-size: 13px;
  margin: 12px 0 6px;
  color: #0f172a;
}

input[type="text"],
input[type="url"],
input[type="email"],
select,
textarea{
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  outline: none;
}

input:focus,
select:focus,
textarea:focus{
  border-color: rgba(59,130,246,.55);
  box-shadow: 0 0 0 4px rgba(59,130,246,.12);
}

textarea{
  resize: vertical;
  min-height: 90px;
}

.hint{
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.hr{
  height: 1px;
  background: rgba(229,231,235,.95);
  margin: 16px 0;
}

/* row helpers */
.row{
  display:grid;
  gap: 14px;
}

.row.two{
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 720px){
  .row.two{
    grid-template-columns: 1fr;
  }
}

/* -----------------------------
   CHIPS (LINGUE)
----------------------------- */
.chips{
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.chip{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(229,231,235,.9);
  background: #f8fafc;
  font-size: 13px;
  color: #0f172a;
}

.chip input{
  transform: translateY(1px);
}

/* -----------------------------
   COUNTERS (step 2/3/4)
----------------------------- */
.counter{
  font-size: 12px;
  text-align: right;
  color: var(--muted);
  margin-top: 4px;
}
.counter.limit{ color: #ef4444; }

/* -----------------------------
   ERROR BOX
----------------------------- */
.error{
  display:none;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
  font-size: 13px;
}
.error.show{ display:block; }

/* -----------------------------
   GDPR & HONEYPOT
----------------------------- */
.gdpr{
  margin-top: 14px;
  font-size: 12px;
  color: #475569;
}

.u-b766d9af{
  position: absolute;
  left: -9999px;
  top: -9999px;
  height: 0;
  width: 0;
  overflow: hidden;
}

/* -----------------------------
   ACTIONS & BUTTONS
----------------------------- */
.actions{
  margin-top: 16px;
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn{
  border: none;
  cursor:pointer;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 800;
  font-size: 14px;
  transition: transform .06s ease, opacity .15s ease;
}

.btn:active{ transform: translateY(1px); }

.btn.primary{
  background: linear-gradient(90deg, var(--primary), var(--primary2));
  color:#fff;
}

.btn.ghost{
  background: #eef2f7;
  color: #0f172a;
}

.btn:disabled{
  opacity: .55;
  cursor:not-allowed;
}

/* -----------------------------
   FILE LIST (step 4)
----------------------------- */
.fileList{
  margin-top: 10px;
  display:flex;
  flex-direction: column;
  gap: 8px;
}

.fileItem{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(229,231,235,.9);
  border-radius: 12px;
  background: #f8fafc;
  font-size: 13px;
  color:#0f172a;
}

.fileItem button{
  border:none;
  background: transparent;
  color: #ef4444;
  font-weight: 800;
  cursor:pointer;
}

/* -----------------------------
   CHAT (step 5)
----------------------------- */
.chatLayout{
  display:grid;
  grid-template-columns: 1.35fr .65fr;
  gap: 14px;
}

@media (max-width: 980px){
  .chatLayout{ grid-template-columns: 1fr; }
}

.chat-box{
  display:flex;
  flex-direction: column;
  height: 420px;
  border: 1px solid rgba(229,231,235,.9);
  border-radius: 14px;
  overflow: hidden;
  background:#fff;
}

.chat-thread{
  flex:1;
  padding: 14px;
  overflow-y: auto;
  background: #f8fafc;
}

.chat-msg{
  margin-bottom: 10px;
  display:flex;
}
.chat-msg.user{ justify-content:flex-end; }
.chat-msg.bot{ justify-content:flex-start; }

.bubble{
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  box-shadow: 0 6px 16px rgba(15,23,42,.06);
}

.chat-msg.user .bubble{
  background: rgba(59,130,246,.12);
  border: 1px solid rgba(59,130,246,.18);
  color:#0f172a;
}

.chat-msg.bot .bubble{
  background: #fff;
  border: 1px solid rgba(229,231,235,.9);
  color:#0f172a;
}

.chat-input{
  display:flex;
  gap: 10px;
  padding: 10px;
  border-top: 1px solid rgba(229,231,235,.9);
  background:#fff;
}

.chat-input input{
  flex:1;
  border: 1px solid rgba(229,231,235,.9);
  border-radius: 12px;
  padding: 10px 12px;
}

.chat-input button{
  white-space: nowrap;
}

/* side panel in chat */
.sidebar{
  background: #ffffff;
  border: 1px solid rgba(229,231,235,.9);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px;
  font-size: 13px;
  color: #334155;
}

.sidebar h3{
  font-size: 13px;
  margin-bottom: 8px;
  color:#0f172a;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(229,231,235,.9);
  background: #f8fafc;
}

/* -----------------------------
   FOOTER
----------------------------- */
.maia-footer{
  margin-top: 40px;
  background: var(--brand-900);
  color: #cbd5e1;
  padding: 22px 16px;
  font-size: 13px;
}

.footer-inner{
  max-width: var(--container);
  margin: 0 auto;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 16px;
}

@media (max-width: 720px){
  .footer-inner{
    flex-direction: column;
    text-align:center;
  }
}

.footer-left{
  display:flex;
  align-items:center;
  gap: 12px;
}

.footer-logo{
  height: 30px;
  width: auto;
  display:block;
}

.footer-company{
  color:#cbd5e1;
  font-size: 12px;
}

.footer-right a{
  color:#93c5fd;
  font-weight: 700;
}
.footer-right a:hover{
  color:#bfdbfe;
}


/* =========================================================
   FIX: Pagine 2/3/4/6 senza .grid -> card non "compatta"
   Se la .card è figlia diretta di .wrap, la rendiamo come un container
   ========================================================= */
.wrap > .card{
  max-width: var(--container);
  margin: 24px auto 0;
  width: calc(100% - 32px); /* come il padding della .grid */
}

/* =========================================================
   STEP 2 (Testi) — elementi UI mancanti
   ========================================================= */
.sub{
  background: #f8fafc;
  border: 1px solid rgba(229,231,235,.9);
  border-radius: 12px;
  padding: 12px;
  color: #334155;
  font-size: 13px;
  margin-bottom: 14px;
}

.meta{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(229,231,235,.9);
  border-radius: 12px;
  background: #ffffff;
}

.limitMsg{
  display:none;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 13px;
  font-weight: 600;
}
.limitMsg.show{
  display:block;
}

/* =========================================================
   STEP 5 (Playground) — FIX classi HTML reali: .layout, .chatBox, .thread...
   (aggiungere in fondo al file, evita conflitti)
   ========================================================= */

/* container pagina 5 */
.wrap > .layout{
  max-width: var(--container);
  margin: 24px auto 0;
  width: calc(100% - 32px);
  padding: 0;
  display: grid;
  grid-template-columns: 1.35fr .65fr;
  gap: 14px;
  align-items: start;
}

@media (max-width: 980px){
  .wrap > .layout{
    grid-template-columns: 1fr;
  }
}

/* chatBox */
.chatBox{
  display: flex;
  flex-direction: column;
  min-height: 560px;
}

/* header chat */
.chatHeader{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(229,231,235,.95);
  margin-bottom: 12px;
}

.chatHeader .left{
  display:flex;
  align-items:center;
  gap: 12px;
}

.chatHeader .avatar{
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  background: rgba(59,130,246,.14);
  border: 1px solid rgba(59,130,246,.18);
  color: #0f172a;
}

.chatHeader .title{
  font-weight: 900;
  font-size: 14px;
  line-height: 1.2;
}

.chatHeader .sub{
  margin: 2px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
  font-size: 12px;
  color: var(--muted);
}

/* thread */
.thread{
  flex: 1;
  min-height: 360px;
  padding: 14px;
  overflow-y: auto;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid rgba(229,231,235,.9);
}

/* messaggi */
.msg{
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  margin-bottom: 10px;
  font-size: 14px;
  box-shadow: 0 6px 16px rgba(15,23,42,.06);
  border: 1px solid rgba(229,231,235,.9);
  background: #fff;
  color: #0f172a;
}

.msg .who{
  font-weight: 900;
  font-size: 12px;
  color: #334155;
  margin-bottom: 4px;
}

.msg.bot{
  margin-right: auto;
}

.msg.user{
  margin-left: auto;
  background: rgba(59,130,246,.12);
  border: 1px solid rgba(59,130,246,.18);
}

/* composer */
.composer{
  display:flex;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(229,231,235,.95);
}

.composer input{
  flex: 1;
  border: 1px solid rgba(229,231,235,.9);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
}

.composer .btn{
  white-space: nowrap;
}

/* right panel */
.rightPanel{
  display:flex;
  flex-direction: column;
  gap: 12px;
}

.rightPanel .section{
  background: #ffffff;
  border: 1px solid rgba(229,231,235,.9);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.secTitle{
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 6px;
  color: #0f172a;
}

.rightPanel .hint{
  margin-top: 0;
  margin-bottom: 10px;
}

/* list */
.rightPanel .list{
  display:flex;
  flex-direction: column;
  gap: 8px;
}

.rightPanel .item{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(229,231,235,.9);
  background: #f8fafc;
  font-size: 13px;
  color: #0f172a;
}

/* meter */
.meter{
  display:flex;
  align-items:center;
  gap: 10px;
}

.meter input[type="range"]{
  flex: 1;
}

/* classi "utility" presenti nell'HTML step 5 */
.u-053a8a7c{
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.u-5371db16{
  margin-top: 10px;
}

/* badge già esistente: lo rendiamo coerente anche in header */
.chatHeader .badge{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(229,231,235,.9);
  background: #f8fafc;
  color: #0f172a;
}

/* =========================================================
   STEP 3 — Link: griglia 2 colonne con campi uguali
   ========================================================= */

.linksGrid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); /* 2 colonne uguali */
  gap: 14px;
  align-items: start;
}

/* forziamo input full width dentro la cella */
.linksGrid > div{
  min-width: 0;
}

.linksGrid input[type="url"],
.linksGrid input[type="text"]{
  width: 100%;
  display: block;
}

/* mobile: 1 colonna */
@media (max-width: 820px){
  .linksGrid{
    grid-template-columns: 1fr;
  }
}


/* =========================================================
   STEP 4 — Upload per-slot (10 pulsanti) + styling premium
   ========================================================= */

.uploadGrid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

@media (max-width: 900px){
  .uploadGrid{ grid-template-columns: 1fr; }
}

.uploadSlot{
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.uploadSlotHead{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.uploadSlotTitle{
  font-weight: 700;
  font-size: 14px;
}

.uploadSlotMeta{
  font-size: 12px;
  opacity: .8;
  text-align: right;
  max-width: 60%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.uploadSlotActions{
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.fileInputHidden{
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* pulsante upload dedicato, più "wow" */
.btnUpload{
  appearance: none;
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: linear-gradient(180deg, rgba(59,130,246,0.12), rgba(59,130,246,0.06));
  color: #0b1b3a;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.06);
}

.btnUpload .icon{
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(59,130,246,0.16);
  font-size: 14px;
}

.btnUpload:hover{
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.10);
}

.btnUpload:active{
  transform: translateY(0px);
}

.btnUpload.ghost{
  background: transparent;
  border: 1px solid rgba(17, 24, 39, 0.12);
  box-shadow: none;
  font-weight: 600;
}

.btnUpload.ghost[disabled]{
  opacity: .45;
  cursor: not-allowed;
}