/* Eatalica.AI — chatbot a schermo intero e schede prodotto (le schede servono anche alla home) */

/* ---------- schede prodotto e righe della lista (condivise) ---------- */
.b-products { display: grid; gap: 8px; }
.b-products-title { font-size: .8125rem; font-weight: 600; color: var(--muted); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pcard { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); transition: border-color .2s, transform .2s, box-shadow .2s; }
html:not(.dark) .pcard { background: #fff; }
.pcard:hover { border-color: rgba(230, 57, 70, .5); transform: translateY(-2px); box-shadow: var(--shadow); }
.pc-media { position: relative; aspect-ratio: 1 / 1; background: #fff; overflow: hidden; }
.pc-media img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.pc-media.noimg { background: linear-gradient(135deg, rgba(230, 57, 70, .25), rgba(69, 123, 157, .25)); }
.pc-badge { position: absolute; top: 8px; left: 8px; background: var(--red); color: #fff; font-size: .6875rem; font-weight: 700; padding: 2px 8px; border-radius: 9999px; }
.pc-body { padding: 10px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.pc-cat { font-size: .6875rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pc-title { font-size: .8125rem; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pc-title a:hover { color: var(--red); }
.pc-brand { font-size: .75rem; color: var(--muted); }
.pc-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; font-size: .875rem; }
.pc-price s { color: var(--muted); font-size: .75rem; }
.pc-off { font-size: .6875rem; font-weight: 700; color: var(--green); }
.pc-go { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: .75rem; font-weight: 600; color: var(--link); }
.pc-go .ic { width: 12px; height: 12px; }
.pc-go:hover { text-decoration: underline; }

.b-shop li { display: inline-flex; align-items: center; gap: 6px; }
.b-shop li .si-qty { opacity: .8; }
.b-shop li .si-qty::before { content: "· "; }
.b-shop li.has-prod { flex-wrap: wrap; }
.si-prod { display: inline-block; min-width: 0; max-width: 260px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  color: var(--link); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.si-price { color: var(--fg); font-weight: 600; white-space: nowrap; }
.as-link { text-align: left; color: inherit; text-decoration: underline; text-decoration-color: rgba(230, 57, 70, .45); text-underline-offset: 3px; }
.as-link:hover { color: var(--red); text-decoration-color: currentColor; }

/* ---------- impaginazione del chatbot ---------- */
body.chat-app { height: 100vh; height: 100dvh; overflow: hidden; display: flex; }
.chat-app .sidebar {
  width: 272px; flex: none; display: flex; flex-direction: column; gap: 12px; padding: 14px 12px;
  background: var(--surface-2); border-right: 1px solid var(--border); transition: margin-left .25s ease, transform .25s ease;
}
html:not(.dark) .chat-app .sidebar { background: #eef1f6; }
.sb-top { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; height: 40px; }
.sb-top .logo { font-size: 1.25rem; }
.sb-close { display: none; }
.new-chat { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; font-weight: 600; border: 1px solid var(--border); background: var(--bg); transition: border-color .2s, background-color .2s; }
.new-chat:hover { border-color: var(--red); }
.new-chat .ic { width: 18px; height: 18px; color: var(--red); }
.sb-list { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.sb-title { font-size: .75rem; font-weight: 600; color: var(--muted); padding: 8px 8px 6px; }
#convList li { display: flex; align-items: center; border-radius: 8px; }
#convList li:hover, #convList li.active { background: rgba(230, 57, 70, .1); }
.conv-open { flex: 1; min-width: 0; text-align: left; padding: 8px; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#convList li.active .conv-open { font-weight: 600; }
.conv-del { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); opacity: 0; flex: none; }
#convList li:hover .conv-del, #convList li.active .conv-del, .conv-del:focus-visible { opacity: 1; }
.conv-del:hover { color: var(--err); }
.conv-del .ic { width: 15px; height: 15px; }
@media (hover: none) { .conv-del { opacity: 1; } }
.sb-empty { font-size: .8125rem; color: var(--muted); padding: 4px 8px; }
.sb-foot { display: grid; gap: 4px; border-top: 1px solid var(--border); padding-top: 10px; }
.sb-cta, .sb-link { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; font-size: .875rem; }
.sb-cta { background: var(--grad); color: #fff; font-weight: 600; }
.sb-cta:hover { opacity: .92; }
.sb-link:hover { background: rgba(230, 57, 70, .1); }
.sb-cta .ic, .sb-link .ic { width: 17px; height: 17px; }

.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.chat-top { height: 56px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid transparent; }
.has-messages .chat-top { border-color: var(--border); }
.chat-name { margin: 0; line-height: 1.3; flex: 1; min-width: 0; font-size: .9375rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 4px; }
.demo-pill { font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 3px 8px; border-radius: 9999px; border: 1px solid var(--glass-border); color: var(--red); margin-right: 4px; }

.thread { flex: 1; overflow-y: auto; overscroll-behavior: contain; scroll-padding-top: 16px; }
.messages, .welcome { width: 100%; max-width: 780px; margin: 0 auto; padding: 0 20px; }
.messages { padding-bottom: 24px; display: flex; flex-direction: column; gap: 22px; padding-top: 20px; }

.welcome { padding-top: 7vh; padding-bottom: 24px; text-align: center; }
.welcome-mark { width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 16px; display: grid; place-items: center; background: var(--grad); color: #fff; box-shadow: 0 10px 30px -10px var(--red); }
.welcome-mark .ic { width: 28px; height: 28px; }
.welcome h2 { font-size: 1.75rem; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; margin-bottom: 10px; }
.welcome > .muted { max-width: 520px; margin: 0 auto 26px; }
.cats { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; margin-bottom: 14px; scrollbar-width: none; justify-content: flex-start; }
.cats::-webkit-scrollbar { display: none; }
@media (min-width: 760px) { .cats { flex-wrap: wrap; justify-content: center; overflow: visible; } }
.cat { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9999px; border: 1px solid var(--border); font-size: .8125rem; font-weight: 600; white-space: nowrap; transition: border-color .2s, background-color .2s, color .2s; }
.cat .ic { width: 15px; height: 15px; color: var(--red); }
.cat:hover { border-color: var(--red); }
.cat[aria-selected="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.cat[aria-selected="true"] .ic { color: #fff; }
.examples { display: grid; grid-template-columns: 1fr; gap: 10px; text-align: left; }
@media (min-width: 560px) { .examples { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .examples { grid-template-columns: 1fr 1fr 1fr; } }
.ex-card { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--glass); text-align: left; transition: border-color .2s, transform .2s, box-shadow .2s; }
.ex-card:hover { border-color: rgba(230, 57, 70, .6); transform: translateY(-2px); box-shadow: var(--shadow); }
.ex-title { font-weight: 600; font-size: .9375rem; }
.ex-prompt { font-size: .8125rem; color: var(--muted); }

/* messaggi */
.cmsg { display: flex; gap: 12px; animation: fadeIn .25s both; }
.cmsg.user { justify-content: flex-end; }
.cbubble { max-width: 85%; background: var(--surface-2); border: 1px solid var(--border); padding: 10px 14px; border-radius: 18px 18px 4px 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
html:not(.dark) .cbubble { background: #e9edf3; }
.cav { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--grad); color: #fff; margin-top: 2px; }
.cav .ic { width: 16px; height: 16px; }
.cbody { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; font-size: .9375rem; line-height: 1.6; }
.cbody .b-recipes, .cbody .b-list, .cbody .b-menu, .cbody .b-shop { font-size: .875rem; }
.cbody .b-menu { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.cbody .b-menu .day { padding: 10px 12px; }
.cbody .b-shop, .cbody .b-shop ul { grid-template-columns: minmax(0, 1fr); }
.cbody .b-shop ul { display: grid; gap: 4px; }
.cbody .b-shop li { background: none; color: inherit; padding: 2px 0; border-radius: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; border-bottom: 1px dashed var(--border); }
.cbody .b-shop li:last-child { border-bottom: 0; }
.cbody .b-shop li .si-name { font-weight: 500; }
.cbody .b-shop li .si-qty { color: var(--muted); }
.cbody .b-shop li .si-prod { margin-left: auto; font-size: .8125rem; max-width: calc(100% - 70px); }
.cbody .b-shop li .si-price { font-size: .8125rem; }
.cbody .b-shop h4 { margin-bottom: 6px; color: var(--red); }
.cbody .b-note { font-size: .8125rem; }
.cbody .pgrid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.cactions { display: flex; gap: 4px; margin-top: -4px; }
.cact { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 6px; font-size: .75rem; color: var(--muted); }
.cact:hover { background: var(--surface-2); color: var(--fg); }
.cact .ic { width: 14px; height: 14px; }
.csugg { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 42px; margin-top: -8px; }
.csugg-btn { padding: 7px 12px; border-radius: 9999px; border: 1px solid var(--glass-border); font-size: .8125rem; text-align: left; transition: background-color .2s, border-color .2s; }
.csugg-btn:hover { border-color: var(--red); background: rgba(230, 57, 70, .08); }
.typing-row { align-items: center; }

/* composer */
.composer-wrap { flex: none; padding: 8px 20px calc(10px + env(safe-area-inset-bottom)); width: 100%; max-width: 820px; margin: 0 auto; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 10px 10px 16px; border-radius: 22px; border: 1px solid var(--border); background: var(--input); box-shadow: 0 8px 30px -14px rgba(0, 0, 0, .45); transition: border-color .2s, box-shadow .2s; }
.composer:focus-within { border-color: rgba(230, 57, 70, .7); box-shadow: 0 0 0 3px rgba(230, 57, 70, .15), 0 8px 30px -14px rgba(0, 0, 0, .45); }
.composer textarea { flex: 1; resize: none; border: 0; background: transparent; outline: none; font: inherit; font-size: 1rem; line-height: 1.5; max-height: 220px; padding: 6px 0; color: var(--fg); }
.composer textarea::placeholder { color: var(--muted); }
.composer-actions { display: flex; align-items: center; gap: 6px; }
.counter { font-size: .75rem; color: var(--muted); }
.mic { width: 36px; height: 36px; color: var(--muted); }
.mic[aria-pressed="true"] { background: var(--red); color: #fff; }
.send-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; transition: opacity .2s, transform .2s; }
.send-btn:not([disabled]):hover { transform: scale(1.06); }
.send-btn[disabled] { opacity: .35; cursor: not-allowed; }
.send-btn .ic { width: 18px; height: 18px; stroke-width: 2.4; }
.disclaimer { font-size: .6875rem; color: var(--muted); text-align: center; margin-top: 8px; }

/* desktop: barra comprimibile */
@media (min-width: 900px) {
  body.sb-collapsed .sidebar { margin-left: -272px; }
}
/* mobile: barra a scomparsa */
@media (max-width: 899px) {
  .chat-app .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; transform: translateX(-100%); box-shadow: 0 0 40px rgba(0, 0, 0, .4); background: var(--bg); }
  body.sb-open .sidebar { transform: none; }
  .sb-close { display: inline-grid; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 55; }
  .welcome { padding-top: 4vh; }
  .welcome h2 { font-size: 1.5rem; }
  .messages, .welcome { padding: 0 14px; }
  .messages { padding-top: 16px; }
  .composer-wrap { padding-left: 12px; padding-right: 12px; }
  .cbubble { max-width: 90%; }
  .csugg { padding-left: 0; }
  .demo-pill { display: none; }
}
@media (max-width: 420px) {
  .cav { display: none; }
  .cbody .pgrid { grid-template-columns: 1fr 1fr; }
}
