/* Danimoode Smart Quiz styles - cute, RTL, pastel */
:root { --dm-primary:#6c7cff; --dm-accent:#ffd166; --dm-bg:#f9fafc; --dm-text:#1e293b; --dm-soft:#eef2ff }
.danimood-quiz { font-family: Vazirmatn, Shabnam, system-ui, -apple-system, Segoe UI, roboto, sans-serif; direction: rtl; }
.dm-card { background:#fff; border:1px solid #eef2ff; border-radius:18px; box-shadow:0 20px 50px rgba(30,41,59,.08); max-width:860px; margin:24px auto; overflow:hidden }
.dm-header { padding:24px; background:linear-gradient(180deg,#f6f8ff,transparent) }
.dm-badge { display:inline-block; background:var(--dm-soft); color:#4f46e5; padding:6px 10px; border-radius:999px; font-weight:700; font-size:.85rem }
.dm-title { margin:8px 0 4px; color:var(--dm-text); font-size:1.4rem }
.dm-sub { margin:0; color:#64748b }
.dm-body { padding:24px }
.dm-footer { padding:16px 24px; background:#fafbff; border-top:1px solid #eef2ff; text-align:center }

/* Form elements */
.dm-row { display:grid; gap:14px; grid-template-columns:1fr; }
@media (min-width:640px){ .dm-row{ grid-template-columns:1fr 1fr } }
.dm-field { display:flex; flex-direction:column; gap:8px }
.dm-label { font-weight:600; color:#334155 }
.dm-input, .dm-select { border:1px solid #e5e7eb; border-radius:12px; padding:12px 14px; font-size:1rem }
.dm-radio-group { display:flex; gap:10px; flex-wrap:wrap }
.dm-radio { border:1px solid #e5e7eb; border-radius:12px; padding:10px 14px; cursor:pointer; background:#fff }
.dm-radio input{ display:none }
.dm-radio.active, .dm-option.active{ border-color:#a5b4fc; background:#f8f9ff }

/* Quiz options */
.dm-question { margin:14px 0 }
.dm-q-title { font-weight:700; color:#27364a; margin-bottom:10px }
.dm-options { display:grid; gap:10px; grid-template-columns:1fr 1fr }
.dm-option { border:1px solid #e5e7eb; border-radius:12px; padding:12px; cursor:pointer; text-align:center }

/* Buttons */
.dm-actions { display:flex; gap:10px; justify-content:space-between; margin-top:18px }
.dm-btn { border:0; border-radius:12px; padding:12px 16px; cursor:pointer; font-weight:700 }
.dm-primary { background:var(--dm-primary); color:#fff; box-shadow:0 10px 25px rgba(79,70,229,.25) }
.dm-secondary { background:#edf2ff; color:#3730a3 }

/* Result */
.dm-result { border:1px solid #e9ecff; border-radius:16px; padding:16px; background:#fcfdff }
.dm-typing { white-space:pre-line; min-height:72px; line-height:1.9 }

/* Product grid */
.dm-products { margin-top:16px; display:grid; gap:14px; grid-template-columns:repeat(1, minmax(0,1fr)) }
@media (min-width:560px){ .dm-products{ grid-template-columns:repeat(2, minmax(0,1fr)) } }
@media (min-width:900px){ .dm-products{ grid-template-columns:repeat(3, minmax(0,1fr)) } }
.dm-product { border:1px solid #eef2ff; border-radius:14px; background:#fff; overflow:hidden }
.dm-product img{ width:100%; height:220px; object-fit:cover }
.dm-product .dm-p-body{ padding:10px }
.dm-product .dm-title{ font-size:.98rem; margin:0 0 6px }
.dm-price{ color:#16a34a; font-weight:700 }

.dm-subtitle{ font-weight:800; margin:12px 0; color:#243b55 }
.dm-products-grid{ display:grid; gap:12px; grid-template-columns:repeat(1, minmax(0,1fr)); }
@media (min-width:700px){ .dm-products-grid{ grid-template-columns:repeat(3, minmax(0,1fr)) } }
.dm-product.compact img{ height:120px }
.dm-product.compact .dm-p-body{ padding:8px }

/* Chat styles */
.dm-chat { display:flex; flex-direction:column; gap:12px }
.dm-chat-inner{ max-height:420px; overflow:auto; padding:12px; display:flex; flex-direction:column; gap:10px; background:linear-gradient(180deg,#fbfdff,#f7fbff); border-radius:12px; border:1px solid #eef6ff }
.dm-bubble{ display:flex; gap:10px; align-items:flex-end }
.dm-bubble .dm-avatar{ width:38px; height:38px; display:flex; align-items:center; justify-content:center; border-radius:999px; background:#fff; box-shadow:0 6px 18px rgba(30,41,59,.06) }
.dm-bubble-content{ background:#fff; padding:10px 12px; border-radius:12px; box-shadow:0 10px 30px rgba(15,23,42,.04); max-width:75% }
.dm-ai{ flex-direction:row }
.dm-ai .dm-bubble-content{ background:linear-gradient(90deg,#fff,#f8fbff); direction:rtl }
.dm-user{ align-self:flex-end; flex-direction:row-reverse }
.dm-user .dm-bubble-content{ background:linear-gradient(90deg,#ffeecb,#fff); }
.dm-chat-options{ display:flex; gap:8px; flex-wrap:wrap; margin-top:8px }
.dm-typing-small{ color:#374151; min-height:30px }

/* Assistant-focused result styling (ChatGPT-like) */
.dm-bubble.dm-ai { align-items:flex-start; }
.dm-bubble.dm-ai .dm-avatar{ background:linear-gradient(135deg,var(--dm-primary),#9f8bff); color:#fff; font-weight:700 }
.dm-bubble.dm-ai .dm-bubble-content{ background:linear-gradient(180deg,#ffffff,#f6f8ff); border-radius:16px; padding:14px; box-shadow:0 8px 28px rgba(15,23,42,0.06); }
.assistant-section{ margin-bottom:8px }
.assistant-body{ margin-top:8px; color:var(--dm-text); line-height:1.8 }

/* Product attachment card inside assistant bubble */
.assistant-attachments{ display:flex; gap:10px; flex-wrap:wrap; margin-top:10px }
.assistant-attachment{ display:flex; gap:10px; align-items:center; padding:8px; border-radius:12px; background:#fff; border:1px solid #eef6ff; box-shadow:0 6px 18px rgba(15,23,42,0.03); min-width:220px }
.assistant-attachment img{ width:64px; height:64px; object-fit:cover; border-radius:8px }
.assistant-attachment .attach-body{ display:flex; flex-direction:column }
.assistant-attachment .attach-title{ font-weight:700; font-size:.95rem }
.assistant-attachment .attach-price{ color:#16a34a; font-weight:700 }

/* Ensure products injected inside assistant have proper grid fallback */
#dm-products-merged-attach .dm-products{ display:flex; gap:10px; flex-wrap:wrap }
#dm-products-merged-attach .dm-product{ width:220px }
