/* ارتفاع تقریبی نوار بالا (navbar) */
:root {
  --nx-navbar-height: 48px;
}

/* صفحه‌هایی که سرویس‌های فاندامنتال دارند */
.fundamental-page {
  /* اگر در base.css padding-top ندادی، این خط کمک می‌کند محتوا زیر navbar قایم نشه */
  /* padding-top: calc(var(--nx-navbar-height) + 0.5rem); */
}

/* باکس اسکرول برای جداول بزرگ: ارتفاع داینامیک متناسب با اندازه صفحه */
.fundamental-page .dynamic-table-area {
  max-height: calc(100vh - var(--nx-navbar-height) - 120px);
  overflow-y: auto;
}

/* لپ‌تاپ و تبلت: چون هدر چند خطی‌تر می‌شود، کمی ارتفاع جدول را کم می‌کنیم */
@media (max-width: 992px) {
  .fundamental-page .dynamic-table-area {
    max-height: calc(100vh - var(--nx-navbar-height) - 160px);
  }
}

/* موبایل: هدر و تب‌ها فضای بیشتری می‌گیرند → جدول کم‌ارتفاع‌تر شود */
@media (max-width: 576px) {
  .fundamental-page .dynamic-table-area {
    max-height: calc(100vh - var(--nx-navbar-height) - 200px);
  }
}

/* اسکرول‌بار نرم و ظریف برای جدول‌ها */
.fundamental-page .dynamic-table-area::-webkit-scrollbar {
  width: 6px;
}
.fundamental-page .dynamic-table-area::-webkit-scrollbar-thumb {
  background: #cbd5f5;
  border-radius: 10px;
}
.fundamental-page .dynamic-table-area::-webkit-scrollbar-track {
  background: #f1f5f9;
}
/* ردیف عنوان ستون‌ها همیشه در بالای جدول بماند */
table thead th {
    position: sticky;
    top: 0;
    z-index: 4;           /* بالاتر از سلول‌های معمولی */
}

/* بک‌گراند ردیف عنوان ستون‌ها */
table thead th,
table thead td {
    background: #f8f7fc !important;
}

/* From fundamental/templates/fundamental/financial_reports.html */
.custom-tabs {
  display: flex;
  flex-wrap: wrap; /* در صفحه‌های کوچک، تب‌ها بروند زیر هم */
  gap: 0.5rem;
  justify-content: center;
  padding: 0.5rem;
}
.custom-tab {
  flex: 1 1 110px; /* مقدار پیشنهادی پایه‌ی طول تب است */
  max-width: 140px;
  font-size: .75rem;
  font-weight: 200;
  text-align: center;
  background-color: white;
  color: #00036d;
  padding: .3rem .2rem;  /* ↓ ارتفاع را کم کردیم */
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* برای صفحه‌های کوچکتر از 768px */
@media (max-width: 768px) {
  .custom-tab {
    flex: 1 1 80px;
    max-width: 100px;
    font-size: 10px;
    padding: 0.3rem 0.2rem;  /* ↓ حتی کوتاه‌تر در تبلت */
  }
}

/* برای موبایل کوچکتر از 480px */
@media (max-width: 480px) {
  .custom-tab {
    flex: 0 0 auto;
    min-width: 100px;
    padding: 0.3rem 0.2rem;  /* ↓ کوتاه در موبایل */
  }
}

  .custom-tabs::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
  }


.custom-tab:hover {
  background-color: #e9f3ff;
}

.custom-tab.active {
  background-color: #0d6efd;
  color: white;
  font-weight: bold;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}


.tab-pane  {
display: none;
}

.tab-pane.active {
display: block;
}


.highcharts-legend-item text {
    direction: rtl !important;
    text-anchor: end !important;
    white-space: normal !important;
}
#search-form .form-control {
        min-width: 0;
        flex: 1 1 auto;
        height: 2.5rem;
        direction: rtl; /* تاکید: نمایش RTL */
    }
#search-form .input-group {
    position: relative;
    }
#search-form .input-group > .btn {
  border-top-left-radius: .5rem !important;
  border-bottom-left-radius: .5rem !important;
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  height: 2.5rem;               /* همقد اینپوت */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* خود اینپوت: گوشه‌های راست گرد، چپ صاف (کنار دکمه) */
#search-form .input-group > .form-control {
  border-top-right-radius: .5rem !important;
  border-bottom-right-radius: .5rem !important;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  height: 2.5rem;
}

