/*! UpSEO - سایدبار یکپارچه (دستیار هوش مصنوعی + ابزارها)
    بعد از sidebar.css لود می شود و با انتخابگر #upseoSidebar آن را بازنویسی می کند.
    پس از ویرایش، مقدار ?v= را در sidebar.php تغییر دهید. */

/* ---------- قالب کلی ---------- */
#upseoSidebar.up-sb-unified{
  width:330px!important;min-width:330px!important;max-width:330px!important;padding:0!important;
  background:linear-gradient(180deg,#f3f1ff 0%,#ebe8ff 100%)!important;border-left:1px solid #ddd9ff!important;
  position:fixed!important;top:0!important;right:0!important;bottom:0!important;height:auto!important;z-index:9000!important;
  display:flex!important;flex-direction:column!important;justify-content:flex-start!important;overflow:visible!important;
  font-family:'YekanBakh FaNum','Vazirmatn','IRANSans',Tahoma,sans-serif;color:#1e1b4b;
}
#upseoSidebar.up-sb-unified.collapsed{width:70px!important;min-width:70px!important;max-width:70px!important}
#upseoSidebar .up-sb-head{
  flex:none;color:#fff;padding:12px 12px 10px;text-align:center;
  background:radial-gradient(120% 100% at 50% 0,#6d5dfc 0,#4338ca 70%,#3730a3 100%);
}
#upseoSidebar .up-sb-scroll{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;padding:12px 12px 6px;scroll-behavior:smooth}
#upseoSidebar .up-sb-scroll::-webkit-scrollbar{width:6px}
#upseoSidebar .up-sb-scroll::-webkit-scrollbar-thumb{background:#c9c4ff;border-radius:6px}
#upseoSidebar .up-sb-foot{flex:none}
#upseoSidebar .up-sb-foot:empty{display:none}
.up-sb-ai-only{display:none!important}
html.up-copilot-embedded .up-sb-ai-only{display:inline-flex!important}

/* ---------- ردیف بالا: لوگو و دکمه ها ---------- */
#upseoSidebar .up-sb-top{display:flex;align-items:center;justify-content:space-between;gap:8px}
#upseoSidebar .up-sb-logo{display:flex;align-items:center;background:#fff;border-radius:10px;padding:3px 9px}
#upseoSidebar .up-sb-logo img{display:block;height:30px;width:auto}
#upseoSidebar .up-sb-btns{display:flex;gap:6px}
#upseoSidebar .up-sb-btn{width:32px;height:32px;border-radius:10px;border:0;background:rgba(255,255,255,.18);color:#fff;align-items:center;justify-content:center;cursor:pointer;padding:0;display:inline-flex}
#upseoSidebar .up-sb-btn:hover{background:rgba(255,255,255,.3)}
#upseoSidebar .up-sb-btn svg{width:16px;height:16px}
#upseoSidebar .up-sb-btn .ic-chat{display:none}
#upSbList,#upSbNew{display:none!important}
html.up-copilot-embedded #upseoSidebar.is-chat #upSbList{display:inline-flex!important}
html.up-copilot-embedded #upseoSidebar #upSbNew{display:inline-flex!important}
#upseoSidebar.show-tools #upSbList .ic-list{display:none}
#upseoSidebar.show-tools #upSbList .ic-chat{display:block}

