/* -------------------- Global / Layout -------------------- */
.symbol-detail-page {
    --sd-bg: #f5f7fb;
    --sd-card-bg: #ffffff;
    --sd-border-subtle: #e5e7eb;
    --sd-text-main: #111827;
    --sd-text-muted: #6b7280;
    --sd-primary: #2563eb;
    --sd-primary-soft: #e0edff;
    --sd-success: #16a34a;
    --sd-danger: #dc2626;
    --sd-warning: #f97316;
    --sd-info: #0ea5e9;
    --sd-radius-lg: 1rem;
    --sd-radius-md: 0.75rem;
    --sd-shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.06);
    --sd-shadow-subtle: 0 6px 16px rgba(148, 163, 184, 0.25);
    --sd-badge-bg: #eff6ff;
    --sd-chip-bg: #f9fafb;
    --sd-chip-border: #e5e7eb;
    --sd-transition: 0.2s ease;

}

/* Container */
.symbol-detail-page-wrapper {
    background: radial-gradient(circle at top left, #e0edff 0, transparent 60%),
                radial-gradient(circle at bottom right, #fef3c7 0, transparent 55%),
                var(--sd-bg);
    padding: 1.25rem 0 2.5rem;
}

/* -------------------- Header / Hero -------------------- */
.sd-header-card {
    background: linear-gradient(135deg, #ffffff, #f3f6ff);
    border-radius: 1.25rem;
    box-shadow: var(--sd-shadow-soft);
    border: 1px solid rgba(148, 163, 184, 0.18);
    padding: 1.1rem 1.25rem;
    position: relative;
    overflow: hidden;
}

.sd-header-card::before {
    content: "";
    position: absolute;
    inset-inline-start: -80px;
    inset-block-start: -80px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.15), transparent 60%);
    opacity: 0.7;
    pointer-events: none;
}

.sd-header-main {
    position: relative;
    z-index: 1;
}

.sd-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.sd-ticker-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: var(--sd-primary-soft);
    color: var(--sd-primary);
    font-weight: 700;
    letter-spacing: 0.03em;
    font-size: 1.1rem;
}

.sd-company-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--sd-text-main);
}

.sd-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.sd-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background-color: var(--sd-chip-bg);
    border: 1px solid var(--sd-chip-border);
    font-size: 0.74rem;
    color: var(--sd-text-muted);
}

.sd-chip-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #22c55e;
}

/* Header right: main price cards */
.sd-header-right {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: flex-end;
}

.sd-price-card {
    min-width: 150px;
    border-radius: 1rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
    padding: 0.65rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
     align-items: center;
}

.sd-price-card-label {
    font-size: 0.78rem;
    color: var(--sd-text-muted);
}

.sd-price-card-value {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.3rem;
}

.sd-price-main-number {
    margin-top:6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--sd-text-main);
}

.sd-price-change {
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    background-color: #ecfdf3;
    color: var(--sd-success);
    direction: ltr;
}

.sd-price-change.text-danger {
    background-color: #fef2f2;
}

/* -------------------- Generic card -------------------- */
.sd-card {
    background: var(--sd-card-bg);
    border-radius: var(--sd-radius-lg);
    border: 1px solid rgba(203, 213, 225, 0.9);
    box-shadow: var(--sd-shadow-soft);
    overflow: hidden;
    transition: transform var(--sd-transition), box-shadow var(--sd-transition), border-color var(--sd-transition);
}

.sd-card:hover {
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, 0.32);
    box-shadow: var(--sd-shadow-subtle);
}

.sd-card-header {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--sd-border-subtle);
    background: linear-gradient(to left, #f9fafb, #eef2ff);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sd-card-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #111827;
}

/* -------------------- Base info table -------------------- */
.sd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.sd-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.sd-table th,
.sd-table td {
    padding: 0.65rem 0.9rem;
}

