/* Custom Theme Scrollbars */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
    z-index: 100;
    transition: width 0.2s ease, height 0.2s ease;
}

::-webkit-scrollbar-track {
    background: #18181800;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: rgba(78, 78, 78, 0);
    border-radius: 10px;
    transition: background 0.2s ease, width 0.2s ease, height 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #00ccaa;
}

::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar:hover {
    width: 12px;
    height: 12px;
}

:root {
    --base-size: 16px;
}

* {
    box-sizing: border-box;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    /* Remove padding here to prevent the extra space */
    overflow: hidden;
    /* Force hide scrollbar by default */
    background: #000000;
    color: #ffffff;
    font-family: sans-serif;
    font-size: var(--base-size);
}

.header {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    padding: 10px 40px;
    background: linear-gradient(180deg, transparent 50%, rgba(0, 150, 255, 0.05)100%);
    border-bottom: solid 1px rgba(0, 150, 255, 0.2);
    z-index: 100;
    height: 5%;
}

.header-logo {
    margin-left: 10px;
    height: 1.4em;
    width: auto;
    vertical-align: middle;
}

h1 {
    color: #00ffcc;
    font-size: 1rem;
    margin: 0;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 6px;

}

.header-icon {
    margin-left: auto;
    padding-right: 10px;
}

.header-live-toggle {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: #888;
    background: transparent;
    font-size: 0.88rem;
    padding: 6px 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
    z-index: 10;
    border: none;
}

.header-live-toggle .live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.header-live-toggle.live-on {
    color: #00ffcc;
}

.header-live-toggle.live-on .live-dot {
    background: #ffeb3b;
    animation: live-dot-pulse 1.2s ease-in-out infinite;
}

.header-live-toggle.live-off {
    color: #888;
    opacity: 0.5;
}

.header-live-toggle:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.header-layout-toggle {
    position: absolute;
    left: 50%;
    transform: translateX(80px);
    color: #888;
    background: transparent;
    padding: 4px 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    z-index: 10;
    border: none;
    border-radius: 4px;
}

.header-layout-toggle:hover {
    color: #00ffcc;
}

.app-container.layout-landscape {
    flex-direction: column;
}

.app-container.layout-landscape .top-half {
    flex: none;
    height: 50%;
    width: 100%;
    bottom: auto;
    right: auto;
    border-bottom: solid 1px rgba(0, 150, 255, 0.2);
}

.app-container.layout-landscape .bottom-half {
    flex: none;
    height: 50%;
    width: 100%;
    top: auto;
    left: auto;
    margin: 0;
}

.app-container.layout-portrait {
    flex-direction: row;
}

.app-container.layout-portrait .top-half {
    flex: 1;
    height: 100%;
    width: auto;
    right: auto;
    bottom: auto;
    margin: 0;
    border-bottom: none;
}

.app-container.layout-portrait .bottom-half {
    flex: 1;
    height: 100%;
    top: auto;
    left: auto;
    margin: 0;
}

@keyframes live-dot-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 235, 59, 0.7);
    }

    70% {
        transform: scale(1.3);
        box-shadow: 0 0 0 14px rgba(255, 235, 59, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 235, 59, 0);
    }
}

.app-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 95%;
    box-sizing: border-box;
    padding: 5% 5%;
    position: relative;
    overflow: hidden;
    /* Allow scroll only if content actually exceeds height */
}