/* ---------- کارت فشرده ی حساب کاربری (یک ردیف) ---------- */
#upseoSidebar .up-sb-acc{display:flex;align-items:center;gap:6px;margin:8px 0 0;padding:4px 6px;background:rgba(255,255,255,.14);border:1px solid rgba(255,255,255,.22);border-radius:12px;text-align:right}
#upseoSidebar .up-sb-av{width:26px;height:26px;border-radius:50%;background:#fff;color:#4f46e5!important;display:grid;place-items:center;font-weight:800;font-size:13px;text-decoration:none!important;flex:none}
#upseoSidebar .up-sb-nm{flex:1;min-width:0;font-weight:800;font-size:12.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#upseoSidebar .up-sb-cv{font-size:12px;white-space:nowrap;flex:none}
#upseoSidebar .up-sb-cv b{font-size:13.5px}
#upseoSidebar .up-sb-add{display:flex;align-items:center;gap:4px;background:#fff;color:#4f46e5!important;font-weight:800;font-size:11.5px;border-radius:9px;padding:3px 9px;text-decoration:none!important;white-space:nowrap;flex:none;box-shadow:0 2px 6px rgba(0,0,0,.2)}
#upseoSidebar .up-sb-add:hover{background:#eeecff}
#upseoSidebar .up-sb-add b{background:#4f46e5;color:#fff;border-radius:5px;width:15px;height:15px;display:grid;place-items:center;line-height:1;font-size:12px}
#upseoSidebar .up-sb-out{width:24px;height:24px;border-radius:8px;display:grid;place-items:center;color:#fff!important;flex:none}
#upseoSidebar .up-sb-out:hover{background:rgba(255,255,255,.2)}
#upseoSidebar .up-sb-out svg{width:15px;height:15px}
#upseoSidebar .up-sb-acc--guest{justify-content:space-between}
#upseoSidebar .up-sb-login{flex:1;text-align:center;color:#fff!important;font-weight:800;font-size:12.5px;text-decoration:none!important;padding:3px 6px}

/* ---------- ربات و عنوان (با جاوااسکریپت وارد می شود) ---------- */
#upseoSidebar .up-sb-hero:empty{display:none}
#upseoSidebar .up-sb-hero{padding-top:2px}
#upseoSidebar .up-sb-hero .cp-hero{padding:0}
#upseoSidebar .up-sb-hero svg.cp-robot{width:104px;height:104px;margin:0 auto;display:block;filter:drop-shadow(0 10px 18px rgba(0,0,0,.25));animation:cp-float 4s ease-in-out infinite}
#upseoSidebar .up-sb-hero h2{margin:0;font-size:16px;font-weight:800;color:#fff}
#upseoSidebar .up-sb-hero p{margin:0;font-size:12.5px;opacity:.85}
#upseoSidebar.is-chat .up-sb-hero{display:none}
@keyframes cp-float{50%{transform:translateY(-5px)}}

/* ---------- بدنه: دستیار + ابزارها ---------- */
#upSbAi .cp-body{overflow:visible;padding:0;flex:none}
#upSbAi .cp-or{display:none}
#upSbAi .cp-quick button{padding:7px 14px;font-size:13.5px}
#upSbAi .cp-quick button svg{width:22px;height:22px}
#upSbAi .cp-quick::before{content:"از دستیار بخواهید";display:block;font-size:12px;font-weight:800;color:#6b67a8;margin:2px 4px 2px}
#upSbAi .cp-quick{margin-bottom:2px}
#upSbAi .cp-ctx-chip{display:none;margin:0 0 8px;font-size:11.5px;padding:2px 10px;border-radius:999px;background:#eeecff;color:#4f46e5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#upseoSidebar.is-chat #upSbAi .cp-ctx-chip.has{display:block}
#upseoSidebar .upseo-sidebar-body{display:block;flex:none}
#upseoSidebar .upseo-sidebar-body::before{content:"ابزارهای آپسئو";display:block;font-size:12px;font-weight:800;color:#6b67a8;margin:12px 4px 6px}
#upseoSidebar .upseo-sidebar-menu{padding:0!important;margin:0!important}
#upseoSidebar .upseo-sidebar-item{margin-bottom:7px!important}
/* حین گفتگو، فهرست ابزارها فقط به صورت بصری کنار می رود (در HTML و DOM می ماند) و با دکمه ی ☰ دوباره دیده می شود */
#upseoSidebar.is-chat:not(.show-tools) .upseo-sidebar-body,
#upseoSidebar.is-chat:not(.show-tools) .upseo-sidebar-footer{display:none}
#upseoSidebar.is-chat.show-tools #upSbAi{display:none}
#upseoSidebar.up-sb-unified .upseo-sidebar-footer{margin:0!important;padding:0!important;border:0!important;background:transparent!important}
html.up-copilot-embedded #upseoSidebar .up-sb-phone{display:none}