.sd-table th {
    width: 26%;
    color: var(--sd-text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.sd-table td {
    color: var(--sd-text-main);
}

/* -------------------- Real / Legal volume card -------------------- */
.sd-volume-layout {
    padding: 0.9rem 0.95rem 1rem;
}

.sd-volume-header-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}

.sd-pill-real,
.sd-pill-legal {
    border-radius: 0.8rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    color: #ffffff;
}

.sd-pill-real {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
}

.sd-pill-legal {
    background: linear-gradient(135deg, #ec4899, #db2777);
}

.sd-pill-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #ffffff;
    opacity: 0.85;
}

.sd-volume-row {
    margin-block: 0.35rem 0.85rem;
}

.sd-volume-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--sd-text-muted);
    margin-bottom: 0.2rem;
}

.sd-volume-values {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.sd-volume-values span:first-child {
    color: #0ea5e9;
}

.sd-volume-values span:last-child {
    color: #ec4899;
}

/* progress bar */
.sd-progress {
    display: flex;
    width: 100%;
    height: 0.9rem;
    border-radius: 999px;
    overflow: hidden;
    background: #f3f4f6;
}

.sd-progress-part {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    color: #f9fafb;
    white-space: nowrap;
}

#buy-real-bar,
#sell-real-bar {
    background: linear-gradient(90deg, #0ea5e9, #0369a1);
}

#buy-legal-bar,
#sell-legal-bar {
    background: linear-gradient(90deg, #ec4899, #be185d);
}

/* ownership box */
.sd-ownership-box {
    margin-top: 0.7rem;
    padding: 0.45rem 0.6rem;
    border-radius: 0.8rem;
    background: #f9fafb;
    border: 1px dashed #e5e7eb;
    font-size: 0.78rem;
}

/* -------------------- Real stats card -------------------- */
.sd-real-stats {
    padding: 0.9rem 0.9rem 1rem;
}

.sd-real-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.sd-mini-kpi {
    padding: 0.65rem 0.5rem;
    border-radius: 0.9rem;
    color: #ffffff;
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    text-align:center;
}

.sd-mini-kpi-label {
    opacity: 0.9;
}

.sd-mini-kpi-value {
    font-weight: 700;
    font-size: 0.86rem;
}

.sd-mini-kpi.accent-red {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.sd-mini-kpi.accent-blue {
    background: linear-gradient(135deg,#7681f5,  #3f52b1);
}

/* real money inflow box - background will be set by JS */
#real-money-inflow {
    font-size: 0.88rem;
}
/* برای وسط نگه‌داشتن عنوان خرید و فروش */
.sd-progress-with-label {
    position: relative;
}

.sd-progress-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 0 3px rgba(0,0,0,0.3);
    pointer-events: none;
    white-space: nowrap;
}

/* -------------------- Daily info card -------------------- */
.sd-daily-table-wrapper {
    padding: 0.9rem 0.9rem 1rem;
}

.sd-daily-table th {
    width: 45%;
}

/* -------------------- Text helpers -------------------- */
.text-pink {
    color: #ec4899 !important;
}
.text-info {
    color: #0ea5e9 !important;
}

/* -------------------- Responsive -------------------- */
@media (max-width: 991.98px) {
    .sd-header-card {
        padding: 1rem;
    }

    .sd-header-right {
        justify-content: flex-start;
        margin-top: 0.75rem;
    }
}

@media (max-width: 767.98px) {
    .sd-header-card {
        border-radius: 1rem;
    }
    .sd-title-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .sd-header-right {
        width: 100%;
    }
    .sd-price-card {
        flex: 1 1 calc(50% - 0.4rem);
    }
}

@media (max-width: 575.98px) {
    .sd-price-card {
        flex: 1 1 100%;
    }
    .sd-card {
        border-radius: 0.9rem;
    }
}
/* ==========================
   Mobile: ticker + company name in ONE line
   ========================== */
@media (max-width: 767.98px) {
  .sd-header-card .sd-title-row{
    flex-direction: row;      /* ✅ کنار هم */
    align-items: center;
    flex-wrap: nowrap;        /* ✅ نپیچد */
    gap: .5rem;
  }

  .sd-header-card .sd-ticker-badge{
    flex: 0 0 auto;
    flex-shrink: 0;
  }

  .sd-header-card .sd-company-name{
    flex: 1 1 auto;
    min-width: 0;             /* ✅ لازم برای ellipsis در flex */
    white-space: nowrap;      /* ✅ تک‌خط */
    overflow: hidden;
    text-overflow: ellipsis;  /* ✅ سه نقطه */
  }

  /* حالت لودینگ اسم شرکت (اسکلت) هم یک‌خطی بماند */
  #sd-name.sd-name-loading .sd-name-skeleton{
    width: clamp(120px, 52vw, 220px);
  }
}

