/* ================= Professional Trading UI - Glassmorphism Pro ================= */

:root {
    --safe-bottom: env(safe-area-inset-bottom, 20px);
}

/* GLOBAL RESET & SCROLL */
html, body { 
    height: auto !important; 
    overflow: auto !important; 
    overflow-x: hidden !important;
}

body { 
    margin: 0; 
    background: var(--bg-base); 
    font-family: 'Vazirmatn', 'Inter', Tahoma, sans-serif; 
    color: var(--text-main); 
    direction: rtl; 
    min-height: 100vh;
    font-size: 17px;
}

/* Loading Overlay */
.loader-overlay {
    position: fixed; inset: 0; background: var(--bg-base); z-index: 9999;
    display: flex; align-items: center; justify-content: center; transition: opacity 0.5s ease;
}
.loader-content { display: flex; flex-direction: column; align-items: center; gap: 20px; color: var(--text-main); }
.spinner { width: 40px; height: 40px; border: 3px solid var(--glass-border); border-top: 3px solid var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Main Dashboard Structure */
.trading-dashboard { 
    display: flex;
    flex-direction: column;
    gap: 20px; 
    padding: 20px; 
    max-width: 1450px;
    margin: 0 auto;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    align-items: start;
}

/* Glass Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px 0 var(--glass-shadow);
    transition: background 0.3s, border 0.3s;
}

/* Modern Header & Wallet */
.wallet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    background: var(--glass-bg);
    border: 1px solid rgba(var(--tp-accent-rgb), 0.25);
    padding: 20px 30px;
}

.account-mode-switcher {
    display: flex;
    background: var(--tp-inset);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}
.mode-btn {
    padding: 8px 18px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 9px;
    cursor: pointer;
    font-weight: 800;
    font-size: 13px;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}
.mode-btn.active { background: var(--primary); color: var(--tp-text); }
.mode-btn i { width: 16px; height: 16px; }

.wallet-info { display: flex; gap: 40px; align-items: center; }
.wallet-item { display: flex; flex-direction: column; gap: 2px; }
.wallet-label { font-size: 14px; color: var(--text-muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.wallet-value { font-size: 28px; font-weight: 900; color: var(--primary); letter-spacing: -0.5px; }

.badge-v { background: var(--warning); color: #000; font-size: 8px; font-weight: 900; padding: 2px 5px; border-radius: 4px; margin-right: 8px; }

.wallet-actions { display: flex; gap: 10px; align-items: center; }
.btn-action {
    background: var(--glass-hover);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 10px 18px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 13px;
    font-family: inherit;
    transition: 0.2s;
}
.btn-action:hover { border-color: var(--primary); color: var(--primary); }
.btn-upgrade-special { background: linear-gradient(135deg, #f59e0b, #d97706); color: #000; border: none; }

/* Main Content Area */
.main-content { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.top-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.symbol-section { display: flex; align-items: center; gap: 16px; }

select#symbol-select {
    background: var(--glass-hover); color: var(--text-main); border: 1px solid var(--glass-border);
    padding: 10px 15px; border-radius: 12px; font-family: inherit; font-size: 15px; outline: none;
}

#current-price { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
#price-change { font-size: 14px; font-weight: 600; padding: 4px 10px; border-radius: 8px; }

.timeframes { display: flex; gap: 6px; background: var(--glass-hover); padding: 5px; border-radius: 14px; }
.tf-btn { padding: 8px 16px; border: none; background: transparent; color: var(--text-muted); border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 700; transition: 0.2s; }
.tf-btn.active { background: var(--primary); color: var(--tp-text); }

/* Chart Container */
#chart-container {
    width: 100%;
    height: 700px;
    border-radius: 20px;
    overflow: hidden;
    background: #000;
    border: 1px solid var(--glass-border);
}

/* ── ابزارهای نمودار (تولبار حرفه‌ای) ── */
.chart-tf-dd { display: none; }
.chart-tool-btn:hover,
.chart-tool-open { border-color: var(--primary) !important; color: var(--primary) !important; }
.chart-popover button:hover { border-color: var(--primary) !important; }

/* NO WHITE SQUARES FIX - Strict Theme Styling */
input[type="number"], input[type="text"], input[type="password"], select {
    background: var(--glass-bg) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-main) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 12px;
    font-family: inherit;
    outline: none;
}
input:focus, select:focus {
    border-color: var(--primary) !important;
    background: var(--glass-hover) !important;
}

/* Trade Controls */
.trade-controls { display: flex; flex-direction: column; gap: 15px; background: var(--glass-bg); }
.control-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.input-group label { font-size: 11px; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; display: block; }

.trade-preview { display: flex; flex-direction: column; gap: 8px; padding: 15px; background: rgba(var(--tp-accent-rgb), 0.05); border-radius: 14px; border: 1px dashed rgba(var(--tp-accent-rgb), 0.3); }
.calc-item { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-muted); }
.calc-item strong { color: var(--text-main); }

/* Trade Actions */
.trade-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 5px; }
.btn-trade { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 18px; border: none; border-radius: 18px; font-size: 18px; font-weight: 800; cursor: pointer; transition: 0.1s; color: var(--tp-text); font-family: inherit; }
.btn-buy { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 8px 20px rgba(16, 185, 129, 0.2); }
.btn-sell { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 8px 20px rgba(239, 68, 68, 0.2); }

/* Sidebar details */
.trading-details { display: flex; flex-direction: column; gap: 20px; }
.trading-details h3 { font-size: 15px; margin-bottom: 15px; color: var(--text-muted); display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--glass-border); padding-bottom: 12px; }