/* ابزارها به صورت دکمه های گرد مثل دکمه های دستیار */
#upseoSidebar.up-sb-unified:not(.collapsed) .upseo-sidebar-link{
  background:rgba(255,255,255,.85)!important;border:1px solid #fff!important;border-radius:999px!important;
  padding:8px 14px!important;gap:10px!important;color:#1e1b4b!important;font-weight:700!important;font-size:13.5px!important;
  box-shadow:0 3px 10px rgba(79,70,229,.08)!important;white-space:normal!important;
}
#upseoSidebar.up-sb-unified:not(.collapsed) .upseo-sidebar-link:hover,
#upseoSidebar.up-sb-unified:not(.collapsed) .upseo-sidebar-item.active .upseo-sidebar-link{
  background:#fff!important;border:1px solid #6d5dfc!important;color:#4f46e5!important;
  box-shadow:0 6px 16px rgba(79,70,229,.16)!important;
}
#upseoSidebar.up-sb-unified .upseo-sidebar-icon{color:#4f46e5!important;stroke:#4f46e5!important;width:20px!important;flex:none}

/* ---------- پایین: کادر پرسش (از cp-foot) ---------- */
#upseoSidebar .cp-foot{padding:8px 12px 10px;background:rgba(255,255,255,.35)}
#upseoSidebar .cp-meta{padding:4px 4px 0;font-size:11.5px}

/* ---------- حالت جمع شده (ستون باریک) ---------- */
#upseoSidebar.collapsed .up-sb-head{background:transparent;color:#4f46e5;padding:10px 0 6px}
#upseoSidebar.collapsed .up-sb-top,#upseoSidebar.collapsed .up-sb-hero,#upseoSidebar.collapsed .up-sb-nm,
#upseoSidebar.collapsed .up-sb-add span,#upseoSidebar.collapsed .up-sb-out,#upseoSidebar.collapsed .up-sb-login span,
#upseoSidebar.collapsed .up-sb-coin,#upseoSidebar.collapsed #upSbAi,#upseoSidebar.collapsed .up-sb-foot,
#upseoSidebar.collapsed .upseo-sidebar-body::before,#upseoSidebar.collapsed .up-sb-phone{display:none!important}
#upseoSidebar.collapsed .up-sb-acc{flex-direction:column;gap:4px;padding:6px 0;background:transparent;border:0}
#upseoSidebar.collapsed .up-sb-cv{color:#4f46e5;font-weight:800}
#upseoSidebar.collapsed .up-sb-av{background:#4f46e5;color:#fff!important}
#upseoSidebar.collapsed .up-sb-add{padding:2px;background:transparent;box-shadow:none}
#upseoSidebar.collapsed .up-sb-login{background:#4f46e5;border-radius:10px;padding:8px 0;width:44px;font-size:0}
#upseoSidebar.collapsed .up-sb-login::before{content:"↪";font-size:16px}
#upseoSidebar .up-sb-railai{display:none!important;width:46px;height:46px;margin:6px auto 0;border-radius:50%;border:0;background:linear-gradient(135deg,#4f46e5,#6d5dfc);align-items:center;justify-content:center;cursor:pointer;position:relative;padding:0}
html.up-copilot-embedded #upseoSidebar.collapsed .up-sb-railai{display:inline-flex!important}
#upseoSidebar .up-sb-railai::after{content:"";position:absolute;top:2px;left:2px;width:10px;height:10px;border-radius:50%;background:#16a34a;border:2px solid #fff}
#upseoSidebar.collapsed .up-sb-scroll{padding:6px 0}
#upseoSidebar.collapsed .upseo-sidebar-item{margin-bottom:4px!important}

