/* ── Base ─────────────────────────────────────────────── */
body { font-family: Yekan; direction: rtl; background: #212a33; }
@font-face { font-family: Yekan; src: url("font/BYekan.ttf"); }
html, body { overflow-x: hidden; }
body { padding-top: 70px !important; }
@media (max-width: 767px) {
    body { padding-top: 70px !important; }
}

a { color: #ffffff; text-decoration: none; }
#date { color: #ff4466; font-size: 20px; }
hr { display: block; margin: 0.5em auto; border-style: inset; border-width: 1px; border-color: #364650; }

/* ── Tables ───────────────────────────────────────────── */
.table td { text-align: right !important; padding-right: 16px !important; color: #e0e0e0; }
.table th { text-align: right !important; padding-right: 16px !important; color: #888; background: #212a33; }
.table { background: #27333d; }
.table > tbody > tr > td { border-top: 1px solid #32404a; }
.table > thead > tr > th { border-bottom: 2px solid #364650; }
.table-striped > tbody > tr:nth-of-type(odd) { background-color: #26303a; }
.table-hover > tbody > tr:hover { background-color: #32404a; }

.tab-content {
    background-color: #27333d;
    color: #e0e0e0;
    font-size: 100%;
    border: 1px solid #364650;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    overflow-x: auto;
}
.tab-content > .tab-pane { display: none; }
.tab-content > .active  { display: block; }

.cell-time   { font-size: 10px; color: #666; white-space: nowrap; }
.cell-change { font-size: 11px; }
.cell-range  { font-size: 11px; }

tr.up   .cell-price { color: #34d399; font-weight: 600; }
tr.down .cell-price { color: #f87171; font-weight: 600; }

@media (max-width: 576px) {
    .change-abs { display: none; }
    .rate-box.flat .rate-change i { display: none; }
}

/* ── Nav ──────────────────────────────────────────────── */
.nav { margin-bottom: 0; padding-right: 0; list-style: none; }
.nav > li { position: relative; display: block; }
.nav > li > a { position: relative; display: block; padding: 10px 15px; }
.nav > li > a:hover,
.nav > li > a:focus { text-decoration: none; background-color: transparent; }
.nav .nav-divider { height: 1px; margin: 9.5px 0; overflow: hidden; background-color: #364650; }

/* ── Nav tabs ─────────────────────────────────────────── */
.nav-tabs {
    background: #27333d;
    border-bottom: 2px solid #364650;
    display: flex;
    padding: 0;
    margin-bottom: 0;
}
.nav-tabs > li { float: none; margin-bottom: 0; }
.nav-tabs > li > a {
    display: block;
    padding: 13px 20px;
    font-size: 12px;
    font-weight: 600;
    color: #888;
    border: none !important;
    border-bottom: 3px solid transparent !important;
    border-radius: 0 !important;
    margin: 0;
    line-height: 1.42857143;
    text-align: right !important;
    padding-right: 16px !important;
    position: relative;
    bottom: -2px;
    transition: color 0.18s;
}
.nav-tabs > li:not(.active) > a:hover {
    background: #32404a !important;
    color: #ff4466 !important;
    border: none !important;
    border-bottom: 3px solid #883344 !important;
    border-radius: 6px 6px 0 0 !important;
}
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
    background: #2d3a44 !important;
    color: #ff4466 !important;
    border: none !important;
    border-bottom: 3px solid #ff4466 !important;
    border-radius: 6px 6px 0 0 !important;
    font-weight: bold;
    cursor: default;
}
.nav-tabs .dropdown-menu { margin-top: -1px; border-top-left-radius: 0; border-top-right-radius: 0; }

@media (max-width: 767px) {
    .nav-tabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: hidden !important;
        background: #27333d;
        gap: 0;
        border-bottom: 2px solid #364650;
    }
    .nav-tabs > li { flex: 1; text-align: center; }
    .nav-tabs > li > a {
        padding: 10px 3px;
        font-size: 12px;
        font-weight: 600;
        background: #27333d;
        border-bottom: none !important;
        bottom: 0;
        white-space: nowrap;
        line-height: 1.2;
        text-align: center;
    }
    .nav-tabs > li.active > a,
    .nav-tabs > li.active > a:hover,
    .nav-tabs > li.active > a:focus {
        border-top: none !important;
        border-bottom: 3px solid #ff4466 !important;
        background: #2d3a44 !important;
        color: #ff4466 !important;
    }
    .nav-tabs > li:not(.active) > a:hover {
        border-top: none !important;
        border-bottom: 3px solid #883344 !important;
    }
}

/* ── Rate boxes ───────────────────────────────────────── */
.top-rates { display: flex; flex-wrap: nowrap; margin: 0 0 15px; }
.rate-col  { flex: 0 0 16.6666%; max-width: 16.6666%; padding: 0; }

.rate-box {
    background-color: #2d3a44;
    border-radius: 12px;
    border: 1px solid #3c4d57;
    box-shadow: 0 4px 14px rgba(0,0,0,.4);
    padding: 13px 8px;
    text-align: center;
}
.rate-icon   { font-size: 22px; color: #ff4466; margin-bottom: 6px; }
.rate-name   { font-size: 12px; color: #aaa; margin-bottom: 4px; white-space: nowrap; }
.rate-price  { font-size: 20px; font-weight: bold; color: #f0f0f0; direction: ltr; }
.rate-change { font-size: 13px; margin-top: 4px; direction: ltr; white-space: nowrap; }

.rate-box.up   .rate-change  { color: #34d399; }
.rate-box.down .rate-change  { color: #f87171; }
.rate-box.flat .rate-change  { color: #666; }
.rate-box.up   .rate-price   { color: #34d399; }
.rate-box.down .rate-price   { color: #f87171; }

@media (max-width: 767px) {
    .rate-box { padding: 6px 4px; box-shadow: none !important; background-color: #2d3a44 !important; }
    .rate-box.up, .rate-box.down { background-color: #2d3a44; }

    .rate-icon  { display: none; }
    .rate-name  { font-size: 11px; font-weight: bold; margin-bottom: 2px; }
    .rate-price { font-size: 12px; }
    .rate-change { font-size: 10px; }
    .rate-sparkline { margin-top: 2px; }
}
@media (max-width: 380px) {
    .rate-sparkline { display: none; }
    .rate-name  { font-size: 9px; }
    .rate-price { font-size: 11px; }
    .rate-change { font-size: 9px; }
}

/* ── Flash animations ─────────────────────────────────── */
.rate-box.flash-up   { animation: rate-flash-up   2s ease; }
.rate-box.flash-down { animation: rate-flash-down 2s ease; }
@keyframes rate-flash-up   { 0% { background-color: rgba(52,211,153,0.25); } 100% { background-color: #2d3a44; } }
@keyframes rate-flash-down { 0% { background-color: rgba(248,113,113,0.25); } 100% { background-color: #2d3a44; } }

tr.flash-row-up   { animation: row-flash-up   2s ease; }
tr.flash-row-down { animation: row-flash-down 2s ease; }
@keyframes row-flash-up   { 0% { background-color: rgba(52,211,153,0.18); } 100% { background-color: transparent; } }
@keyframes row-flash-down { 0% { background-color: rgba(248,113,113,0.18); } 100% { background-color: transparent; } }

/* ── Site header ──────────────────────────────────────── */
.site-header {
    position: fixed;
    top: 0; right: 0; left: 0;
    background: #ac0017;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    z-index: 1030;
    box-shadow: 0 1px 6px rgba(0,0,0,.5);
}
.site-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 16px;
    height: 48px;
}
@media (max-width: 767px) { .site-header-row { padding: 0 12px; } }

.site-logo { display: flex; align-items: center; height: 100%; }
.site-logo img { height: 40px; width: 40px; object-fit: contain; display: block; }

.site-tagline {
    font-size: 12px !important;
    font-weight: 500 !important;
    color: rgba(255,255,255,.78) !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 1;
    text-align: right !important;
    padding-right: 16px !important;
    pointer-events: none;
    line-height: 1 !important;
}
@media (max-width: 600px) { .site-tagline { display: none; } }

.site-nav { display: flex; align-items: center; gap: 20px; }
.site-nav a { color: rgba(255,255,255,.88); font-size: 13px; text-decoration: none; white-space: nowrap; }
.site-nav a:hover { color: #fff; }
.site-nav .lang-btn { border: 1px solid rgba(255,255,255,.5); border-radius: 4px; padding: 3px 9px; font-size: 12px; letter-spacing: .5px; }
.site-nav .lang-btn:hover { background: rgba(255,255,255,.15); }
@media (max-width: 600px) { .site-nav .nav-hide { display: none; } }

/* ── Header datetime bar ──────────────────────────────── */
.site-datetime {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: rgba(255,255,255,.8);
    font-size: 12px;
    background: rgba(0,0,0,.25);
    padding: 4px 16px;
    letter-spacing: .3px;
    white-space: nowrap;
}
.site-dt-time { font-size: 12px; color: rgba(255,255,255,.8); white-space: nowrap; }
@media (max-width: 400px) { .site-datetime { font-size: 11px; } }

/* ── Misc ─────────────────────────────────────────────── */
.date-heading { display: none; }
.footer { position: relative; width: 100%; height: 60px; background-color: #212a33; color: #888; text-align: right !important; padding-right: 16px !important; }

/* ── Telegram alert bar ───────────────────────────────── */
.telegram-alert-bar {
    position: fixed;
    left: 0; right: 0; bottom: -100px;
    background-color: #ac0017;
    color: #ffffff;
    direction: rtl;
    padding: 8px 50px 8px 40px;
    box-sizing: border-box;
    min-height: 48px;
    z-index: 1050;
    box-shadow: 0 -2px 6px rgba(0,0,0,0.4);
    transition: bottom 0.4s ease;
}
.telegram-alert-bar.show { bottom: 0; }
.telegram-alert-bar .telegram-bot-logo { position: absolute; top: 0; bottom: 0; right: 0; height: 100%; width: auto; display: block; }
.telegram-alert-bar #telegramAlertModalLabel { margin-left: 15px; font-size: 12px; }
.telegram-alert-bar .close { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #ffffff; opacity: 0.8; }
@media (max-width: 480px) {
    .telegram-alert-bar { padding: 8px 40px 8px 35px; font-size: 12px; }
    .telegram-alert-bar #telegramAlertModalLabel { margin-left: 6px; }
}

/* ── Social links ─────────────────────────────────────── */
.social-links { text-align: right !important; padding-right: 16px !important; margin: 20px 0 4px; }
.social-links a { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; margin: 0 6px; border-radius: 50%; background-color: #ac0017; color: #ffffff; font-size: 20px; text-decoration: none; transition: background-color 0.2s ease; }
.social-links a:hover { background-color: #7a0010; color: #ffffff; }
@media (max-width: 767px) { .social-links { margin-bottom: 0 !important; } }

/* ── English (LTR) overrides ──────────────────────────── */
body.lang-en { direction: ltr; font-family: Arial, Helvetica, sans-serif; }
.lang-en .nav { padding-left: 0; padding-right: 0; }
.lang-en .nav-tabs > li { float: left; }
.lang-en .nav-tabs > li > a { margin-right: 0; margin-left: 2px; }
.lang-en .table th, .lang-en .table td { text-align: left !important; padding-right: 0 !important; padding-left: 16px !important; }
.lang-en .rate-name { font-size: 12.6px; }
@media (max-width: 767px) { .lang-en .rate-name { font-size: 9px; } }
@media (max-width: 380px) { .lang-en .rate-name { font-size: 7.5px; } }
.lang-en .telegram-alert-bar { direction: ltr; padding: 8px 40px 8px 50px; }
.lang-en .telegram-alert-bar .telegram-bot-logo { right: auto; left: 0; }
.lang-en .telegram-alert-bar #telegramAlertModalLabel { margin-left: 0; margin-right: 15px; }
.lang-en .telegram-alert-bar .close { left: auto; right: 10px; }
@media (max-width: 480px) {
    .lang-en .telegram-alert-bar { padding: 8px 35px 8px 40px; }
    .lang-en .telegram-alert-bar #telegramAlertModalLabel { margin-right: 6px; }
}
.lang-en .site-tagline { text-align: left !important; padding-right: 0 !important; padding-left: 16px !important; }
.lang-en .site-nav { flex-direction: row-reverse; }
.lang-en .social-links { text-align: left !important; padding-right: 0 !important; padding-left: 16px !important; }

/* ── Header news button ───────────────────────────────── */
#headerNewsBtn {
    border: 1px solid rgba(255,255,255,.5);
    border-radius: 4px;
    padding: 3px 9px;
    font-size: 12px;
    color: rgba(255,255,255,.88) !important;
    text-decoration: none;
    white-space: nowrap;
    transition: background .2s;
}
#headerNewsBtn:hover { background: rgba(255,255,255,.15); color: #fff !important; }

/* ── Mobile nav bar (floating card) ──────────────────── */
@media (max-width: 767px) {
  body { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important; }
  .fa-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 1040;
    display: flex;
    background: #212a33;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 4px 0 calc(4px + env(safe-area-inset-bottom, 0px));
  }
  .fa-nav a, .fa-nav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 3px 4px; font-size: 10px; color: #555; background: none; border: none;
    cursor: pointer; font-family: inherit; text-decoration: none;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
    user-select: none; outline: none; border-radius: 10px;
    transition: color .15s;
  }
  .fa-nav a.active, .fa-nav button.active { color: #ff4466; }
  .fa-nav i { font-size: 18px; }
  .fa-more-wrap { position: relative; flex: 1; display: flex; justify-content: center; }
  .fa-more-wrap > button { width: 100%; }
  .fa-dropdown {
    display: none; position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
    background: #2d3a44; border: 1px solid #3c4d57; border-radius: 14px;
    box-shadow: 0 -4px 24px rgba(0,0,0,.6); min-width: 170px; overflow: hidden;
  }
  .fa-more-wrap.open .fa-dropdown { display: block; }
  .fa-dropdown a {
    display: flex; align-items: center; gap: 10px; padding: 12px 16px;
    font-size: 13px; color: #e0e0e0; text-decoration: none;
    border-bottom: 1px solid #364650; font-family: inherit; white-space: nowrap;
  }
  .fa-dropdown a:last-child { border-bottom: none; }
  .fa-dropdown a:active { background: #3c4d57; }
  .fa-dropdown a i { color: #888; font-size: 12px; width: 16px; text-align: center; }
}
@media (min-width: 768px) {
  .fa-nav { display: none !important; }
}
