/* TradeAnalyzer.Pro — RSI Dashboard (Crypto + Markets), extends rsi-pro-page.css */

body.rsi-dashboard-page {
    --rsi-bg: #070b14;
    --rsi-panel: #0d1524;
    --rsi-card: #111a2b;
    --rsi-line: rgba(148, 163, 184, 0.18);
    --rsi-text: #e8eef7;
    --rsi-muted: #94a3b8;
    --rsi-cyan: #38bdf8;
    --rsi-blue: #0ea5e9;
    --rsi-gold: #eab308;
    --rsi-green: #34d399;
    --rsi-red: #f87171;
    --rsi-radius: 16px;
    --rsi-display: "Sora", system-ui, sans-serif;
    --rsi-body: "IBM Plex Sans", system-ui, sans-serif;
}

/* Top search sits outside #contentArea on dashboard pages */
body.rsi-dashboard-page > .controls-header {
    width: min(1180px, calc(100% - 2rem)) !important;
    max-width: 1180px !important;
    margin: 1.1rem auto 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center;
}

body.rsi-dashboard-page > .controls-header .controls-container {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    justify-content: flex-end !important;
}

body.rsi-dashboard-page > .controls-header .search-controls {
    position: relative;
    display: flex !important;
    align-items: center;
    gap: 0.6rem;
    width: min(100%, 480px) !important;
    grid-template-columns: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.rsi-dashboard-page > .controls-header .search-icon {
    position: absolute !important;
    left: 0.9rem !important;
    right: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: var(--rsi-muted) !important;
    z-index: 1;
    pointer-events: none;
}

body.rsi-dashboard-page > .controls-header #searchInput {
    width: 100% !important;
    min-height: 44px;
    padding: 0.7rem 1rem 0.7rem 2.45rem !important;
    border-radius: 999px !important;
    border: 1px solid var(--rsi-line) !important;
    background: rgba(17, 26, 43, 0.9) !important;
    color: var(--rsi-text) !important;
    font: 500 0.92rem var(--rsi-body);
    box-shadow: none !important;
}

body.rsi-dashboard-page > .controls-header #searchInput:focus {
    border-color: rgba(56, 189, 248, 0.55) !important;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14) !important;
}

body.rsi-dashboard-page > .controls-header #clearSearch {
    position: static !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    transform: none !important;
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: max-content !important;
    max-width: none !important;
    min-height: 42px !important;
    height: auto !important;
    padding: 0.55rem 1rem !important;
    border: 1px solid rgba(248, 113, 113, 0.35) !important;
    border-radius: 999px !important;
    background: rgba(248, 113, 113, 0.12) !important;
    color: #fca5a5 !important;
    font: 600 0.88rem var(--rsi-body) !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
    box-shadow: none !important;
    cursor: pointer !important;
    z-index: 2;
}

body.rsi-dashboard-page > .controls-header #clearSearch:hover {
    background: rgba(248, 113, 113, 0.2) !important;
    color: #fecaca !important;
}

/* Timeframe / global filter card */
body.rsi-dashboard-page .rsi-dash-filter {
    position: relative;
    overflow: hidden;
    margin: 0 0 1.25rem !important;
    padding: 1.15rem 1.25rem !important;
    border: 1px solid var(--rsi-line) !important;
    border-radius: 20px !important;
    border-top: 1px solid var(--rsi-line) !important;
    background:
        radial-gradient(640px 220px at 0% 0%, rgba(14, 165, 233, 0.14), transparent 55%),
        rgba(13, 21, 36, 0.92) !important;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.26) !important;
}

body.rsi-dashboard-page .rsi-dash-filter::before {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--rsi-cyan), var(--rsi-gold), transparent);
}

body.rsi-dashboard-page .rsi-dash-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    margin-bottom: 0.95rem;
}

body.rsi-dashboard-page .rsi-dash-filter-title {
    font-family: var(--rsi-display) !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: var(--rsi-text) !important;
    letter-spacing: -0.02em;
}