/* باکس ساجست: کامل زیر گروه بیفته و گوشه‌های پایین گرد باشه */
#search-form .suggest-box {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-bottom-left-radius: .5rem;
  border-bottom-right-radius: .5rem;
  margin-top: 2px;       /* کمی فاصله از کادر بالا */
}

/* وقتی لیست بازه، مرز پایین گروه یکپارچه بشه (اختیاری) */
#search-form .input-group.show-suggest > .form-control,
#search-form .input-group.show-suggest > .btn {
  border-bottom-left-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}
.responsive-title {
    background-color: #d6e5fe;
    text-align: right;
    font-weight: bold;
    font-size: 11px; /* پیش‌فرض برای موبایل */
    padding: 0.5rem 1rem;
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
}

.responsive-title span {
    color: #00036d;
    font-weight: bold;
    font-size: 12px;
}

@media (min-width: 768px) {
    .responsive-title {
        font-size: 12px;
    }

.responsive-title span {
        font-size: 14px;
    }
}

/* تنظیمات کلی */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    direction: rtl;
}

/* جدول کلی */
.period-header {
    white-space: normal !important;
    word-break: break-word;
    font-size: 12px;
    vertical-align: middle;
    text-align: center;
    line-height: 1.7;
    min-width: 120px;
}

table {
    border-collapse: separate; /* برای جلوگیری از مشکل با sticky */
    border-spacing: 0;
    font-size: 12px;
}
/* هاور روی سطر */
table tbody tr:hover > td,
table tbody tr:hover > th {
    background-color: #eff2f5 !important;
}
/* جدول */
table th,
table td {
    white-space: nowrap;
    vertical-align: middle;
    background: #fff;            /* بک گراند پیش فرض */
    transition: background 0.2s;
    min-width: 175px;
}

/* ستون اول (شرح) فیکس شود */
table th.sticky-col,
table td.sticky-col {
    position: sticky;
    right: 0; /* چون راست به چپ هست، باید از right استفاده شود */
    z-index: 2;
    text-align: right;
    direction: rtl;
}
/* تنظیم متن چندخطی برای ستون شرح */
table td.sticky-col {
    min-width: 290px;
    max-width: 300px;
    font-size: 12px;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* بالاتر بردن header */
table thead th.sticky-col {
    z-index: 5;
}
/* ستون اول (شرح) فیکس شود */
table th.sticky-col-currency,
table td.sticky-col-currency {
    position: sticky;
    right: 0; /* چون راست به چپ هست، باید از right استفاده شود */
    z-index: 2;
    text-align: right;
    direction: rtl;
}
/* تنظیم متن چندخطی برای ستون شرح */
table td.sticky-col-currency {
    max-width: 130px;
    font-size: 12px;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* بالاتر بردن header */
table thead th.sticky-col-currency {
    z-index: 5;
}
/* فونت و ارتفاع  ستون‌های تایتل */
table thead th{
font-size: 12px;
line-height: 1.7;
}
/* بک‌گراند  ستون‌های تایتل */
table thead th,
table thead td {
    background: #f8f7fc !important;
}
/* تنظیم ارتفاع رکوردهای جدول و نازکتر کردن بوردها */
table tbody td {
    border-bottom: 1px solid rgba(229, 231, 235, 0.7);  /* نازک و کمرنگ */
    height: 2.6rem;
}
.table-border {
    border: 1px solid #f1f1f1;   /* خطوط معمولی */
}

/* برای مواردی از رکوردها ک باید هایلایت شود */
.highlight-codal{
    background-color: #edf3ff !important;
}
/* فونت و سایز ریسپانسیو برای موبایل */
@media (max-width: 576px) {
    table td.sticky-col {
        min-width: 120px ;
        font-size: 12px;
    }
}
@media (max-width: 576px) {
    table td{
        font-size: 11px;
    }
}
.bg-white.shadow-sm.rounded {
    border: 1px solid #e5e7eb;
    background-color: #f9fafb;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 12px;
  padding: 6px 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  direction: rtl; /* متن سمت راست */
}

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  background: transparent;
  padding-left: 60px; /* جا برای آیکن‌ها سمت چپ */
}

/* آیکن جستجو (دکمه submit) */
.search-icon {
  position: absolute;
  left: 12px;
  background: none;
  border: none;
  color: #555;
  font-size: 15px;
  cursor: pointer;
}

/* دکمه پاک کردن */
.clear-btn {
  position: absolute;
  left: 40px;   /* دقیقا کنار آیکن جستجو */
  background: none;
  border: none;
  color: #aaa;
  font-size: 15px;
  cursor: pointer;
  display: none;
}

.clear-btn:hover {
  color: #dc3545; /* قرمز روی hover */
}

.suggest-box {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  max-height: 240px;
  overflow-y: auto;
  z-index: 1000;
}
/* اسکرول‌بار سفارشی */
.suggest-box::-webkit-scrollbar {
    width: 5px;
}

.suggest-box::-webkit-scrollbar-thumb {
    background: #c7c7c7;
    border-radius: 10px;
}

.suggest-box::-webkit-scrollbar-track {
    background: #f1f1f1;
}

/* حذف کامل فلش‌های بالا/پایین */
.suggest-box::-webkit-scrollbar-button {
    display: none;
    height: 0;
}
.suggest-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #111827;
  display: flex;
  justify-content: space-between;
}
.suggest-item:hover {
  background: #f0f9ff;
}
.suggest-symbol {
  font-weight: 700;
  color: #0f172a;
}
.suggest-name {
  font-size: 0.85rem;
  color: #64748b;
}
#symbol-input::placeholder, #commoditySearch::placeholder {
    font-size: 12px;
    color: #999; /* دلخواه */
}
#symbol-input, #commoditySearch {
    font-size: 13px;
}