.top-half {
    flex: 1;
    height: 45vh;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(180deg, transparent 50%, rgba(0, 150, 255, 0.05)100%);
    border-bottom: solid 1px rgba(0, 150, 255, 0.2);
    position: relative;
    right: 0;
    bottom: 24px;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.chart-symbol-container {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
    border-radius: 6px;
    padding: 6px 8px;
    pointer-events: none;
    align-items: column;
}


.chart-symbol-top,
.chart-symbol-bottom {
    display: flex;
    gap: 12px;
    width: 100%;pointer-events: all;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.chart-symbol-top {
    transform: translateY(calc(-100% + 4px));
    opacity: 0;
}

.chart-symbol-top:hover {
    transform: translateY(0);
    opacity: 1;
}

.chart-symbol-bottom {
    transform: translateY(calc(100% - 4px));
    opacity: 0;
}

.chart-symbol-bottom:hover {
    transform: translateY(0);
    opacity: 1;
}

.chart-symbol-container.chart-hover .chart-symbol-top,
.chart-symbol-container.chart-hover .chart-symbol-bottom {
    transform: translateY(0);
    opacity: 1;
}

.chart-symbol-group,
.chart-controls {
    display: flex;
    align-items: end;
    gap: 8px;
}

.chart-symbol-group {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 8px;
    }

.chart-symbol-bottom {
    justify-content: center;
    align-items: center;
    position: relative;
    width: 100%;
    margin: auto;
    margin-bottom: 8px;
}

.chart-bottom-right {
    position: absolute;
    right: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-controls {
    flex: 0 0 auto;
    display: flex;
    align-items: end;
    gap: 8px;
}

#chartExchangeSelect {
    background: rgba(247, 243, 243, 0);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 8px 10px;
    font-size: 0.8rem;
    border-radius: 8px;
    appearance: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
}

#chartSymbolDisplay {
    top: 12px;
    color: #fff;
    font-weight: bold;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 8px 10px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
    text-overflow: ellipsis;
}

#chartSymbolDisplay::after {
    content: '▼';
    font-size: 0.8rem;
    opacity: 0.7;
    background: rgba(0, 0, 0, 0.108);
}

#chartSymbolSearch {
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    padding: 8px 10px;
    border-radius: 8px;
    outline: none;
    font-size: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    min-width: 100px;
}

#chartToggleBtn {
    width: 20px;
    height: 20px;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, background 0.2s ease;
    background: rgba(0, 0, 0, 0);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 0;
    margin:auto;
}

#chartTradesToggleBtn {
    width: 20px;
    height: 20px;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
    background: rgba(0, 0, 0, 0);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 0;
    margin:auto;
}

#chartTradesToggleBtn[aria-pressed="false"] {
    opacity: 0.35;
    margin:auto;
}

#chartLiquidationToggleBtn {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
    background: rgba(0, 0, 0, 0);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 0;
    margin: auto;
}

#chartLiquidationToggleBtn[aria-pressed="false"] {
    opacity: 0.35;
    margin: auto;
}

.toggle-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 255, 204, 0.15);
    border: 1px solid rgba(0, 255, 204, 0.5);
    border-radius: 6px;
    padding: 0;
    cursor: pointer;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.toggle-btn[aria-pressed="false"] {
    opacity: 0.35;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

#chartClearCacheBtn {
    width: 20px;
    height: 20px;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
    background: rgba(0, 0, 0, 0);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 0;
    cursor: pointer;
    margin:auto;
}

#chartClearCacheBtn:hover {
    color: #ff5577;
    border-color: rgba(255, 85, 119, 0.6);
}

#chartClearCacheBtn:disabled {
    cursor: default;
}

.chart-reset-btn {
    position: relative;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    z-index: 100;
    cursor: pointer;
    pointer-events: all;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.chart-reset-btn:hover {
    color: #00ffcc;
    border-color: rgba(0, 255, 204, 0.6);
    background: rgba(0, 0, 0, 0.65);
}

.symbol-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: rgba(0, 0, 0, 0.2895);
    border: 1px solid rgba(255, 255, 255, 0.15);
    max-height: 220px;
    width: fit-content;
    overflow: auto;
    display: none;
    z-index: 50;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    padding: 10px;

}

.symbol-suggestions.show {
    display: block;
    backdrop-filter: blur(4px);
}

.symbol-suggestions .suggestion-item {
    padding: 8px 10px;
    cursor: pointer;
    color: white;
    font-size: 0.8rem;
    backdrop-filter: blur(4px);

}

.symbol-suggestions .suggestion-item:hover {
    background: rgba(255, 255, 255, 0.02)s;
    backdrop-filter: blur(4px);

}

@keyframes pulse-dot {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}

.bottom-half {
    flex: 0 0 45%;
    margin: 6px;
    position: relative;
    overflow: hidden;
    left: 0;
    top: 24px;
}

#equityCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.5;
    pointer-events: none;
}

.bottom-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    height: 100%;
}

#backtest-settings-area {
    display: none;
}