body.rsi-dashboard-page .rsi-dash-filter-title i {
    margin-inline-end: 0.45rem;
    color: var(--rsi-cyan) !important;
}

body.rsi-dashboard-page .rsi-dash-filter .btn-filter-reset,
body.rsi-dashboard-page #rsiDashFiltersReset {
    min-height: 36px !important;
    height: auto !important;
    padding: 0.45rem 0.9rem !important;
    border: 1px solid rgba(248, 113, 113, 0.35) !important;
    border-radius: 999px !important;
    background: rgba(248, 113, 113, 0.1) !important;
    color: #fca5a5 !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
}

body.rsi-dashboard-page .rsi-dash-filter .btn-filter-reset:hover,
body.rsi-dashboard-page #rsiDashFiltersReset:hover {
    background: rgba(248, 113, 113, 0.18) !important;
    color: #fecaca !important;
}

body.rsi-dashboard-page .rsi-dash-filter-hint {
    margin-top: 0.85rem !important;
    padding: 0.65rem 0.85rem !important;
    border: 1px solid rgba(56, 189, 248, 0.22) !important;
    border-radius: 12px !important;
    background: rgba(56, 189, 248, 0.07) !important;
    color: var(--rsi-muted) !important;
    font-size: 0.82rem !important;
}

body.rsi-dashboard-page .rsi-tf-filter {
    border: 1px solid var(--rsi-line) !important;
    border-radius: 14px !important;
    padding: 0.95rem 1rem !important;
    background: rgba(17, 26, 43, 0.72) !important;
}

body.rsi-dashboard-page .rsi-tf-label {
    margin-bottom: 0.55rem !important;
    color: var(--rsi-muted) !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
}

body.rsi-dashboard-page .rsi-dash-filter .rsi-op-segment {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
    border: 0 !important;
    background: transparent !important;
}

body.rsi-dashboard-page .rsi-dash-filter .rsi-op-btn {
    min-height: 34px !important;
    height: auto !important;
    padding: 0.45rem 0.85rem !important;
    border: 1px solid var(--rsi-line) !important;
    border-right: 1px solid var(--rsi-line) !important;
    border-radius: 999px !important;
    background: rgba(13, 21, 36, 0.85) !important;
    color: #cbd5e1 !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    box-shadow: none !important;
}

body.rsi-dashboard-page .rsi-dash-filter .rsi-op-btn:hover {
    border-color: rgba(56, 189, 248, 0.38) !important;
    background: rgba(56, 189, 248, 0.08) !important;
    color: var(--rsi-text) !important;
}

body.rsi-dashboard-page .rsi-dash-filter .rsi-op-btn.active,
body.rsi-dashboard-page .rsi-dash-filter .rsi-op-btn.timeframe-btn.active {
    border-color: rgba(56, 189, 248, 0.6) !important;
    background: rgba(14, 165, 233, 0.18) !important;
    color: #7dd3fc !important;
    box-shadow: none !important;
}

/* Compact 2-column tables (Symbol | RSI) — sticky thead like MACD */
body.rsi-dashboard-page .table-wrapper {
    overflow: hidden !important;
    min-width: 0 !important;
}

body.rsi-dashboard-page .table-sticky-head,
body.rsi-dashboard-page .indicator-sticky-head,
html[dir="rtl"] body.rsi-dashboard-page .table-sticky-head,
html[dir="rtl"] body.rsi-dashboard-page .indicator-sticky-head {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

body.rsi-dashboard-page #longTable thead,
body.rsi-dashboard-page #shortTable thead,
html[dir="rtl"] body.rsi-dashboard-page #longTable thead,
html[dir="rtl"] body.rsi-dashboard-page #shortTable thead {
    display: table-header-group !important;
}

body.rsi-dashboard-page .signal-table th,
body.rsi-dashboard-page .signal-table td,
html[dir="rtl"] body.rsi-dashboard-page .signal-table th,
html[dir="rtl"] body.rsi-dashboard-page .signal-table td {
    text-align: center !important;
    direction: ltr !important;
}

