/* Tabriz Sport Suite 0.3.0 – ظاهر مشکی، قرمز و سفید */
.tss-root, .tss-lightbox {
  --tss-red: #d0151b;
  --tss-red-dark: #a80f14;
  --tss-black: #111;
  --tss-gray: #f3f3f3;
  --tss-line: #e3e3e3;
}
.tss-root, .tss-root * { box-sizing: border-box; }
.tss-root { font-family: inherit; font-size: 15px; line-height: 1.7; color: #222; direction: rtl; text-align: right; }
.tss-root [hidden] { display: none !important; }
.tss-root button, .tss-root input, .tss-root textarea { font: inherit; }
.tss-icon { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.tss-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- دکمه‌ها و فرم‌ها ---------- */
.tss-root .tss-btn { border: 0; border-radius: 10px; padding: 11px 18px; cursor: pointer; background: var(--tss-black); color: #fff; font-weight: 600; }
.tss-root .tss-btn.tss-primary { background: var(--tss-red); }
.tss-root .tss-btn.tss-primary:hover { background: var(--tss-red-dark); }
.tss-root .tss-btn.tss-link { background: transparent; color: var(--tss-red); padding: 6px 8px; font-weight: 500; }
.tss-root .tss-btn.tss-link:hover { text-decoration: underline; }
.tss-root .tss-btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.tss-root .tss-btn:disabled, .tss-root .tss-send:disabled { opacity: .55; cursor: not-allowed; }
.tss-form { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.tss-field { display: flex; flex-direction: column; gap: 5px; font-size: 14px; font-weight: 600; }
.tss-root input[type=text], .tss-root input[type=tel], .tss-root textarea.tss-input, .tss-form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #cfcfcf; border-radius: 10px; background: #fff; color: #111; font-size: 16px; font-weight: 400;
}
.tss-root input:focus, .tss-root textarea:focus { outline: 2px solid var(--tss-red); outline-offset: 0; border-color: var(--tss-red); }
.tss-hint { margin: 0; color: #666; font-size: 13px; }
.tss-notice { min-height: 1.2em; font-size: 13px; color: #333; white-space: pre-line; }
.tss-notice.tss-err { color: var(--tss-red); font-weight: 600; }
.tss-links { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 14px; }
.tss-loading { padding: 18px; text-align: center; color: #777; }
.tss-attach-row { display: flex; align-items: center; gap: 8px; }
.tss-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.tss-root .tss-attach { border: 1px solid var(--tss-line); background: #fff; color: var(--tss-black); border-radius: 10px; width: 42px; height: 42px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.tss-root .tss-attach:hover { border-color: var(--tss-red); color: var(--tss-red); }
.tss-preview { position: relative; display: inline-block; max-width: 140px; margin: 6px 0; }
.tss-preview img { display: block; max-width: 140px; max-height: 110px; border-radius: 8px; border: 1px solid var(--tss-line); }
.tss-root .tss-preview-x { position: absolute; top: -8px; left: -8px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--tss-black); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.tss-root .tss-preview-x svg { width: 14px; height: 14px; }

/* ---------- وضعیت‌ها ---------- */
.tss-badge { display: inline-block; padding: 1px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; background: var(--tss-gray); color: #333; }
.tss-badge-open { background: #fde8e9; color: var(--tss-red-dark); }
.tss-badge-in_progress { background: #111; color: #fff; }
.tss-badge-closed { background: #e6e6e6; color: #555; }
.tss-tag { display: inline-block; padding: 1px 9px; border-radius: 20px; font-size: 12px; background: var(--tss-red); color: #fff; }

/* ---------- فهرست گفت‌وگوها ---------- */
.tss-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--tss-line); }
.tss-head-actions { display: flex; gap: 4px; align-items: center; }
.tss-list { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; max-height: 420px; overflow: auto; }
.tss-root .tss-item { display: flex; flex-direction: column; gap: 3px; text-align: right; width: 100%; padding: 10px 12px; border: 1px solid var(--tss-line); border-right: 4px solid var(--tss-red); border-radius: 10px; background: #fff; color: #111; cursor: pointer; }
.tss-root .tss-item:hover { background: var(--tss-gray); }
.tss-item-title { font-weight: 700; }
.tss-item-meta { font-size: 12px; color: #777; }
.tss-item-tags { display: flex; gap: 6px; }

/* ---------- چت ---------- */
.tss-chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.tss-chat-head { border-bottom: 1px solid var(--tss-line); padding: 8px 10px; background: #fff; }
.tss-chat-head-row { display: flex; align-items: center; gap: 6px; }
.tss-chat-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tss-chat-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tss-thread { flex: 1; min-height: 160px; overflow-y: auto; padding: 12px; background: var(--tss-gray); display: flex; flex-direction: column; gap: 8px; }
.tss-bubble { max-width: 84%; padding: 8px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--tss-line); word-break: break-word; }
.tss-bubble.tss-me { align-self: flex-start; background: var(--tss-black); color: #fff; border-color: var(--tss-black); border-bottom-right-radius: 4px; }
.tss-bubble.tss-them { align-self: flex-end; border-bottom-left-radius: 4px; border-right: 3px solid var(--tss-red); }
.tss-who { font-size: 11px; opacity: .7; font-weight: 700; }
.tss-text { white-space: pre-wrap; }
.tss-time { font-size: 11px; opacity: .6; margin-top: 2px; }
.tss-imgbox { margin: 6px 0 2px; }
.tss-imgload, .tss-imgerr { font-size: 12px; opacity: .7; }
.tss-root .tss-imgbtn { border: 0; padding: 0; background: none; cursor: zoom-in; display: block; }
.tss-imgbtn img { display: block; max-width: 220px; max-height: 200px; width: auto; height: auto; border-radius: 10px; }
.tss-chat-foot { border-top: 1px solid var(--tss-line); background: #fff; padding: 8px 10px; }
.tss-composer { display: flex; flex-direction: column; gap: 4px; }
.tss-composer-row { display: flex; align-items: flex-end; gap: 6px; }
.tss-root textarea.tss-input { resize: none; max-height: 120px; min-height: 42px; padding: 9px 12px; }
.tss-root .tss-send { flex: none; width: 42px; height: 42px; border: 0; border-radius: 10px; background: var(--tss-red); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.tss-root .tss-send:hover { background: var(--tss-red-dark); }
.tss-closed { text-align: center; padding: 6px 4px; }
.tss-closed p { margin: 0 0 8px; font-weight: 600; color: var(--tss-black); }

/* ---------- نمایش در برگه ---------- */
.tss-page { max-width: 720px; margin: 24px auto; border: 1px solid var(--tss-line); border-radius: 16px; background: #fff; overflow: hidden; }
.tss-page-head { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; background: var(--tss-black); color: #fff; border-bottom: 4px solid var(--tss-red); }
.tss-page-head strong { font-size: 20px; }
.tss-page-head span { color: #ccc; font-size: 14px; }
.tss-page .tss-thread { max-height: 60vh; }
.tss-page .tss-chat { height: auto; }
.tss-channels { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 16px; }
.tss-channels a { border: 1px solid var(--tss-red); color: var(--tss-red-dark); border-radius: 8px; padding: 6px 12px; text-decoration: none; font-size: 14px; }

/* ---------- پنجره شناور ---------- */
.tss-widget { position: fixed; bottom: 18px; z-index: 99990; }
.tss-widget.tss-pos-left { left: 18px; }
.tss-widget.tss-pos-right { right: 18px; }
.tss-root .tss-fab { width: 58px; height: 58px; border-radius: 50%; border: 3px solid #fff; background: var(--tss-red); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 22px rgba(0,0,0,.35); padding: 0; }
.tss-root .tss-fab:hover { background: var(--tss-red-dark); }
.tss-panel { position: absolute; bottom: 74px; width: 360px; height: min(580px, calc(100vh - 110px)); background: #fff; border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.35); border: 1px solid #000; }
.tss-pos-left .tss-panel { left: 0; }
.tss-pos-right .tss-panel { right: 0; }
.tss-panel-head { display: flex; align-items: center; gap: 6px; padding: 12px 12px; background: var(--tss-black); color: #fff; border-bottom: 4px solid var(--tss-red); flex: none; }
.tss-panel-title { flex: 1; font-weight: 700; font-size: 16px; }
.tss-root .tss-panel-btn { background: transparent; border: 0; color: #fff; cursor: pointer; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; padding: 0; }
.tss-root .tss-panel-btn:hover { background: rgba(255,255,255,.15); }
.tss-panel-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.tss-chat-holder { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; }
.tss-chat-holder > .tss-chat { flex: 1; }
.tss-menu { padding: 18px 16px; }
.tss-menu-lead { margin: 0 0 14px; font-weight: 700; font-size: 16px; color: var(--tss-black); }
.tss-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tss-root .tss-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px 6px; border: 1px solid var(--tss-line); border-radius: 14px; background: #fff; color: var(--tss-black); text-decoration: none; cursor: pointer; }
.tss-root .tss-tile:hover { border-color: var(--tss-red); box-shadow: 0 2px 10px rgba(208,21,27,.2); }
.tss-tile-icon { width: 52px; height: 52px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--tss-black); color: #fff; }
.tss-tile-icon.tss-ic-chat { background: var(--tss-red); }
.tss-tile-label { font-size: 12px; font-weight: 600; text-align: center; }

.tss-widget .tss-form { padding: 14px; }
.tss-widget .tss-list { max-height: none; flex: 1; }

@media (max-width: 520px) {
  .tss-widget { bottom: 12px; }
  .tss-widget.tss-pos-left { left: 12px; }
  .tss-widget.tss-pos-right { right: 12px; }
  .tss-panel { position: fixed; left: 10px !important; right: 10px !important; bottom: 82px; width: auto; height: calc(100vh - 100px); }
}
@supports (height: 100dvh) {
  @media (max-width: 520px) { .tss-panel { height: calc(100dvh - 100px); } }
}

/* ---------- بزرگ‌نمایی تصویر ---------- */
.tss-lightbox { position: fixed; inset: 0; z-index: 100000; background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out; }
.tss-lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; background: #fff; }
.tss-lightbox .tss-lb-close { position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--tss-red); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* ---------- دستیار هوشمند ---------- */
.tss-bot-thread { min-height: 200px; }
.tss-bot-input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid #cfcfcf; border-radius: 10px; font-size: 16px; }
.tss-root .tss-card { display: flex; gap: 10px; align-self: stretch; text-decoration: none; color: #111; background: #fff; border: 1px solid var(--tss-line); border-right: 4px solid var(--tss-red); border-radius: 12px; padding: 8px; }
.tss-root .tss-card:hover { box-shadow: 0 2px 10px rgba(208,21,27,.25); }
.tss-card img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex: none; }
.tss-card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tss-card-price { font-size: 13px; color: var(--tss-red-dark); font-weight: 700; }
.tss-card-go { font-size: 12px; color: #555; }