/* Bot Control */
.bot-control-panel { border: 1px solid rgba(var(--tp-accent-rgb), 0.3); background: var(--glass-bg); }
.bot-status-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding: 10px; background: rgba(255,255,255,0.03); border-radius: 12px; }

.switch { position: relative; display: inline-block; width: 48px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background-color: #334155; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(23px); }

.bot-mini-log { font-size: 11px; color: var(--primary); background: var(--tp-inset); padding: 12px; border-radius: 10px; font-family: monospace; min-height: 45px; border: 1px solid rgba(var(--tp-accent-rgb), 0.1); }

/* Signal & Analysis Display */
.analysis-item { display: flex; justify-content: space-between; font-size: 13px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.signal-badge { padding: 12px 24px; border-radius: 15px; font-weight: 900; font-size: 17px; margin-bottom: 20px; display: inline-block; box-shadow: 0 10px 25px rgba(0,0,0,0.3); }

/* Success Meter */
.chance-bar { height: 16px; background: var(--tp-inset); border-radius: 8px; overflow: hidden; margin-bottom: 12px; border: 1px solid var(--glass-border); }
.chance-fill { height: 100%; width: 0%; border-radius: 8px; transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1); }
#chance-percent { font-size: 28px; font-weight: 900; text-align: center; color: var(--primary); }

/* Watchlist Pro */
.watchlist-container { margin-top: 10px; padding: 0; overflow: hidden; }
.watchlist-header { padding: 25px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--glass-border); flex-wrap: wrap; gap: 20px; }

.add-symbol-pro { display: flex; align-items: center; gap: 15px; }
.search-container { position: relative; width: 280px; }
.search-container input {
    width: 100%;
}
.search-container input::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.75 !important;
}

.search-results { position: absolute; top: calc(100% + 5px); left: 0; right: 0; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 12px; z-index: 5000; display: none; max-height: 250px; overflow-y: auto; box-shadow: 0 10px 40px rgba(0,0,0,0.15); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.search-item { padding: 12px 18px; cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--glass-border); color: var(--text-main); }
.search-item:hover { background: var(--primary); color: var(--tp-text) !important; }

.quick-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-tags button { background: var(--glass-hover); border: 1px solid var(--glass-border); color: var(--text-main); padding: 5px 12px; border-radius: 8px; cursor: pointer; font-size: 12px; transition: 0.2s; font-weight: 600; font-family: inherit; }
.quick-tags button:hover { background: var(--primary); color: var(--tp-text); border-color: var(--primary); }

.watchlist-table th { padding: 18px 25px; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.5px; border-bottom: 1px solid var(--glass-border); background: var(--glass-hover); }
.watchlist-table td { padding: 18px 25px; border-bottom: 1px solid var(--glass-border); font-size: 14px; color: var(--text-main); }