body.rsi-dashboard-page .table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    max-height: min(62vh, calc(100vh - 300px));
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    position: relative;
    border-radius: 0 0 var(--rsi-radius) var(--rsi-radius);
}

body.rsi-dashboard-page .signal-table {
    min-width: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    table-layout: fixed !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    box-sizing: border-box !important;
}

body.rsi-dashboard-page .signal-table thead {
    display: table-header-group !important;
}

body.rsi-dashboard-page .signal-table thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 4 !important;
    background: #111a2b !important;
    color: #94a3b8 !important;
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
    text-align: center !important;
    white-space: nowrap !important;
    border-bottom: 1px solid var(--rsi-line) !important;
    padding: 0.75rem 0.65rem !important;
}

body.rsi-dashboard-page #longTable th,
body.rsi-dashboard-page #longTable td,
body.rsi-dashboard-page #shortTable th,
body.rsi-dashboard-page #shortTable td,
body.rsi-dashboard-page #longTable th:nth-child(n),
body.rsi-dashboard-page #longTable td:nth-child(n),
body.rsi-dashboard-page #shortTable th:nth-child(n),
body.rsi-dashboard-page #shortTable td:nth-child(n) {
    width: auto !important;
}

body.rsi-dashboard-page #longTable th:nth-child(1),
body.rsi-dashboard-page #longTable td:nth-child(1),
body.rsi-dashboard-page #shortTable th:nth-child(1),
body.rsi-dashboard-page #shortTable td:nth-child(1) {
    width: 58% !important;
    position: sticky !important;
    left: 0 !important;
    z-index: 3 !important;
    background-color: #0d1524 !important;
    box-shadow: 4px 0 14px rgba(0, 0, 0, 0.25) !important;
    border-right: 1px solid var(--rsi-line) !important;
}

body.rsi-dashboard-page #longTable thead th:nth-child(1),
body.rsi-dashboard-page #shortTable thead th:nth-child(1) {
    z-index: 8 !important;
    background-color: #111a2b !important;
}

body.rsi-dashboard-page #longTable th:nth-child(2),
body.rsi-dashboard-page #longTable td:nth-child(2),
body.rsi-dashboard-page #shortTable th:nth-child(2),
body.rsi-dashboard-page #shortTable td:nth-child(2) {
    width: 42% !important;
}

body.rsi-dashboard-page .signal-table th,
body.rsi-dashboard-page .signal-table td,
body.rsi-dashboard-page .signal-table tbody td {
    text-align: center !important;
    box-sizing: border-box !important;
    max-width: none !important;
    transition: none !important;
}

body.rsi-dashboard-page .signal-table th:first-child,
body.rsi-dashboard-page .signal-table td:first-child,
body.rsi-dashboard-page .signal-table tbody td:first-child {
    text-align: center !important;
}

body.rsi-dashboard-page .table-responsive::after {
    display: none !important;
}

/* No hover / interactive feedback on dashboard table rows & cells */
body.rsi-dashboard-page .signal-table tbody tr,
body.rsi-dashboard-page .signal-table tbody tr:nth-child(even),
body.rsi-dashboard-page .signal-table tbody tr:hover,
body.rsi-dashboard-page .signal-table tbody tr:hover td,
body.rsi-dashboard-page .signal-table tbody tr:hover td.high-value,
body.rsi-dashboard-page .signal-table tbody tr:hover td.low-value,
body.rsi-dashboard-page .signal-table tbody tr:hover td.neutral-value {
    background: transparent !important;
    cursor: default !important;
}

body.rsi-dashboard-page .signal-table tbody td.high-value {
    background: rgba(248, 113, 113, 0.12) !important;
}

body.rsi-dashboard-page .signal-table tbody td.low-value {
    background: rgba(52, 211, 153, 0.12) !important;
}

body.rsi-dashboard-page .signal-table tbody td.neutral-value {
    background: rgba(234, 179, 8, 0.1) !important;
}