#strategy-form {
    transition: opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.bottom-half:hover #strategy-form {
    opacity: 1;
    pointer-events: all;
}

.bottom-half.tap-open #strategy-form {
    opacity: 1;
    pointer-events: all;
}

#trade-list {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 400px;
    height: 60%;
    font-size: 0.8rem;
    margin: auto;
    overflow: auto;
    background: transparent;
    border-radius: 8px;
    z-index: 3;
    pointer-events: none;
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.bottom-half:hover #trade-list {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

.bottom-half.tap-open #trade-list {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

.profit-positive {
    color: #00ffcc !important;
}

.profit-negative {
    color: red !important;
}

.profit-neutral {
    color: white !important;
}

form {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    min-height: 0;
    margin: auto;
}

#strategy-form {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 100%;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 400px
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 30px;
}

label {
    flex: 1;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
}

input,
select,
select option {
    width: 90px;
    padding: 4px;
    text-align: center;
    background: rgba(51, 51, 51, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    font-size: 0.8em;
}

.setting-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    cursor: pointer;
    accent-color: #3a9eff;
}

.setting-row input[type="hidden"] {
    display: none;
}

select option {
    background: rgba(10, 10, 10, 0.95);
    color: white;
}

.step-btn,
button.step-btn {
    padding: 2px 8px;
    background: rgba(51, 51, 51, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    font-weight: bold;
}

.step-btn.dual-step,
button.step-btn.dual-step {
    width: 26px;
    min-width: 26px;
    height: 24px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.step-btn.step-sign-inner,
button.step-btn.step-sign-inner {
    font-size: 1.05rem;
}

.step-btn.step-sign-outer,
button.step-btn.step-sign-outer {
    font-size: 0.82rem;
}

.grid-direction-btn {
    color: #888;
}

.grid-direction-btn.active[data-direction="LONG"] {
    background: rgba(0, 255, 100, 0.18);
    border-color: rgba(0, 255, 100, 0.7);
    color: #00ff64;
}

.grid-direction-btn.active[data-direction="NEUTRAL"] {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.7);
    color: #ffffff;
}

.grid-direction-btn.active[data-direction="SHORT"] {
    background: rgba(255, 51, 102, 0.18);
    border-color: rgba(255, 51, 102, 0.7);
    color: #ff3366;
}

.grid-direction-row {
    justify-content: space-between;
    flex-wrap: nowrap;
}

.grid-direction-row label {
    flex: 0 0 auto;
    margin-right: 8px;
}


.direction-button-group {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    flex: 1 1 auto;
}

#profit-box {
    align-self: center;
    width: min(100%, 420px);
    margin: 0 auto 10px;
}

.action-row {
    display: flex;
    flex-direction: row;
    gap: 12px;
    width: 100%;
    justify-content: center;
    pointer-events: auto;
}

.action-row-split form {
    flex: 1;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    margin: 0;
}

.buttons {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 8px;
    background: #00ffcc0c;
    color: white;
    border: 1px solid #00ffcc40;
    font-size: 0.75em;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    padding: 10px;
    flex: 1;
    max-height: min-content;
    width: 100%;
    max-width: 400px;
    backdrop-filter: blur(5px);
    flex-wrap: nowrap;
}

#profits {
    flex-wrap: nowrap !important;
}



/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    width: min(100%, 560px);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: #11111179;
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 0 45px rgba(0, 255, 255, 0.5);
    backdrop-filter: blur(10px);
}

.modal-card h2 {
    margin: 0 0 10px;
    color: #00ffcc;
    font-size: 1rem;
    justify-content: space-between;

}

.modal-description {
    color: #ffffff;
    font-size: 0.8rem;
    margin-bottom: 18px;
}

.modal-summary,
.modal-grid {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;

}

.modal-summary div,
.modal-grid label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.8rem;
    color: #ddd;
}

#api-key-section label,
#webhook-section label {
    display: block;
    margin-bottom: 2px;
}

#api-key-section input,
#webhook-section input,
#webhook-section textarea {
    width: 100%;
    box-sizing: border-box;
    margin-top: 2px;
}

.modal-summary div strong {
    color: cyan;
    font-weight: bold;
}