.mini-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--glass-border); background: var(--glass-hover); color: var(--text-main); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: 0.2s; }
.mini-btn:hover { background: var(--primary); transform: scale(1.1); color: var(--tp-text); }
.mini-btn.buy { color: #10b981; }
.mini-btn.sell { color: #ef4444; }

/* Modal Visibility Fix */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(15px);
    z-index: 10000; display: none !important; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.show { display: flex !important; }
.modal-content { max-width: 450px; width: 100%; }

/* Responsive Adjustments */
@media (max-width: 1150px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .trading-details { order: 2; }
}

/* ================= WATCHLIST FIX ================= */
.watchlist-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.watchlist-table { width: 100%; border-collapse: collapse; min-width: 800px; }
.watchlist-table th { text-align: right; padding: 12px 20px; font-size: 11px; color: var(--text-muted); border-bottom: 1px solid var(--glass-border); }
.watchlist-table td { text-align: right; padding: 14px 20px; border-bottom: 1px solid var(--glass-border); font-size: 14px; }
.search-container input {
    width: 100%;
}
.watchlist-price { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--text-main); }
.change-positive { color: #10b981; font-weight: 600; }
.change-negative { color: #ef4444; font-weight: 600; }
.conf-badge { background: rgba(var(--tp-accent-rgb),0.15); padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 700; }
.row-blinking { animation: rowBlink 1.5s ease-in-out infinite; }
@keyframes rowBlink { 0%,100% { background: transparent; } 50% { background: rgba(var(--tp-accent-rgb),0.08); } }
@keyframes wl-pulse-buy {
    0%, 100% {
        background: rgba(16, 185, 129, 0.15);
        box-shadow: 0 0 0 0px rgba(16, 185, 129, 0.45);
    }
    50% {
        background: rgba(16, 185, 129, 0.45);
        box-shadow: 0 0 12px 2px rgba(16, 185, 129, 0.7);
        border-color: rgba(16, 185, 129, 0.6) !important;
    }
}
@keyframes wl-pulse-sell {
    0%, 100% {
        background: rgba(239, 68, 68, 0.15);
        box-shadow: 0 0 0 0px rgba(239, 68, 68, 0.45);
    }
    50% {
        background: rgba(239, 68, 68, 0.45);
        box-shadow: 0 0 12px 2px rgba(239, 68, 68, 0.7);
        border-color: rgba(239, 68, 68, 0.6) !important;
    }
}
.mini-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--glass-border); background: var(--glass-hover); color: var(--text-main); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.mini-btn:hover { background: var(--primary); transform: scale(1.05); }
.mini-btn.buy { color: #10b981; border-color: rgba(16,185,129,0.3); }
.mini-btn.sell { color: #ef4444; border-color: rgba(239,68,68,0.3); }
.watchlist-sym { font-weight: 700; color: var(--primary); }

@media (max-width: 768px) {
    .watchlist-header {
        padding: 15px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 15px !important;
    }
    .add-symbol-pro {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        width: 100% !important;
    }
    .search-container {
        width: 100% !important;
    }
    .search-container input {
        width: 100% !important;
    }
    .quick-tags {
        justify-content: flex-start !important;
        gap: 6px !important;
        width: 100% !important;
    }
    .quick-tags button {
        flex: 1 !important;
        text-align: center !important;
        padding: 8px 5px !important;
    }
}

/* ================= CHANCE METER PRO ================= */
.chance-meter-container { padding: 10px 0; }
.chance-bar { 
    height: 20px; 
    background: var(--tp-inset); 
    border-radius: 10px; 
    overflow: hidden; 
    margin-bottom: 20px; 
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.3);
}
.chance-fill { 
    height: 100%; 
    width: 0%; 
    border-radius: 10px; 
    transition: width 1.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.5s ease;
    position: relative;
}
.chance-fill::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 40px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
    border-radius: 0 10px 10px 0;
}
#chance-percent { 
    font-size: 48px; 
    font-weight: 900; 
    text-align: center; 
    color: var(--primary);
    transition: all 0.5s ease;
    letter-spacing: -2px;
}
@keyframes pulse-glow {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.85; }
}

/* PRO BOT CSS */
.bot-mode-btn { transition: all 0.2s; }
.bot-mode-btn:hover { transform: translateY(-2px); }
.bot-mode-btn.active { box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.bot-side-btn { transition: all 0.2s; }
.bot-side-btn:hover { transform: translateY(-1px); }
.bot-side-btn.active { box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
#bot-threshold-slider { -webkit-appearance: none; appearance: none; height: 8px; border-radius: 4px; background: rgba(255,255,255,0.1); outline: none; }
#bot-threshold-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); cursor: pointer; box-shadow: 0 0 10px rgba(var(--tp-accent-rgb),0.5); }
.bot-log-entry { padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.03); animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }

/* ================= PRO BOT CSS ================= */
.bot-mode-btn { transition: all 0.2s; }
.bot-mode-btn:hover { transform: translateY(-2px); }
.bot-mode-btn.active { box-shadow: 0 4px 12px rgba(0,0,0,0.2); }

.bot-side-btn { transition: all 0.2s; }
.bot-side-btn:hover { transform: translateY(-1px); }
.bot-side-btn.active { box-shadow: 0 2px 8px rgba(0,0,0,0.15); }

#bot-threshold-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  outline: none;
}
#bot-threshold-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(var(--tp-accent-rgb),0.5);
}
#bot-threshold-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 10px rgba(var(--tp-accent-rgb),0.5);
}