/* چون در JS به همه‌ی setText ها کلاس sd-rtl اضافه می‌کنی و جهت را ltr می‌کنی،
   برای نام شرکت استثناء می‌گذاریم که راست‌چین درست بماند */
#sd-name.sd-rtl{
  direction: rtl !important;
  text-align: right !important;
}

/* جلوگیری از نمایش اشتباه علامت منفی در RTL */
.sd-number,
.sd-card-body td,
.sd-price-main-number,
.sd-chip1,
#ownership-change,

#real-buy-power,
#real-buy-avg,
#real-sell-avg,
#buy-real-text,
#buy-legal-text,
#sell-real-text,
#sell-legal-text
{
    direction: ltr !important;
    text-align: center !important;
    unicode-bidi: plaintext;
}
.sd-rtl {
    direction: ltr !important;
    text-align: center !important;
}
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}



/*  مربوط به کدال و پیام ناظر بازار   */
    /* اسکرول داخل کارت‌ها */
.sd-table-scroll {
    max-height: 380px;
    overflow-y: auto;
    border-top: 1px solid #e5e7eb;
}

/* لینک «نمایش بیشتر» */
.sd-more-row {
    border-top: 1px solid #e5e7eb;
    padding: .4rem .75rem .2rem;
    background-color: #f9fafb;
    direction:ltr;
}

.sd-more-link {
    border: none;
    background: none;
    font-size: 0.7rem;
    color: #2563eb;
    cursor: pointer;
}

.sd-more-link:hover {
    color:1d4ed8;
    font-weight: bold;
    text-decoration: none;
}

/* جدول پیام ناظر */
.sd-supervisor-table tr {
    font-size: 0.7rem;
}

.sd-supervisor-row {
    cursor: pointer;
}

.sd-supervisor-row:hover {
    background-color: #f3f4f6;
}

.sd-supervisor-datetime {
    width: 28%;
    white-space: nowrap;
    color: #6b7280;
    text-align:left;
    direction:ltr;
}

.sd-supervisor-title {
    width: 72%;
    text-align: right;
}

.sd-supervisor-body-row {
    display: none;
    background-color: #f9fafb;
}

.sd-supervisor-body-row td {
    padding-top: 0;
    font-size: 0.7rem;
    color: #374151;
}

/* وقتی باز است */
.sd-supervisor-body-row.open {
    display: table-row;
}

/* جدول کدال */
.sd-codal-table tr {
    font-size: 0.7rem;
}

.sd-codal-date {
    width: 15%;
    white-space: nowrap;
    color: #6b7280;
    text-align:center;
    direction:ltr;
}

.sd-codal-title {

    text-align: right;
}

.sd-codal-title a {
    text-decoration: none;
    color: #111827;
}

.sd-codal-title a:hover {
    color: #1d4ed8;
}

.sd-codal-icons {
    width: 15%;
    white-space: nowrap;
    text-align: left;
}

.sd-codal-icon {
    margin-inline: 4px;
    color: #6b7280;
    font-size: 0.9rem;
}

.sd-codal-icon.active {
    color: #2563eb;
}

.sd-codal-icon.disabled {
    opacity: 0.2;
    cursor: default;
}
.sd-codal-icon {
    text-decoration: none !important;
}