.modal-grid input,
.modal-grid select {
    display: flex;
    width: min(300px, 100%);
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #333;
    background: #0f0f0f;
    color: white;
    margin-left: auto;
    box-sizing: border-box;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-actions .step-btn,
.modal-actions .run-btn {
    min-width: 120px;
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#modal-exchange,
#modal-symbol {
    background: #1a1a1a;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #333;
    border-top: 6px solid #00ffcc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: #00ffcc;
    font-weight: bold;
    margin-top: 15px;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.pct-text {
    color: #fff;
    font-size: 2rem;
    font-weight: bold;
    margin-top: 10px;
    font-family: monospace;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}


/* Bot Card Design */

.dashboard-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    overflow-y: auto;
    min-height: 0;
}

.bot-card {
    position: relative;
    background: #1a1a1a3b;
    border: 1px solid #ffffff4b;
    border-radius: 8px;
    overflow: cover;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    min-height: 250px;
    transition: border-color 0.3s ease;
    padding: 5px;
    width: 100%; 
}

.bot-card.profit {
    border: solid 1px #00ffcc2a;
}

.bot-card.loss {
    border: solid 1px rgba(255, 51, 102, 0.193);
}

.bot-card canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0.4;
    pointer-events: none;
    padding: 15px;
    padding-top: 50px;
    padding-bottom: 50px;
}

.bot-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    min-height: 0;
}

.bot-title {
    font-size: 0.8rem;
    font-weight: bold;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px;
    backdrop-filter: blur(4px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);

}

.bot-title-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-badge {
    background: rgba(0, 255, 0, 0.1);
    color: #00ffcc;
    padding: 4px 8px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: bold;
    border: 1px solid 00ffcc;
    margin-top: auto;
    margin-bottom: 0;
    height: fit-content;
}

.bot-settings-small {
    display: flex;
    font-size: 0.8em;
    color: #ccc;
}

.bot-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-top: auto;
    margin-bottom: 0;
    padding: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
}

.bot-stats > div {
    flex: 1;
    text-align: center;
    align-items: center;
    justify-content: center;
}

.bot-stats span {
    font-weight: bold;
    color: #fff;
    padding: 4px;
}

.bot-card.profit .active-bot-btn {
    background: #00ffcc2d;
    border-color: #00ffcc;
    color: #00ffcc;
}

.bot-card.loss .active-bot-btn {
    background: #ff33661e;
    border-color: #ff3366;
    color: #ff3366;
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #666;
    font-style: italic;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: bold;
    border: 1px solid;
}

.bot-live-pnl {
    font-size: 1rem;
    color: #00ffcc4b;
}

.status-badge.ACTIVE {
    background: #00ffcc23;
    color: #00ffcc;
    border-color: #00ffcc;
}

.bot-card.loss .status-badge.ACTIVE {
    background: #ff33661e;
    color: #ff3366;
    border-color: #ff3366;
}

.status-badge.STOPPED {
    background: rgba(100, 100, 100, 0.2);
    color: #888;
    border-color: #888;
}

.bot-card.STOPPED {
    filter: grayscale(100%);
    opacity: 0.6;
    /* pointer-events: none; */
}

.bot-card.STOPPED .run-btn {
    color: #ffffff !important;
}

/* In bot_detail.html: stopped bot chart area should be clickable */
.stopped-botcard-link {
    position: relative;
    display: block;
    text-decoration: none;
    color: inherit;
    z-index: 1;
}

.stopped-botcard-link-content {
    display: block;
}


.dimmed-content {
    opacity: 1 !important;
    filter: grayscale(100%) !important;
    pointer-events: none !important;
    /* Prevents scrolling or clicking on dimmed areas */
    transition: all 0.3s ease;
}

.history-spinner {
    width: 36px;
    height: 36px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    /* Faint background ring */
    border-top: 4px solid #00ffcc;
    /* Bright rotating part - matches your theme */
    border-radius: 50%;
    animation: history-spin 1s linear infinite;
}

#adjust-funds-input {
    width: 50%;
}