.bot-log-entry {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Inline SVG icon colors */
.analysis-icon { display:inline-flex; vertical-align:middle; margin-left:6px; }
.icon-rsi { color:var(--primary); }
.icon-macd { color:#10b981; }
.icon-ichi { color:var(--primary); }

/* Analysis Panel - Coordinated Design */
.analysis-grid { font-size:13px; line-height:1.8; }
.analysis-row { 
  display:flex; 
  align-items:center; 
  justify-content:flex-end; 
  gap:12px; 
  padding:6px 0; 
  border-bottom:1px solid rgba(255,255,255,0.03);
}
.analysis-row:last-of-type { border-bottom:none; }
.analysis-label { 
  display:flex; 
  align-items:center; 
  gap:8px; 
  color:var(--text-muted); 
  font-size:13px;
  min-width:100px;
  justify-content:flex-end;
}
.analysis-label strong { color:var(--text-main); font-weight:600; }
.analysis-value { 
  font-weight:700; 
  font-size:14px; 
  min-width:50px; 
  text-align:center;
  font-family:'JetBrains Mono',monospace;
}
.analysis-status { 
  font-size:12px; 
  opacity:0.9; 
  min-width:90px; 
  text-align:right;
}
.analysis-reasons {
  margin-top:12px;
  padding-top:12px;
  border-top:1px solid rgba(255,255,255,0.08);
  color:var(--text-muted);
  font-size:12px;
  line-height:1.6;
}
.analysis-reasons strong { color:var(--primary); }
.ind-icon { 
  width:18px; 
  height:18px; 
  display:inline-flex;
  vertical-align:middle;
}

/* ================= PREMIUM SETTINGS MODAL ================= */
.premium-modal {
    max-width: 500px !important;
    padding: 0 !important;
    overflow: hidden;
    border: 1px solid rgba(var(--tp-accent-rgb), 0.3) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
}

.modal-header-fancy {
    background: linear-gradient(135deg, rgba(var(--tp-accent-rgb), 0.2), rgba(var(--tp-accent-rgb), 0.1));
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

.header-icon-container {
    width: 50px;
    height: 50px;
    background: rgba(var(--tp-accent-rgb), 0.2);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    border: 1px solid rgba(var(--tp-accent-rgb), 0.3);
}

.header-text h3 { margin: 0; font-size: 18px; color: var(--text-main); font-weight: 800; }
.header-text span { font-size: 12px; color: var(--text-muted); }

.close-modal-fancy {
    position: absolute;
    top: 20px; left: 20px;
    background: var(--glass-hover);
    border: none; color: var(--text-main);
    width: 30px; height: 30px;
    border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
.close-modal-fancy:hover { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

.security-notice {
    margin: 20px 25px;
    padding: 12px 15px;
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: #10b981;
}

.input-grid { padding: 0 25px; display: flex; flex-direction: column; gap: 18px; }

.input-group-fancy label {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--text-muted);
    font-weight: 600; margin-bottom: 8px;
}
.input-group-fancy label i { width: 14px; height: 14px; color: var(--primary); }

.input-group-fancy input, .input-group-fancy select {
    width: 100%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 12px 15px;
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 14px;
    transition: 0.3s;
}
.input-group-fancy input:focus, .input-group-fancy select:focus {
    border-color: var(--primary);
    background: rgba(var(--tp-accent-rgb), 0.05);
    outline: none;
    box-shadow: 0 0 15px rgba(var(--tp-accent-rgb), 0.15);
}

.action-footer {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.btn-premium-save {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--primary), var(--primary));
    border: none;
    border-radius: 14px;
    color: var(--tp-text);
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 20px rgba(var(--tp-accent-rgb), 0.3);
}
.btn-premium-save:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 25px rgba(var(--tp-accent-rgb), 0.4);
}

.status-indicator-fancy {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}
.status-indicator-fancy .dot {
    width: 8px; height: 8px;
    background: #94a3b8;
    border-radius: 50%;
}
.status-indicator-fancy.online { color: #10b981; }
.status-indicator-fancy.online .dot { background: #10b981; box-shadow: 0 0 10px #10b981; }

.icon-pulse { animation: iconPulse 2s infinite; }
@keyframes iconPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* Password Visibility Toggle */
.password-wrapper {
    position: relative;
    width: 100%;
}
.btn-toggle-password {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    padding: 8px;
    z-index: 5;
}
.btn-toggle-password:hover {
    color: var(--primary);
}
.btn-toggle-password i {
    width: 18px;
    height: 18px;
}

/* ================= STATEMENT MODAL STYLES ================= */
.statement-wide {
    max-width: 700px !important;
    width: 95%;
}

.statement-summary-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 20px 25px;
}

.stat-mini-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 14px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-mini-card .label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-mini-card strong {
    font-size: 18px;
    color: var(--text-main);
}

.ledger-container {
    margin: 0 25px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--glass-bg);
    border-radius: 14px;
    border: 1px solid var(--glass-border);
}

.ledger-table {
    width: 100%;
    border-collapse: collapse;
}

.ledger-table th {
    position: sticky;
    top: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    padding: 12px 15px;
    text-align: right;
    font-size: 11px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
    z-index: 10;
}

.ledger-table td {
    padding: 12px 15px;
    font-size: 13px;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-main);
}

.type-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.type-profit { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.type-loss { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.type-fee { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.type-deposit { background: rgba(var(--tp-accent-rgb), 0.15); color: var(--primary); }

.ledger-amount { font-family: monospace; font-weight: 700; }
.amount-pos { color: #10b981; }
.amount-neg { color: #ef4444; }

.btn-premium-close {
    width: 100%;
    padding: 12px;
    background: var(--glass-hover);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    cursor: pointer;
    transition: 0.2s;
}

.btn-premium-close:hover {
    background: var(--primary);
    color: var(--tp-text);
}

@media (max-width: 600px) {
    .statement-summary-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .trading-dashboard { padding: 8px 8px 100px 8px !important; gap: 10px; }
    .watchlist-header { padding: 12px !important; }
    .add-symbol-pro { gap: 8px !important; }
    .search-container { width: 100% !important; }
    .quick-tags { gap: 4px !important; }
    .quick-tags button { padding: 4px 8px !important; font-size: 11px !important; }
    
    #chart-container { height: 600px !important; }

    /* ── موبایل: order book زیر نمودار + تولبار تک‌ردیفهٔ اسکرولی ── */
    .chart-main-area { flex-direction: column !important; }
    .chart-ob-sidebar {
        width: 100% !important;
        flex-shrink: 0 !important;
        flex-direction: row !important;
        height: 168px !important;
        border-left: none !important;
        border-top: 1px solid var(--glass-border) !important;
    }
    .chart-ob-sidebar .chart-ob-col,
    .chart-ob-sidebar .chart-tr-col {
        flex: 1 1 50% !important;
        min-width: 0 !important;
        min-height: 0 !important;
    }
    .chart-ob-sidebar .chart-tr-col { border-right: 1px solid var(--glass-border); }
    .chart-ob-sidebar .chart-tr-body { height: auto !important; flex: 1 !important; }
    /* تولبار: به‌جای شکستن چندردیفه، تک‌ردیفهٔ اسکرول‌افقی */
    .chart-toolbar {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
    }
    .chart-toolbar > * { flex-shrink: 0 !important; }
    /* تایم‌فریم: inline مخفی، کشویی نمایش */
    .chart-tf-inline { display: none !important; }
    .chart-tf-dd { display: inline-flex !important; align-items: center; }
    /* صرفه‌جویی فضا: نمایش OHLC در موبایل حذف */
    .chart-ohlc { display: none !important; }

    .watchlist-table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .watchlist-table {
        min-width: 100% !important;
        width: 100% !important;
    }
    .watchlist-table th, .watchlist-table td {
        padding: 5px 2px !important; /* Extremely compact gaps for full screen view */
        font-size: 10px !important;
    }
    .watchlist-table td div {
        font-size: 10px !important;
    }
    .watchlist-table td span {
        font-size: 9px !important;
        padding: 2px 3px !important;
    }
    .watchlist-table td button {
        padding: 3px 4px !important;
        font-size: 9px !important;
    }
    .watchlist-price {
        font-size: 10px !important;
    }
}

/* Professional Chart Toolbar Styles */
.chart-v-toolbar {
    background: rgba(15, 15, 25, 0.4) !important;
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    transition: width 0.3s ease;
}

.tool-btn {
    position: relative;
    color: #94a3b8;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: rgba(var(--tp-accent-rgb), 0.1);
    color: var(--primary);
}

.tool-btn.active {
    background: rgba(var(--tp-accent-rgb), 0.2) !important;
    color: var(--primary) !important;
    box-shadow: inset 0 0 10px rgba(var(--tp-accent-rgb), 0.1);
}

.tool-btn::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    margin-left: 10px;
    padding: 4px 8px;
    background: #1e293b;
    color: #fff;
    font-size: 11px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 100;
}

.tool-btn:hover::after {
    opacity: 1;
}

#chart-container {
    background: #0a0a0f;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.tv-lightweight-charts {
    border-radius: 0 12px 12px 0;
}

/* Absolute Layer Fix to prevent overlaps */
.v-toolbar { z-index: 200 !important; }
#chart-container { position: relative; z-index: 10; }
.tool-btn { pointer-events: auto !important; }

/* Tooltip fix */
.tool-btn:hover::after {
    content: attr(title);
    position: absolute;
    right: -100px;
    background: #333;
    padding: 5px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 300;
}


/* ── Layout: desktop 2-col, mobile 1-col ── */
@media (min-width: 769px) {
  .dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    grid-template-areas:
      "main    sidebar"
      "watch   sidebar";
    gap: 20px;
    align-items: start;
  }
  .main-content        { grid-area: main;    }
  .watchlist-container { grid-area: watch;   }
  .trading-details     { grid-area: sidebar; }
}

@media (max-width: 768px) {
  .dashboard-grid {
    display: flex !important;
    flex-direction: column;
    gap: 16px;
  }
  .main-content,
  .watchlist-container,
  .trading-details {
    width: 100% !important;
    grid-area: unset !important;
  }
}

/* ── Fix Layout: watchlist زیر main-content ── */
@media (min-width: 769px) {
  .dashboard-grid {
    display: grid !important;
    grid-template-columns: 1fr 400px !important;
    grid-template-rows: auto auto !important;
    grid-template-areas:
      "main    sidebar"
      "watch   sidebar" !important;
    align-items: start;
  }
  .main-content        { grid-area: main !important; }
  .trading-details     { grid-area: sidebar !important; }
  .watchlist-container { grid-area: watch !important; margin-top: 0 !important; }
}

@media (max-width: 768px) {
  .dashboard-grid {
    display: flex !important;
    flex-direction: column !important;
  }
  .watchlist-container { order: 3; }
  .trading-details     { order: 2; }
  .main-content        { order: 1; }
}

/* ── حذف گپ بین trade-controls و watchlist ── */
.main-content { gap: 0 !important; }
.watchlist-container { margin-top: 20px !important; }

/* ── حذف گپ grid بین ردیف‌ها ── */
@media (min-width: 769px) {
  .dashboard-grid {
    row-gap: 0 !important;
    column-gap: 20px !important;
  }
  .watchlist-container {
    margin-top: 20px !important;
    padding-top: 0 !important;
  }
}

/* ── Remove gap between main-content and watchlist ── */
.trade-controls { margin-bottom: 0 !important; }
.main-content > *:last-child { margin-bottom: 0 !important; }
.watchlist-container { margin-top: 0 !important; padding-top: 0 !important; }



/* ═══════════════════════════════════════════════════════
   BOT UI COLOR FIX — اصلاح کنتراست و رنگ‌بندی ربات
   ═══════════════════════════════════════════════════════ */

/* ── متغیرهای رنگ معنادار ── */
:root {
  --c-profit:      #3B6D11;
  --c-profit-bg:   #EAF3DE;
  --c-profit-bdr:  #C0DD97;
  --c-loss:        #A32D2D;
  --c-loss-bg:     #FCEBEB;
  --c-loss-bdr:    #F7C1C1;
  --c-warn:        #854F0B;
  --c-warn-bg:     #FAEEDA;
  --c-warn-bdr:    #FAC775;
  --c-info:        #185FA5;
  --c-info-bg:     #E6F1FB;
  --c-info-bdr:    #B5D4F4;
  --c-teal:        #0F6E56;
  --c-teal-bg:     #E1F5EE;
  --c-teal-bdr:    #9FE1CB;
  --c-surface:     rgba(0,0,0,0.04);
  --c-border:      rgba(0,0,0,0.1);
}

/* ── کارت ربات ── */
.bot-card,
.bot-panel,
.bot-container,
[class*="bot-card"],
[class*="bot-panel"] {
  background: #fff !important;
  border: 0.5px solid var(--c-border) !important;
  border-radius: 12px !important;
  color: #111 !important;
}

/* ── تگ‌های Classic / دمو / SCALPING ── */
.badge-classic, .tag-classic,
span[class*="classic"] {
  background: var(--c-warn-bg)  !important;
  color:       var(--c-warn)    !important;
  border: 0.5px solid var(--c-warn-bdr) !important;
  border-radius: 6px !important;
  padding: 2px 10px !important;
  font-size: 11px !important;
  font-weight: 500 !important;
}
.badge-demo, .tag-demo,
span[class*="demo-tag"] {
  background: var(--c-info-bg)  !important;
  color:       var(--c-info)    !important;
  border: 0.5px solid var(--c-info-bdr) !important;
  border-radius: 6px !important;
  padding: 2px 10px !important;
  font-size: 11px !important;
  font-weight: 500 !important;
}
.badge-scalping, .tag-scalping,
span[class*="scalp"] {
  background: var(--c-teal-bg)  !important;
  color:       var(--c-teal)    !important;
  border: 0.5px solid var(--c-teal-bdr) !important;
  border-radius: 6px !important;
  padding: 2px 10px !important;
  font-size: 11px !important;
  font-weight: 500 !important;
}

/* ── سود / ضرر / هشدار ── */
.profit, .pos-val, .text-success,
[class*="profit"], [class*="pos-pnl"] {
  color: var(--c-profit) !important;
}
.loss, .neg-val, .text-danger, .float-neg,
[class*="loss"], [class*="neg-pnl"],
[class*="float-badge"] {
  color:      var(--c-loss)    !important;
  background: var(--c-loss-bg) !important;
  border-color: var(--c-loss-bdr) !important;
}
.warn-val, .text-warning,
[class*="warn-val"] {
  color: var(--c-warn) !important;
}

/* ── آمار — stat cell ── */
.stat-cell, .stat-card,
[class*="stat-box"], [class*="stat-cell"] {
  background:    var(--c-surface) !important;
  border-radius: 8px !important;
  padding:       10px 12px !important;
  border:        none !important;
}
.stat-label, .stat-title,
[class*="stat-label"] {
  font-size: 11px !important;
  color: rgba(0,0,0,0.5) !important;
  margin-bottom: 4px !important;
}
.stat-value, .stat-num,
[class*="stat-value"] {
  font-size:   14px !important;
  font-weight: 500 !important;
  color:       #111 !important;
}

/* ── Intelligence Terminal ── */
.intelligence-terminal,
#intelligence-terminal,
[id*="intel-term"],
[class*="intel-terminal"],
[class*="bot-terminal"] {
  background:    #1e2028 !important;
  border-radius: 12px !important;
  padding:       1rem 1.25rem !important;
  color:         #cbd5e1 !important;
  font-family:   monospace !important;
  border:        none !important;
}
.terminal-line,
[class*="log-line"],
[class*="term-row"],
[class*="terminal-row"] {
  font-size:   12px !important;
  color:       #94a3b8 !important;
  padding:     3px 0 !important;
  background:  transparent !important;
  border:      none !important;
}
.log-ok   { color: #86efac !important; }
.log-err  { color: #fca5a5 !important; }
.log-warn { color: #fde68a !important; }
.log-info { color: #93c5fd !important; }
.term-time { color: #475569 !important; }

/* ── BOT HEALTH MONITOR ── */
.bot-health-card,
#bot-health-monitor,
[id*="botHealth"],
[class*="health-monitor"],
[class*="bot-health"] {
  background:    #fff !important;
  border:        0.5px solid var(--c-border) !important;
  border-radius: 12px !important;
  color:         #111 !important;
}
.health-stat-val {
  font-size:   15px !important;
  font-weight: 500 !important;
  color:       #111 !important;
}
.health-stat-label {
  font-size: 11px !important;
  color:     rgba(0,0,0,0.5) !important;
}

/* ── چک‌لیست health ── */
.checker-row,
[class*="health-check-row"],
[class*="check-item"] {
  background:    var(--c-surface) !important;
  border-radius: 8px !important;
  padding:       6px 10px !important;
  font-size:     13px !important;
  color:         rgba(0,0,0,0.65) !important;
  border:        none !important;
}
.cb-ok, .badge-ok, [class*="checker-ok"] {
  background:   var(--c-teal-bg) !important;
  color:        var(--c-teal)    !important;
  border-color: var(--c-teal-bdr) !important;
  border-radius: 6px !important;
  padding: 2px 10px !important;
  font-size: 11px !important;
  font-weight: 500 !important;
}
.cb-warn, .badge-warn, [class*="checker-warn"] {
  background:   var(--c-warn-bg) !important;
  color:        var(--c-warn)    !important;
  border-color: var(--c-warn-bdr) !important;
  border-radius: 6px !important;
  padding: 2px 10px !important;
  font-size: 11px !important;
  font-weight: 500 !important;
}

/* ── pulse dot ── */
.pulse-dot {
  border-radius: 50% !important;
  animation: bot-pulse 2s infinite !important;
}
.pulse-dot.ok   { background: #639922 !important; }
.pulse-dot.warn { background: #EF9F27 !important; }
@keyframes bot-pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }

/* ── dark mode: فقط وابسته به data-theme (نه prefers-color-scheme/OS) ── */
[data-theme="dark"] {
    --c-profit:      #86efac;
    --c-profit-bg:   rgba(59,109,17,0.18);
    --c-profit-bdr:  rgba(59,109,17,0.4);
    --c-loss:        #fca5a5;
    --c-loss-bg:     rgba(163,45,45,0.18);
    --c-loss-bdr:    rgba(163,45,45,0.4);
    --c-warn:        #fde68a;
    --c-warn-bg:     rgba(133,79,11,0.18);
    --c-warn-bdr:    rgba(133,79,11,0.4);
    --c-info:        #93c5fd;
    --c-info-bg:     rgba(24,95,165,0.18);
    --c-info-bdr:    rgba(24,95,165,0.4);
    --c-teal:        #5eead4;
    --c-teal-bg:     rgba(15,110,86,0.18);
    --c-teal-bdr:    rgba(15,110,86,0.4);
    --c-surface:     rgba(255,255,255,0.06);
    --c-border:      rgba(255,255,255,0.1);
}

[data-theme="dark"] .bot-card, [data-theme="dark"] .bot-panel, [data-theme="dark"] [class*="bot-card"] {
    background: #1a1d23 !important; color: #e2e8f0 !important;
}
[data-theme="dark"] .bot-health-card, [data-theme="dark"] [class*="health-monitor"] {
    background: #1a1d23 !important; color: #e2e8f0 !important;
}
[data-theme="dark"] .stat-value, [data-theme="dark"] .health-stat-val { color: #e2e8f0 !important; }
[data-theme="dark"] .stat-label, [data-theme="dark"] .health-stat-label { color: rgba(255,255,255,0.45) !important; }

/* ════════════════════════════════════════════════════════════
   تمِ روشن: override سطوحِ هاردکدِ تیره و رنگ‌های white-alpha
   ════════════════════════════════════════════════════════════ */
[data-theme="light"] #trade-workspace { background: #e9edf2 !important; }
[data-theme="light"] .bot-card, [data-theme="light"] .bot-panel, [data-theme="light"] [class*="bot-card"],
[data-theme="light"] .bot-health-card, [data-theme="light"] [class*="health-monitor"] {
    background: #ffffff !important; color: #0f172a !important; border: 1px solid rgba(15,23,42,0.10) !important;
}
[data-theme="light"] .stat-value, [data-theme="light"] .health-stat-val { color: #0f172a !important; }
[data-theme="light"] .stat-label, [data-theme="light"] .health-stat-label { color: #64748b !important; }
/* سطوح و مرزهای white-alpha → معادلِ تیره روی پس‌زمینهٔ روشن */
[data-theme="light"] .trade-controls { background: var(--glass-bg) !important; box-shadow: 0 8px 32px 0 var(--glass-shadow) !important; }
[data-theme="light"] .bot-status-row { background: rgba(15,23,42,0.04) !important; }
[data-theme="light"] .analysis-item,
[data-theme="light"] .bot-log-entry { border-color: rgba(15,23,42,0.08) !important; }
/* جعبهٔ رسید/ماشین‌حساب (inline gradient تیره) */
[data-theme="light"] .tr-receipt-box {
    background: #f1f5f9 !important;
    border: 1px solid rgba(15,23,42,0.10) !important;
    box-shadow: inset 0 1px 4px rgba(15,23,42,0.05) !important;
}
[data-theme="light"] .tr-receipt-box > div { border-bottom-color: rgba(15,23,42,0.12) !important; }
/* بلاب‌های تزئینیِ پس‌زمینه در تمِ روشن خیلی ملایم شوند (مِهِ بنفش حذف) */
html[data-theme="light"] .bg-blobs { opacity: 0.08 !important; }

[data-theme="dark"] .bot-card, 
[data-theme="dark"] .bot-panel, 
[data-theme="dark"] [class*="bot-card"],
[data-theme="dark"] .bot-health-card, 
[data-theme="dark"] [class*="health-monitor"] {
    background: #1a1d23 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .stat-value, 
[data-theme="dark"] .health-stat-val { color: #e2e8f0 !important; }
[data-theme="dark"] .stat-label, 
[data-theme="dark"] .health-stat-label { color: rgba(255,255,255,0.45) !important; }


/* ── Light Mode Overrides ── */
[data-theme="light"] {
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-shadow: rgba(148, 163, 184, 0.1);
    --glass-hover: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] #chart-container {
    background: #ffffff;
    border-color: #e2e8f0;
}

/* پنلِ فرماندهیِ ربات → کارتِ تو‌پُرِ هماهنگ با سایر پنجره‌ها (با مرزِ نعنایی برای تمایز) */
[data-theme="light"] .bot-control-panel {
    background: var(--glass-bg) !important;
    border: 1px solid rgba(var(--tp-accent-rgb), 0.25) !important;
    box-shadow: 0 8px 32px 0 var(--glass-shadow) !important;
}
/* اجزای داخلیِ پنل (ردیف وضعیت/لاگ/نوار) فرورفته و ملایم می‌مانند */
[data-theme="light"] .bot-status-row,
[data-theme="light"] .bot-mini-log,
[data-theme="light"] .chance-bar {
    background: rgba(0, 0, 0, 0.03) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .bot-mini-log {
    color: var(--primary) !important;
}

[data-theme="light"] .watchlist-table th {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .modal-overlay {
    background: rgba(255, 255, 255, 0.8);
}

[data-theme="light"] .input-group-fancy input,
[data-theme="light"] .input-group-fancy select {
    background: #fff;
    border-color: #cbd5e1;
}

[data-theme="light"] .intelligence-terminal {
    background: #f8fafc !important;
    color: #1e293b !important;
    border: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .terminal-line {
    color: #64748b !important;
}