.sd-codal-icon:visited,
.sd-codal-icon:hover,
.sd-codal-icon:active {
    text-decoration: none !important;
}
.sd-codal-icon i.fa-paperclip {
    color: linear-gradient(135deg,#7681f5,  #3f52b1); /* آبی */
}
.sd-codal-icon i.fa-file-excel {
    color: #28a745; /* سبز */
}

.sd-codal-icon i.fa-file-pdf {
    color: #dc3546; /* قرمز */
}

/* دکمه قابل کلیک برای عنوان پیام ناظر */
.sd-supervisor-toggle {
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    width: 100%;
    text-align: right;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font: inherit;
    color: #111827;
    cursor: pointer;
}

.sd-supervisor-toggle:hover {
    color: #1d4ed8;
}

.sd-supervisor-icon {
    font-size: 0.75rem;
    color: #6b7280;
}


/* کلی: برای حذف فلشهای اسکرول کوچک و بدون فلش */
.sd-table-scroll::-webkit-scrollbar {
    width: 6px;
}

.sd-table-scroll::-webkit-scrollbar-thumb {
    background: #c7c7c7;
    border-radius: 10px;
}

.sd-table-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
}

/* حذف فلش‌ها */
.sd-table-scroll::-webkit-scrollbar-button {
    height: 0;
    display: none;
}

/* ===== بهبود رسپانسیو برای کدال / پیام ناظر و کارت‌ها ===== */

/* تبلت و پایین‌تر: هر دو کارت پایین، تمام عرض */
@media (max-width: 991.98px) {
    .sd-bottom-row .col-lg-7,
    .sd-bottom-row .col-lg-5 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .sd-table-scroll {
        max-height: 300px;
    }
}

/* موبایل افقی / تبلت کوچک */
@media (max-width: 767.98px) {

    .symbol-detail-page-wrapper {
        padding: 0.75rem 0 1.5rem;
    }

    .sd-header-card {
        padding: 0.75rem 0.9rem;
    }

    .sd-card-header {
        padding: 0.6rem 0.8rem;
    }

    .sd-card-title {
        font-size: 0.78rem;
    }

    /* جدول‌ها جمع‌وجورتر */
    .sd-table th,
    .sd-table td {
        padding: 0.45rem 0.55rem;
        font-size: 0.7rem;
    }

    .sd-codal-table tr,
    .sd-supervisor-table tr {
        font-size: 0.7rem;
    }

    .sd-codal-date,
    .sd-supervisor-datetime {
        font-size: 0.7rem;
    }
/* روی موبایل تاریخ کدال بشکنه، nowrap نباشه */
    .sd-codal-date {
        white-space: normal;   /* اجازه شکستن متن */
        width: auto;           /* دیگه مجبورش نکن درصد ثابت داشته باشه */
    }


    .sd-table-scroll {
        max-height: 260px;
    }
}

/* موبایل کاملاً کوچک */
@media (max-width: 575.98px) {
    .sd-header-card {
        border-radius: 0.9rem;
    }

    .sd-header-right {
        width: 100%;
        gap: 0.45rem;
    }

    /* هر کارت قیمت یک ردیف کامل */
    .sd-price-card {
        flex: 1 1 100%;
        min-width: 0;
    }

    /* ارتفاع کمتر برای اسکرول جدول‌ها */
    .sd-table-scroll {
        max-height: 220px;
    }

    /* عنوان‌ها کمی کوچک‌تر */
    .sd-card-title {
        font-size: 0.76rem;
    }
}


/* ========== Skeleton Loading برای صفحات سیگنال هوشمند ========== */
/* =========================
   Skeleton (sd-name only)
   ========================= */

/* مشابه اسکلتون‌های خلاصه بازار (Shimmer line) */
.ms-skeleton-line {
  display: inline-block;
  border-radius: 999px;
  background: linear-gradient(90deg, #e9eef5 25%, #f6f9ff 37%, #e9eef5 63%);
  background-size: 400% 100%;
  animation: ms-skeleton-shimmer 1.2s ease-in-out infinite;
}

@keyframes ms-skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* فقط هنگام لود برای sd-name */
#sd-name.sd-name-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 22px; /* جلوگیری از پرش (layout shift) */
}

#sd-name .sd-loading-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #3b82f6;
  opacity: 0.75;
  animation: sd-dot-pulse 1.1s ease-in-out infinite;
}

@keyframes sd-dot-pulse {
  0%, 100% { transform: scale(0.85); opacity: 0.55; }
  50% { transform: scale(1); opacity: 0.95; }
}

/* طول اسکلتون نام شرکت */
#sd-name .sd-name-skeleton {
  height: 14px;
  width: clamp(140px, 32vw, 260px);
}