body.rsi-dashboard-page .signal-table a,
body.rsi-dashboard-page .symbol-link {
    cursor: default !important;
    text-decoration: none !important;
}

body.rsi-dashboard-page .signal-table a:hover,
body.rsi-dashboard-page .symbol-link:hover,
body.rsi-dashboard-page .symbol-link:active {
    color: var(--rsi-cyan) !important;
    text-decoration: none !important;
}

body.rsi-dashboard-page .rsi-between .sep,
body.rsi-dashboard-page .rsi-between .rsi-between-sep {
    color: var(--rsi-muted);
    font-weight: 700;
}

@media (max-width: 1100px) {
    body.rsi-dashboard-page .tables-container,
    html[dir="rtl"] body.rsi-dashboard-page .tables-container {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    body.rsi-dashboard-page > .controls-header {
        width: min(100% - 1rem, 1180px) !important;
        justify-content: stretch !important;
    }

    body.rsi-dashboard-page > .controls-header .controls-container {
        justify-content: stretch !important;
    }

    body.rsi-dashboard-page > .controls-header .search-controls {
        width: 100% !important;
        flex-wrap: nowrap;
    }

    body.rsi-dashboard-page > .controls-header #clearSearch {
        width: auto !important;
        flex: 0 0 auto !important;
    }

    body.rsi-dashboard-page .rsi-dash-filter {
        padding: 1rem !important;
    }

    body.rsi-dashboard-page .rsi-dash-filter .rsi-op-btn {
        flex: 1 1 calc(50% - 0.4rem);
        text-align: center;
    }

    body.rsi-dashboard-page .rsi-panel-header {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0.65rem 0.75rem;
    }

    body.rsi-dashboard-page .rsi-panel-title {
        flex: 1 1 auto;
        min-width: 0;
    }

    body.rsi-dashboard-page .rsi-panel-title strong,
    body.rsi-dashboard-page .rsi-panel-title small {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    body.rsi-dashboard-page .rsi-panel-badge {
        flex: 0 1 auto;
        max-width: 100%;
        white-space: normal;
        text-align: center;
        line-height: 1.25;
    }

    body.rsi-dashboard-page .table-responsive,
    body.rsi-dashboard-page .signal-table {
        min-width: 0 !important;
    }
}

/* RTL parity (FA / AR): same chrome, mirrored text/search */
html[dir="rtl"] body.rsi-dashboard-page > .controls-header {
    justify-content: flex-start !important;
}

html[dir="rtl"] body.rsi-dashboard-page > .controls-header .controls-container {
    justify-content: flex-start !important;
}

html[dir="rtl"] body.rsi-dashboard-page > .controls-header .search-controls {
    direction: rtl;
}

html[dir="rtl"] body.rsi-dashboard-page > .controls-header .search-icon {
    right: 0.9rem !important;
    left: auto !important;
}

html[dir="rtl"] body.rsi-dashboard-page > .controls-header #searchInput {
    padding: 0.7rem 2.45rem 0.7rem 1rem !important;
}

html[dir="rtl"] body.rsi-dashboard-page .rsi-dash-filter,
html[dir="rtl"] body.rsi-dashboard-page .rsi-dash-filter-header,
html[dir="rtl"] body.rsi-dashboard-page .rsi-panel-header,
html[dir="rtl"] body.rsi-dashboard-page .rsi-filter-bar,
html[dir="rtl"] body.rsi-dashboard-page .page-header,
html[dir="rtl"] body.rsi-dashboard-page .breadcrumb-nav {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] body.rsi-dashboard-page .tables-container {
    display: grid !important;
    flex-direction: unset !important;
    direction: ltr;
    unicode-bidi: isolate;
}

/* Desktop only: keep Long/Short side-by-side. Mobile must stack (same as LTR). */
@media (min-width: 1101px) {
    html[dir="rtl"] body.rsi-dashboard-page .tables-container {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    }
}

