/* ==========================================================================
   ai-website-studio.css — استودیوی دو کادریِ «طراحی وب‌سایت با هوش مصنوعی»
   راست: پیش‌نمایش/کد  |  چپ: دستیار
   ========================================================================== */
.wsd-container { padding-bottom: 20px; }
.wsd-title { font-weight: 700; color: #2c3e50; font-size: 18px; margin: 6px 0 12px; }

.wsd { display: flex; flex-direction: row; gap: 12px; direction: rtl; height: calc(100vh - 210px); min-height: 580px; font-size: 13px; color: #1f2937; }
.wsd *, .wsd *::before, .wsd *::after { box-sizing: border-box; }

/* ---------- کادر راست ---------- */
.wsd-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: #fff; border: 1px solid #e2e2ee; border-radius: 14px; overflow: hidden; box-shadow: 0 4px 18px rgba(76,54,160,.08); }
.wsd-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; background: #f8fafc; border-bottom: 1px solid #e8e8f2; flex: none; }
.wsd-tabs { display: flex; gap: 4px; }
.wsd-tab { position: relative; border: 0; background: transparent; padding: 7px 16px; border-radius: 9px; font: inherit; font-weight: 700; color: #6b7280; cursor: pointer; }
.wsd-tab:hover { background: #ececf6; }
.wsd-tab.on { background: #fff; color: #4338ca; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.wsd-dot { position: absolute; top: 6px; left: 6px; width: 8px; height: 8px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.2); }
.wsd-dot[hidden] { display: none; }
.wsd-tools { display: flex; align-items: center; gap: 2px; }
.wsd-devs { display: inline-flex; gap: 2px; }
.wsd-sep { width: 1px; height: 18px; background: #dcdce8; margin: 0 6px; }
.wsd-ic { width: 32px; height: 32px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: #4b5563; }
.wsd-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wsd-ic:hover:not(:disabled) { background: #ececf6; color: #4338ca; }
.wsd-ic.on { background: #e0e7ff; color: #4338ca; }
.wsd-ic:disabled { opacity: .35; cursor: default; }

.wsd-pane { display: none; flex: 1 1 auto; min-height: 0; position: relative; }
.wsd-pane.on { display: flex; flex-direction: column; }

/* پیش‌نمایش */
.wsd-empty { margin: auto; text-align: center; color: #9ca3af; line-height: 2; }
.wsd-empty svg { fill: none; stroke: #c4b5fd; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.wsd-stage { flex: 1 1 auto; min-height: 0; background: repeating-conic-gradient(#f3f4f8 0% 25%, #fafafd 0% 50%) 50% / 20px 20px; overflow: hidden; display: flex; justify-content: center; padding: 0; contain: layout paint; }
.wsd-stage[hidden], .wsd-empty[hidden] { display: none; }
.wsd-frame { width: 100%; height: 100%; background: #fff; box-shadow: 0 0 0 1px #e5e7eb; position: relative; overflow: hidden; direction: ltr; flex: none; contain: size layout paint; }
.wsd-frame[data-dev="tablet"] { width: 820px; max-width: 100%; }
.wsd-frame[data-dev="mobile"] { width: 390px; max-width: 100%; }
.wsd-frame iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; background: #fff; display: block; transform-origin: 0 0; will-change: transform; backface-visibility: hidden; }
.wsd-busy { position: absolute; inset: 0; background: rgba(255,255,255,.78); backdrop-filter: blur(2px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: #4338ca; z-index: 3; }
.wsd-busy[hidden] { display: none; }
.wsd-bar-anim { width: 180px; height: 5px; border-radius: 4px; background: #e6defc; position: relative; overflow: hidden; }
.wsd-bar-anim::after { content: ''; position: absolute; inset: 0 60% 0 0; background: linear-gradient(90deg, #4f46e5, #00b0ff); border-radius: 4px; animation: wsdSlide 1.1s ease-in-out infinite; }
@keyframes wsdSlide { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

/* کد */
.wsd-codebar { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; background: #252526; color: #aab; font-size: 12px; flex: none; }
.wsd-switch { display: inline-flex; align-items: center; gap: 6px; margin: 0; cursor: pointer; font-weight: 400; color: #cfd2e0; }
.wsd-lines { flex: 1 1 auto; min-height: 0; overflow: auto; background: #1e1e1e; color: #d4d4d4; font: 12.5px/1.65 Consolas, 'Courier New', monospace; padding: 8px 0; }
.wsd-ln { display: flex; min-width: max-content; }
.wsd-ln .n { flex: none; width: 52px; padding: 0 10px; text-align: right; color: #6b7280; user-select: none; border-inline-end: 1px solid #2d2d30; margin-inline-end: 10px; }
.wsd-ln code { white-space: pre; font: inherit; color: inherit; background: none; padding: 0; }
.wsd-ln.chg { background: rgba(46,160,67,.22); box-shadow: inset 3px 0 0 #2ea043; }
.wsd-ln.chg .n { color: #7ee787; }
.wsd-edit { flex: 1 1 auto; min-height: 0; width: 100%; resize: none; border: 0; outline: 0; background: #1e1e1e; color: #d4d4d4; font: 12.5px/1.65 Consolas, 'Courier New', monospace; padding: 10px 14px; tab-size: 2; white-space: pre; overflow: auto; }
.wsd-edit[hidden], .wsd-lines[hidden] { display: none; }
.hc { color: #6a9955; } .ht { color: #569cd6; } .hs { color: #ce9178; } .ha { color: #9cdcfe; } .hn { color: #b5cea8; }

/* تمام‌صفحه */
.wsd-main.wsd-full { position: fixed; inset: 10px; z-index: 2147483000; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(15,12,30,.6); }

/* ---------- کادر چپ: دستیار ---------- */
.wsd-asst { flex: 0 0 380px; width: 380px; display: flex; flex-direction: column; background: #fff; border: 1px solid #e2e2ee; border-radius: 16px; overflow: hidden; box-shadow: 0 8px 28px rgba(76,54,160,.14), 0 1px 3px rgba(0,0,0,.06); }
.wsd-ah { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: linear-gradient(135deg, #4f46e5, #00b0ff); color: #fff; font-weight: 700; flex: none; }
.wsd-at { display: inline-flex; align-items: center; gap: 6px; }
.wsd-spark { flex: none; }
.wsd-badge { margin-inline-start: auto; font-size: 11px; font-weight: 400; background: rgba(255,255,255,.25); border-radius: 10px; padding: 1px 9px; white-space: nowrap; }

.wsd-msgs { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px; background: #f8fafc; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.wsd-m { max-width: 94%; }
.wsd-m.user { align-self: flex-start; }
.wsd-m.bot { align-self: flex-end; }
.wsd-m .b { padding: 8px 11px; border-radius: 10px; line-height: 1.85; word-break: break-word; }
.wsd-m.user .b { background: #185abd; color: #fff; border-end-start-radius: 2px; }
.wsd-m.bot .b { background: #fff; border: 1px solid #e0e0e0; border-end-end-radius: 2px; }
.wsd-m ul { margin: 4px 0; padding-inline-start: 18px; }
.wsd-m code { background: #f1f1f1; padding: 0 4px; border-radius: 3px; font-size: 12px; direction: ltr; unicode-bidi: embed; }

.wsd-res { display: flex; align-items: center; gap: 8px; background: #ecfdf3; border: 1px solid #b7ebc9; color: #14532d; border-radius: 10px; padding: 7px 10px; }
.wsd-ok { flex: none; width: 18px; height: 18px; border-radius: 50%; background: #16a34a; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }
.wsd-rt { flex: 1; min-width: 0; font-size: 12.5px; }
.wsd-undo { flex: none; border: 1px solid #86d0a1; background: #fff; color: #166534; border-radius: 6px; padding: 2px 9px; font: inherit; font-size: 12px; cursor: pointer; }
.wsd-undo:hover:not(:disabled) { background: #dcfce7; }
.wsd-undo:disabled { opacity: .6; cursor: default; }
.wsd-cost { margin-top: 3px; padding-inline-start: 4px; font-size: 11px; color: #6b7280; }

.wsd-cta { margin-top: 6px; padding: 9px 11px; border-radius: 12px; background: linear-gradient(135deg, #eef2ff, #e8f4ff); border: 1px solid #c7d2fe; }
.wsd-cta .s { font-size: 12px; line-height: 1.8; color: #3b2a7a; margin-bottom: 7px; }
.wsd-cta-btn { display: block; width: 100%; text-align: center; border: 0; border-radius: 9px; padding: 7px 10px; background: linear-gradient(135deg, #4f46e5, #2b7cd3); color: #fff !important; font: inherit; font-size: 13px; font-weight: 700; text-decoration: none; cursor: pointer; }
.wsd-cta-btn:hover { filter: brightness(1.08); text-decoration: none; }

.wsd-dots i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #4f46e5; margin: 0 1px; animation: wsdBounce 1s infinite; }
.wsd-dots i:nth-child(2) { animation-delay: .15s; } .wsd-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes wsdBounce { 0%, 80%, 100% { opacity: .2; transform: scale(.7); } 40% { opacity: 1; transform: scale(1.1); } }

.wsd-chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 10px; border-top: 1px solid #eee; max-height: 92px; overflow-y: auto; flex: none; }
.wsd-chip { border: 1px solid #c7d2fe; background: #eef2ff; color: #4338ca; border-radius: 14px; padding: 3px 10px; font: inherit; font-size: 11.5px; cursor: pointer; }
.wsd-chip:hover { background: #e0e7ff; }

.wsd-in { padding: 8px 10px 10px; border-top: 1px solid #e0e0e0; background: #fff; flex: none; }
.wsd-row { display: flex; gap: 6px; align-items: stretch; }
.wsd-row textarea { flex: 1; min-width: 0; resize: none; border: 1px solid #d4d4e0; border-radius: 10px; padding: 6px 9px; font: inherit; line-height: 1.7; color: #111; background: #fff; direction: rtl; }
.wsd-row textarea:focus { outline: 2px solid #4f46e5; border-color: #4f46e5; }
.wsd-send { flex: none; border: 0; border-radius: 10px; padding: 0 16px; background: linear-gradient(135deg, #185abd, #2b7cd3); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.wsd-send:disabled { opacity: .55; cursor: default; }
.wsd-foot { margin-top: 6px; font-size: 11px; color: #6b7280; }

/* ---------- تبلت و موبایل: دو کادر زیر هم ---------- */
@media (max-width: 992px) {
  .wsd { flex-direction: column; height: auto; min-height: 0; }
  .wsd-main { height: 60vh; min-height: 360px; flex: none; }
  .wsd-asst { flex: none; width: 100%; height: 520px; }
  .wsd-tab { padding: 6px 12px; }
  .wsd-sep, .wsd-devs { display: none; }
  .wsd-chips { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; max-height: none; }
  .wsd-chip { flex: none; white-space: nowrap; }
  .wsd-row textarea { font-size: 16px; }
}
@media print { .wsd-asst { display: none !important; } }

/* ---------- دستیار مرکزی: ستون دستیار داخلی مخفی و پیش‌نمایش تمام‌عرض ---------- */
.wsd--central .wsd-asst { display: none !important; }
@media (max-width: 992px) { .wsd--central .wsd-main { height: calc(100vh - 190px); min-height: 420px; } }

/* ---------- دکمه‌ی «طراحی جدید» ---------- */
.wsd-redo { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid #c7c2f0; border-radius: 9px; background: #f3f1ff; color: #4f46e5; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .15s; }
.wsd-redo svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.wsd-redo:hover:not(:disabled) { background: #e8e4ff; border-color: #a79cf0; }
.wsd-redo:active:not(:disabled) { transform: scale(.97); }
.wsd-redo:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 640px) { .wsd-redo span { display: none; } .wsd-redo { padding: 0 9px; } }

/* برچسب عرض و درصد نمایش پیش‌نمایش */
.wsd-zoom { position: absolute; bottom: 10px; left: 12px; z-index: 2; padding: 3px 10px; border-radius: 999px; background: rgba(31,41,55,.72); color: #fff; font-size: 11px; pointer-events: none; direction: rtl; }
.wsd-zoom[hidden] { display: none; }

/* دکمه‌ی سفارش */
.wsd-order { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border: 0; border-radius: 9px; background: #4f46e5; color: #fff; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap; transition: background .15s, transform .15s; }
.wsd-order svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.wsd-order:hover:not(:disabled) { background: #4338ca; }
.wsd-order:active:not(:disabled) { transform: scale(.97); }
.wsd-order:disabled { opacity: .45; cursor: not-allowed; }
.wsd-order.is-loading { opacity: .7; cursor: progress; }
@media (max-width: 640px) { .wsd-order span { display: none; } .wsd-order { padding: 0 9px; } }
/* دانلود قفل‌شده (نیاز به ورود یا اعتبار) */
.wsd-ic.wsd-lock { opacity: .5; }
.wsd-ic.wsd-lock::after { content: ""; }
/* پیام شناور ابزار */
.wsd-notice { position: fixed; z-index: 99999; bottom: 24px; left: 50%; transform: translateX(-50%); width: min(92vw, 420px); background: #1f2937; color: #fff; border-radius: 14px; padding: 14px 16px; box-shadow: 0 12px 40px rgba(0,0,0,.28); direction: rtl; font-size: 13px; line-height: 1.9; }
.wsd-notice[hidden] { display: none; }
.wsd-notice p { margin: 0 0 10px; }
.wsd-notice-act { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.wsd-notice .wsd-cta-btn { display: inline-block; padding: 5px 14px; border-radius: 8px; background: #6366f1; color: #fff; text-decoration: none; font-weight: 700; font-size: 12.5px; }
.wsd-notice-x { margin-right: auto; background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 8px; padding: 4px 12px; font: inherit; font-size: 12px; cursor: pointer; }