/* ---------- دکمه ی دستیار در نوار بالای موبایل ---------- */
.up-app-topbar__ai{display:none;align-items:center;justify-content:center;flex:none;width:38px;height:38px;border:0;border-radius:10px;background:linear-gradient(135deg,#4f46e5,#6d5dfc);cursor:pointer;padding:0}
@media (max-width:1150px){
  html.up-copilot-embedded .up-app-topbar__ai{display:inline-flex}
  #upseoSidebar.up-sb-unified{
    position:fixed!important;top:0!important;bottom:0!important;right:-380px!important;
    width:330px!important;min-width:0!important;max-width:92vw!important;height:100vh!important;height:100dvh!important;
    box-shadow:-4px 0 20px rgba(0,0,0,.15)!important;transition:right .3s ease!important;z-index:100070!important;overflow:visible!important;
  }
  #upseoSidebar.up-sb-unified.mobile-open{right:0!important}
  #upseoSidebar .up-sb-scroll{-webkit-overflow-scrolling:touch}
  #upseoSidebar #upSbCollapse{display:none}
  #upseoSidebar .upseo-toggle-btn{display:none!important}
  #upseoSidebar .up-sb-head{padding-top:max(12px,env(safe-area-inset-top,0px))}
  #upseoSidebar .up-sb-foot{padding-bottom:env(safe-area-inset-bottom,0px)}
  #upseoSidebar .upseo-sidebar-text,#upseoSidebar .up-sb-nm,#upseoSidebar .up-sb-add span{display:inline!important}
}
@media (prefers-reduced-motion:reduce){#upseoSidebar .up-sb-hero svg.cp-robot{animation:none}}

/* ---------- متغیرها و قاعده های ویجت دستیار برای عناصری که داخل سایدبار می نشینند ---------- */
#upseoSidebar{--cp-1:#4f46e5;--cp-2:#6d5dfc;--cp-3:#8b7cff;--cp-ink:#1e1b4b;--cp-soft:#eeecff;--cp-line:#ddd9ff}
#upSbAi,#upSbAi *,#upSbFoot,#upSbFoot *,#upSbHero,#upSbHero *{box-sizing:border-box}
#upseoSidebar button{font-family:inherit}
#upseoSidebar.is-chat .cp-qrow.has{display:flex}
#upSbFoot .cp-input{min-height:38px;height:38px}

/* ---------- سایدبار ثابت (دسکتاپ): همیشه کنار صفحه می ماند و صفحه به اندازه ی آن حاشیه می گیرد ---------- */
html.up-has-sb{--up-sb-w:330px}
html.up-has-sb.up-sb-collapsed{--up-sb-w:70px}
@media (min-width:1151px){
  html.up-has-sb body{padding-right:var(--up-sb-w);transition:padding-right .3s ease}
}
@media print{#upseoSidebar,.up-sb-fab{display:none!important}html.up-has-sb body{padding-right:0!important}}

/* ---------- هدر اصلی و نوار بالا حذف شده اند: فاصله ی بالای صفحه صفر و دکمه ی شناور موبایل ---------- */
body.up-home,body.up-app{padding-top:0!important}
.up-sb-fab{display:none}
.up-sb-fab .fab-ai{display:none}
html.up-copilot-embedded .up-sb-fab .fab-ai{display:block}
html.up-copilot-embedded .up-sb-fab .fab-menu{display:none}
@media (max-width:1150px){
  .up-sb-fab{display:inline-flex;align-items:center;justify-content:center;position:fixed;top:max(12px,env(safe-area-inset-top,0px));right:12px;width:46px;height:46px;padding:0;border:0;border-radius:50%;background:linear-gradient(135deg,#4f46e5,#6d5dfc);color:#fff;box-shadow:0 6px 18px rgba(79,70,229,.4);z-index:9500;cursor:pointer}
  html.up-copilot-embedded .up-sb-fab::after{content:"";position:absolute;top:2px;left:2px;width:10px;height:10px;border-radius:50%;background:#16a34a;border:2px solid #fff}
  body.up-embed .up-sb-fab{display:none}
}

/* دکمه ی بیرون از کادر حذف شد؛ در حالت جمع شده، دکمه ی باز کردن بالای ستون باریک است */
.upseo-toggle-btn{display:none!important}
#upseoSidebar .up-sb-expand{display:none}
#upseoSidebar.collapsed .up-sb-expand{display:flex;width:34px;height:34px;margin:0 auto 6px;border-radius:10px;border:0;background:#4f46e5;color:#fff;align-items:center;justify-content:center;cursor:pointer;padding:0}
#upseoSidebar.collapsed .up-sb-expand svg{width:16px;height:16px}
@media (max-width:1150px){#upseoSidebar .up-sb-expand{display:none!important}}