@keyframes history-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@media (min-width: 960px) {
    .dashboard-page {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 50px;
        height: 95vh;
        padding: 50px;
        padding-bottom: 70px;
    }

    .dashboard-page>.empty-state,
    .dashboard-page>#startup-splash-overlay,
    .dashboard-page>#offline-boot-overlay,
    .dashboard-page>script {
        grid-column: 1 / -1;
    }

        /* bot_detail.html profit box (JS injects inner flex wrapper) */
    #profit-box {
        flex-wrap: nowrap !important;
        overflow: hidden;
    }

    /* JS injects: #profit-box (span + inner flex wrapper div) */
    #profit-box>div {
        flex-wrap: nowrap !important;
    }

    /* Ensure all the profit raw items (col1/col2 blocks) stay on one row */
    #profit-box>div>div {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

#startup-splash-overlay,
#offline-boot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.94);
    z-index: 11000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    padding: 24px;
}

#offline-boot-overlay {
    display: none;
    z-index: 11010;
}

.startup-title {
    color: #00ffcc;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.startup-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    max-width: 520px;
}

.startup-retry-btn {
    margin-top: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #00ffcc40;
    background: rgba(0, 255, 204, 0.15);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}






/* Keep Dir value (LONG/SHORT/FLAT) vertically centered within its metric column */
#profit-box .profit-metrics-row {
    align-items: center;
}

#profit-box .profit-metrics-row .dir-col {
    justify-content: center;
}

#profit-box .profit-metrics-row .win-desktop-summary span {
    font-size: 0.82em;
    font-weight: 400;
    color: #c8c8c8;
    text-transform: none;
    letter-spacing: 0;
}


@media (max-width: 960px) {
    :root {
        --base-size: 18px;
        /* Everything using rem now automatically increases */
    }

    .profit-box {
        font-size: 0.6rem;
    }
    #profit-box .profit-metrics-row {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-evenly;
        align-items: flex-start;
        row-gap: 4px;
    }

    #profit-box .profit-metrics-row .win-col {
        flex: 0 0 100%;
        width: 100%;
        text-align: center;
        margin-top: 2px;
        flex-wrap: nowrap;
    }

    #profit-box .profit-metrics-row .win-desktop-summary {
        flex-direction: row !important;
        justify-content: center;
        gap: 8px !important;
    }

    #profit-box .profit-metrics-row .win-mobile-summary {
        justify-content: center;
        align-items: center;
        white-space: nowrap;
    }

    #profit-box .profit-metrics-row .win-mobile-summary span {
        font-size: 0.68rem;
        font-weight: 400;
        color: #b8b8b8;
        letter-spacing: 0;
        text-transform: none;
    }

    .trade-list {
        width: 100%;
    }

}

@media (orientation: landscape) {
    .app-container:not(.layout-landscape):not(.layout-portrait) {
        flex-direction: row;
        flex-wrap: wrap;
        overflow-y: auto;
    }

    .app-container:not(.layout-landscape):not(.layout-portrait) .header {
        flex: 0 0 100%;
    }

    .app-container:not(.layout-landscape):not(.layout-portrait) .top-half {
        height: 100%;
        flex: 1;
        right: 24px;
        bottom: 0px;
    }

    .app-container:not(.layout-landscape):not(.layout-portrait) .bottom-half {
        flex: 0 0 45%;
        height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
        left: 24px;
        top:0;

    }
}

@media (max-height: 600px) {
    .header {
        height: 12%;
    }

    .app-container {
        height: 90%;
        padding: 2% 5%;
    }
}

@media (min-width: 600px) {
    .info-box>div {
        flex-wrap: nowrap !important;
    }
    .bot-card {
        margin-bottom: 30px;
    }
}

#ctx-menu {
    display: none;
    position: fixed;
    z-index: 99999;
    background: #1e1e2e;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 4px 0;
    min-width: 120px;
    box-shadow: 0 4px 16px rgba(0,0,0,.5);
    font-family: inherit;
    font-size: 13px;
}
#ctx-menu .ctx-item {
    padding: 6px 16px;
    cursor: pointer;
    color: #ddd;
    white-space: nowrap;
}
#ctx-menu .ctx-item:hover {
    background: rgba(100,150,255,.2);
}
#ctx-menu .ctx-item.disabled {
    color: #666;
    cursor: default;
}
#ctx-menu .ctx-item.disabled:hover {
    background: transparent;
}