/* احترام به تنظیمات دسترسی‌پذیری */
@media (prefers-reduced-motion: reduce) {
  .ms-skeleton-line,
  #sd-name .sd-loading-dot {
    animation: none !important;
  }
}



/* ==========================
   Quickbar (مثل تصویر ارسالی)
   ========================== */

/* نوار اصلی (کم‌ارتفاع‌تر) */
.sd-quickbar{
  display: inline-flex;           /* مهم: مثل عکس، جمع‌وجور */
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  background: #f3f4f6;
  border: none;
  border-radius: 14px;

  padding: 6px 10px;              /* ✅ ارتفاع کمتر */
  min-height: 24px;               /* touch-friendly ولی کوتاه */

  max-width: 100%;                /* برای موبایل */
}

/* متن سمت راست */
.sd-quickbar-text{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  line-height: 1;                 /* ✅ کوتاه‌تر */
  font-size: 0.88rem;             /* کمی کوچکتر */
  font-weight: 800;
  color: #111827;
}
/* ستون Quickbar همیشه از نظر بصری سمت چپ باشد */
.sd-quickbar-col{
  text-align: left; /* فارغ از rtl/ltr */
}
@media (max-width: 767.98px) {
.sd-quickbar-col{
  text-align: right; /* فارغ از rtl/ltr */
}
}
}
.sd-quickbar-ticker{
  font-weight: 900;
}

.sd-quickbar-muted{
  color: #6b7280;
  font-weight: 700;
}

/* آیکن‌ها سمت چپ (چینش LTR که مثل تصویر مرتب باشند) */
/* آیکن‌ها سمت چپ */
.sd-quickbar-icons{
  display: inline-flex;
  align-items: center;
  gap: 8px;                       /* کمی کمتر */
  direction: ltr;
}

/* دکمه‌های آیکن: کوچک‌تر و کم‌ارتفاع‌تر */
.sd-quickicon{
  width: 34px;                    /* ✅ کوچکتر */
  height: 34px;
  border-radius: 10px;

  background: #ffffff;
  border: 1px solid rgba(203,213,225,.95);
  display: grid;
  place-items: center;
  text-decoration: none;

  color: #1d4ed8;
  box-shadow: 0 4px 12px rgba(15,23,42,.06);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
}

.sd-quickicon i{
  font-size: 1.05rem;             /* کمی کوچکتر */
  line-height: 1;
}

.sd-quickicon:hover{
  background: #eef2ff;
  transform: translateY(-1px);
  border-color: rgba(37,99,235,.35);
  box-shadow: 0 8px 16px rgba(15,23,42,.10);
}

.sd-quickicon:focus-visible{
  outline: 3px solid rgba(37,99,235,.28);
  outline-offset: 2px;
}

.sd-quickicon.disabled{
  opacity: .45;
  pointer-events: none;
  box-shadow: none;
}

/* موبایل: اگر خیلی باریک شد، "در نوکسا" مخفی شود تا نوار نشکند */
@media (max-width: 360px){
  .sd-quickbar-muted{ display:none; }
  .sd-quickicon{ width:32px; height:32px; }
}


/* ==========================
   Professional Tooltip Style
   ========================== */
.sd-tooltip .tooltip-inner{
  background: #0b1220;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15,23,42,.22);
  direction: rtl;
  text-align: center;
  letter-spacing: .1px;
}

/* رنگ فلش */
.sd-tooltip.bs-tooltip-top .tooltip-arrow::before    { border-top-color: #0b1220; }
.sd-tooltip.bs-tooltip-bottom .tooltip-arrow::before { border-bottom-color: #0b1220; }
.sd-tooltip.bs-tooltip-start .tooltip-arrow::before  { border-left-color: #0b1220; }
.sd-tooltip.bs-tooltip-end .tooltip-arrow::before    { border-right-color: #0b1220; }

/* انیمیشن لطیف */
.sd-tooltip.show .tooltip-inner{
  animation: sdTooltipPop .14s ease-out;
}
@keyframes sdTooltipPop{
  from { transform: translateY(2px) scale(.98); opacity: .0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