@media (max-width: 1100px) {
    html[dir="rtl"] body.rsi-dashboard-page .tables-container {
        grid-template-columns: 1fr !important;
    }
}

html[dir="rtl"] body.rsi-dashboard-page .table-wrapper {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    min-width: 0 !important;
    width: 100% !important;
}

html[dir="rtl"] body.rsi-dashboard-page .table-responsive,
html[dir="rtl"] body.rsi-dashboard-page .signal-table {
    direction: ltr;
    unicode-bidi: isolate;
}

html[dir="rtl"] body.rsi-dashboard-page .signal-table th,
html[dir="rtl"] body.rsi-dashboard-page .signal-table td {
    text-align: center !important;
}

/* Symbol autocomplete — same language as symbol-detail */
body.rsi-dashboard-page .search-controls {
    position: relative !important;
    overflow: visible !important;
}

body.rsi-dashboard-page .search-results,
body.rsi-dashboard-page .rsi-dash-ac {
    position: absolute !important;
    z-index: 1200 !important;
    top: calc(100% + 0.4rem) !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: min(320px, 48vh) !important;
    margin-top: 0 !important;
    padding: 0.35rem !important;
    overflow: hidden !important;
    display: none !important;
    flex-direction: column !important;
    border: 1px solid var(--rsi-line) !important;
    border-radius: 14px !important;
    background: rgba(13, 21, 36, 0.98) !important;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45) !important;
    backdrop-filter: blur(8px);
}

/* Only show when open — empty dropdown must not reserve vertical space */
body.rsi-dashboard-page .search-results.is-open,
body.rsi-dashboard-page .rsi-dash-ac.is-open {
    display: flex !important;
}

body.rsi-dashboard-page .search-results-scrollable {
    overflow-y: auto !important;
    max-height: min(260px, 40vh) !important;
    padding: 0 !important;
    overscroll-behavior: contain;
}

body.rsi-dashboard-page .search-results-header {
    display: none !important;
}

body.rsi-dashboard-page .search-result-item {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1.4fr) minmax(3.2rem, 0.55fr) minmax(4.5rem, 0.9fr) !important;
    align-items: center !important;
    gap: 0.55rem !important;
    padding: 0.55rem 0.75rem !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: transparent !important;
    color: var(--rsi-text) !important;
    font: 600 0.9rem var(--rsi-body) !important;
    cursor: default !important;
    pointer-events: none !important;
    user-select: none;
}

body.rsi-dashboard-page .search-result-item.is-readonly:hover,
body.rsi-dashboard-page .search-result-item.is-readonly:active {
    background: transparent !important;
    color: var(--rsi-text) !important;
}

body.rsi-dashboard-page .search-result-item .rsi-ac-symbol {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-align: start;
}

body.rsi-dashboard-page .search-result-item .rsi-ac-symbol mark {
    background: rgba(234, 179, 8, 0.22);
    color: #fde68a;
    border-radius: 3px;
    padding: 0 0.1em;
}

body.rsi-dashboard-page .search-result-item .rsi-ac-rsi {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    text-align: end;
}

body.rsi-dashboard-page .search-result-item .rsi-ac-updated {
    color: var(--rsi-muted);
    font-size: 0.78rem;
    font-weight: 500;
    text-align: end;
    white-space: nowrap;
}

body.rsi-dashboard-page .search-result-item .rsi-ac-rsi.low-value { color: #34d399; }
body.rsi-dashboard-page .search-result-item .rsi-ac-rsi.high-value { color: #f87171; }
body.rsi-dashboard-page .search-result-item .rsi-ac-rsi.neutral-value { color: #fde68a; }

body.rsi-dashboard-page .search-result-count {
    padding: 0.65rem 0.85rem !important;
    color: var(--rsi-muted) !important;
    text-align: start !important;
    font-size: 0.8rem !important;
    background: transparent !important;
    border-top: 1px solid var(--rsi-line);
}

html[dir="rtl"] body.rsi-dashboard-page .search-result-item .rsi-ac-symbol {
    text-align: right;
}