/* استاتوس */
.status-open,
.status-closed {
    font-size: 12px;
    vertical-align: middle;
}
.status-unknown {
    color: #00036d;
}

/* نام نماد (responsive) */
#market-symbol {
    font-size: 1rem;     /* پیش‌فرض: موبایل */
    font-weight: 700;
    color: #00036d;
    padding-right:6px;
}

@media (min-width: 576px) {   /* sm به بالا */
    #market-symbol {
        font-size: 1.25rem;
        padding-right:6px;
    }
}

@media (min-width: 768px) {   /* md به بالا */
    #market-symbol {
        font-size: 1.4rem;
    }
}

@media (min-width: 1200px) {  /* xl به بالا */
    #market-symbol {
        font-size: 1.5rem;
    }
}

/* نام شرکت */
#market-name {
    color: #00036d;
    font-size: clamp(0.80rem, 1vw + 0.8rem, 1.1rem);
}

/* قیمت پایانی */
.stock-close {
    font-size: 0.85rem;
    line-height: 1.3;
}

/* درصد تغییر */
.stock-change {
    display: inline-block;
    font-size: 0.8rem;
    margin-left: 0.25rem;
}

/* فلش بالا/پایین */
.stock-arrow {
    font-size: 0.85rem;
    margin-left: 0.2rem;
}


/* باکس اطلاعات بازار همیشه همین‌قدر فضا نگه دارد */
#market-data-container{
  min-height: 64px;            /* بسته به طراحی‌ات: 56-72px خوبه */
}

/* وقتی نمی‌خواهیم نمایش بدهیم، فقط نامرئی شود اما فضا حفظ شود */
.market-hidden{
  visibility: hidden;           /* فضا حفظ می‌شود */
  pointer-events: none;         /* کلیک نخورد */
  opacity: 0;                   /* محو */
}


/* ستون اول (شرح) فیکس شود */
table th.sticky-col-shareholder,
table td.sticky-col-shareholder {
    position: sticky;
    right: 0; /* چون راست به چپ هست، باید از right استفاده شود */
    z-index: 2;
    text-align: right;
    direction: rtl;
}
/* تنظیم متن چندخطی برای ستون شرح */
table td.sticky-col-shareholder {
    max-width: 90px;
    font-size: 12px;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* بالاتر بردن header */
table thead th.sticky-col-shareholder {
    z-index: 5
}
/* فونت و سایز ریسپانسیو برای موبایل */
@media (max-width: 576px) {
    table td.sticky-col-shareholder {
        min-width: 80px ;
        font-size: 12px;
    }
}
.shareholder-info {
font-size: clamp(10px, 12px, 14px);
line-height: 2;
}
@media (max-width: 576px) {
.shareholder-info {
font-size: clamp(9px, 12px, 14px);
text-align: center;
}
}
.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;
}
  /* سلول قیمت به‌طور کلی */
  .price-cell {
    transition: background-color 0.8s ease-out;
  }

  /* وقتی قیمت عوض شده باشد */
  .price-cell.price-changed {
    animation: priceHighlight 1.5s ease-out;
  }

  @keyframes priceHighlight {
    0%   { background-color: #fff3a3; }  /* زرد پررنگ */
    60%  { background-color: #fff9c4; }  /* زرد ملایم‌تر */
    100% { background-color: transparent; } /* برگرد به حالت عادی */
  }