/* ============================================
   ByTamer FX — MT5 Terminal v1.0
   Repurposed from Oracle Terminal v3.0
   Theme: Homepage orange/amber (#e8590c, #ff8c42)
   ============================================ */

/* --- CSS VARIABLES --- */
:root {
    --ot-bg: #080808;
    --ot-panel-bg: rgba(17, 17, 17, 0.92);
    --ot-panel-border: rgba(232, 89, 12, 0.06);
    --ot-panel-hover: rgba(232, 89, 12, 0.12);
    --ot-accent: #e8590c;
    --ot-accent2: #ff8c42;
    --ot-accent-dim: rgba(232, 89, 12, 0.15);
    --ot-green: #10b981;
    --ot-red: #ef4444;
    --ot-amber: #f59e0b;
    --ot-cyan: #06b6d4;
    --ot-text: #f1f1f1;
    --ot-muted: #888888;
    --ot-dim: #555555;
    --ot-border: #1e1e1e;
    --ot-card: #111111;
    --ot-surface: #0c0c0c;
}

/* --- BASE --- */
.ot-body {
    background: var(--ot-bg);
    color: var(--ot-text);
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
}

.ot-accent-text { color: var(--ot-accent); }
.ot-accent-bg { background: var(--ot-accent); }
.ot-accent-gradient { background: linear-gradient(90deg, var(--ot-accent), var(--ot-accent2)); }
.ot-gradient-text {
    background: linear-gradient(135deg, var(--ot-accent), var(--ot-accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.scramble-text {
    font-family: 'JetBrains Mono', monospace;
    display: inline-block;
}

/* --- TOP BAR --- */
.ot-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    background: rgba(8, 8, 8, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--ot-border);
}

.ot-topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 16px;
    max-width: 100%;
}

.ot-logo-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--ot-accent), var(--ot-accent2));
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 16px rgba(232, 89, 12, 0.25);
}

.ot-quick-stats {
    background: rgba(17, 17, 17, 0.5);
    border: 1px solid var(--ot-border);
    border-radius: 8px;
    padding: 4px 12px;
}

.ot-stat-sep {
    width: 1px; height: 16px;
    background: var(--ot-border);
    flex-shrink: 0;
}

.ot-nav-btn {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10px; font-family: 'JetBrains Mono', monospace;
    padding: 4px 8px; border-radius: 6px;
    background: rgba(59, 130, 246, 0.08); color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.15);
    transition: all 0.2s; text-decoration: none;
}
.ot-nav-btn:hover { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }

.ot-user-btn {
    display: flex; align-items: center; gap: 6px;
    background: var(--ot-card); border: 1px solid var(--ot-border);
    border-radius: 8px; padding: 5px 10px;
    cursor: pointer; transition: all 0.2s; color: var(--ot-text);
}
.ot-user-btn:hover { border-color: rgba(232, 89, 12, 0.2); }

.ot-dropdown {
    position: absolute; right: 0; top: 100%; margin-top: 6px;
    width: 180px; background: var(--ot-card);
    border: 1px solid var(--ot-border); border-radius: 10px;
    padding: 6px 0; z-index: 60;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.ot-dropdown-item {
    display: block; padding: 8px 14px; font-size: 12px;
    color: #94a3b8; transition: all 0.15s; text-decoration: none;
}
.ot-dropdown-item:hover { background: rgba(255, 255, 255, 0.04); color: white; }

/* --- METRICS ROW --- */
.ot-metrics-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 64px 12px 0;
    margin-bottom: 2px;
}

.ot-metric-card {
    background: var(--ot-panel-bg);
    border: 1px solid var(--ot-panel-border);
    border-radius: 12px; padding: 14px 16px;
    position: relative; overflow: hidden;
    transition: all 0.3s;
}
.ot-metric-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--ot-accent), var(--ot-accent2));
    opacity: 0.6; transition: opacity 0.3s;
}
.ot-metric-card:hover {
    border-color: var(--ot-panel-hover);
    box-shadow: 0 0 24px rgba(232, 89, 12, 0.06);
}
.ot-metric-card:hover::before { opacity: 1; height: 3px; }

.ot-metric-top {
    display: flex; justify-content: space-between;
    align-items: flex-start; margin-bottom: 6px;
}
.ot-metric-icon {
    width: 28px; height: 28px; border-radius: 7px;
    background: var(--ot-accent-dim); color: var(--ot-accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
}
.ot-metric-icon.ot-icon-cyan { background: rgba(6, 182, 212, 0.12); color: var(--ot-cyan); }
.ot-metric-icon.ot-icon-green { background: rgba(16, 185, 129, 0.12); color: var(--ot-green); }
.ot-metric-icon.ot-icon-amber { background: rgba(245, 158, 11, 0.12); color: var(--ot-amber); }
.ot-metric-icon.ot-icon-blue { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }

.ot-metric-value {
    font-size: 20px; font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    color: white; margin-bottom: 2px;
}
.ot-metric-label { font-size: 10px; color: var(--ot-dim); margin-bottom: 4px; }
.ot-metric-sub { font-size: 9px; font-family: 'JetBrains Mono', monospace; }

/* Badges */
.ot-badge-green {
    font-size: 9px; font-weight: 700; color: var(--ot-green);
    background: rgba(16, 185, 129, 0.12);
    padding: 2px 7px; border-radius: 20px;
}
.ot-badge-red {
    font-size: 9px; font-weight: 700; color: var(--ot-red);
    background: rgba(239, 68, 68, 0.12);
    padding: 2px 7px; border-radius: 20px;
}
.ot-badge-neutral {
    font-size: 9px; font-weight: 700; color: var(--ot-muted);
    background: rgba(136, 136, 136, 0.1);
    padding: 2px 7px; border-radius: 20px;
}
.ot-badge-accent {
    font-size: 9px; font-weight: 700; color: var(--ot-accent);
    background: var(--ot-accent-dim);
    padding: 2px 7px; border-radius: 20px;
}

/* --- MAIN GRID --- */
.ot-grid {
    display: grid;
    grid-template-columns: 228px 1fr 260px;
    gap: 10px;
    padding: 6px 16px 50px;
    min-height: auto;
}
.ot-col-left, .ot-col-right { min-width: 0; }
.ot-col-center { min-width: 0; }

/* --- PANELS --- */
.ot-panel {
    background: var(--ot-panel-bg);
    border: 1px solid var(--ot-panel-border);
    border-radius: 10px; padding: 12px;
    transition: all 0.3s;
}
.ot-panel:hover {
    border-color: rgba(232, 89, 12, 0.10);
    box-shadow: 0 0 16px rgba(232, 89, 12, 0.04);
}
.ot-panel-chart { padding: 16px; }

.ot-panel-header {
    display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 8px;
}
.ot-panel-title {
    font-size: 9px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1.5px; color: var(--ot-muted);
}

/* Grid Background (chart panel) */
.ot-grid-bg {
    position: absolute; inset: 0;
    background-size: 40px 40px;
    background-image:
        linear-gradient(to right, rgba(232, 89, 12, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(232, 89, 12, 0.02) 1px, transparent 1px);
    opacity: 0.5; pointer-events: none;
}

/* Period Buttons */
.ot-period-btn {
    font-size: 10px; font-weight: 600;
    padding: 4px 10px; border-radius: 6px;
    border: 1px solid var(--ot-border);
    background: transparent; color: var(--ot-dim);
    cursor: pointer; transition: all 0.2s;
    font-family: 'JetBrains Mono', monospace;
}
.ot-period-btn:hover:not(.active) {
    background: rgba(232, 89, 12, 0.06); color: var(--ot-muted);
}
.ot-period-btn.active {
    background: var(--ot-accent-dim);
    border-color: rgba(232, 89, 12, 0.3);
    color: var(--ot-accent);
}

/* Tabs */
.ot-tab {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 10px; border-radius: 7px;
    font-size: 10px; font-weight: 700;
    border: 1px solid transparent; background: transparent;
    color: var(--ot-dim); cursor: pointer; transition: all 0.2s;
}
.ot-tab:hover:not(.active) { background: rgba(255, 255, 255, 0.03); color: var(--ot-muted); }
.ot-tab.active {
    background: var(--ot-accent-dim);
    border-color: rgba(232, 89, 12, 0.25);
    color: var(--ot-accent);
}
.ot-tab-count {
    font-size: 9px; font-weight: 700;
    padding: 1px 6px; border-radius: 10px;
    background: rgba(239, 68, 68, 0.12); color: var(--ot-red);
    font-family: 'JetBrains Mono', monospace;
}
.ot-tab-count.dim { background: rgba(136, 136, 136, 0.1); color: var(--ot-dim); }

/* --- SIGNAL ROWS --- */
.ot-signal-row {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 6px; border-radius: 6px;
    transition: all 0.15s; border-left: 2px solid transparent;
}
.ot-signal-row:hover {
    background: rgba(232, 89, 12, 0.04);
    border-left-color: var(--ot-accent);
}

/* Signal Bar */
.ot-signal-bar-bg {
    height: 4px; background: rgba(255,255,255,0.06);
    border-radius: 2px; overflow: hidden; flex: 1;
}
.ot-signal-bar-fill {
    height: 100%; border-radius: 2px;
    transition: width 0.5s ease;
}
.ot-signal-bar-fill.buy { background: linear-gradient(90deg, var(--ot-green), #34d399); }
.ot-signal-bar-fill.sell { background: linear-gradient(90deg, var(--ot-red), #f87171); }

/* --- ACCOUNT INFO --- */
.ot-account-row {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 6px; border-radius: 6px;
    transition: all 0.15s; border: 1px solid transparent;
    cursor: pointer;
}
.ot-account-row:hover {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(232, 89, 12, 0.08);
}
.ot-account-row.active {
    background: rgba(232, 89, 12, 0.05);
    border-color: rgba(232, 89, 12, 0.15);
}

/* --- POSITIONS --- */
.ot-pos-card {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 8px; border-radius: 7px;
    border: 1px solid var(--ot-panel-border);
    transition: all 0.15s; cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
}
.ot-pos-card:hover {
    border-color: rgba(232, 89, 12, 0.15);
    background: rgba(232, 89, 12, 0.03);
}
.ot-pos-card.profit { border-left: 3px solid var(--ot-green); }
.ot-pos-card.loss { border-left: 3px solid var(--ot-red); }
.ot-pos-card.flat { border-left: 3px solid var(--ot-dim); }

.ot-pos-dir {
    font-size: 8px; font-weight: 700;
    padding: 1px 5px; border-radius: 3px;
    flex-shrink: 0;
}
.ot-pos-dir.buy { background: rgba(16, 185, 129, 0.12); color: var(--ot-green); }
.ot-pos-dir.sell { background: rgba(239, 68, 68, 0.12); color: var(--ot-red); }

.ot-pos-pnl {
    font-size: 10px; font-weight: 700;
    text-align: right; min-width: 52px;
}

/* Strategy tags */
.ot-strategy-tag {
    font-size: 7px; font-weight: 700; padding: 1px 4px;
    border-radius: 3px; text-transform: uppercase; letter-spacing: 0.5px;
}
.ot-strategy-spm { background: var(--ot-accent-dim); color: var(--ot-accent); }
.ot-strategy-dca { background: rgba(139, 92, 246, 0.12); color: #a78bfa; }
.ot-strategy-hg { background: rgba(59, 130, 246, 0.12); color: #60a5fa; }
.ot-strategy-manual { background: rgba(6, 182, 212, 0.12); color: #22d3ee; }

/* --- TERMINAL / LOG --- */
.ot-terminal {
    font-family: 'JetBrains Mono', monospace;
    position: relative; overflow: hidden;
    height: 240px; display: flex; flex-direction: column;
}
.ot-terminal::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--ot-accent), transparent);
    animation: scanLine 4s linear infinite;
}
@keyframes scanLine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.ot-terminal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding-bottom: 6px; margin-bottom: 6px;
    border-bottom: 1px solid rgba(232, 89, 12, 0.08);
    flex-shrink: 0;
}
.ot-terminal-body {
    flex: 1; overflow-y: auto;
    font-size: 10px; line-height: 1.5;
}
.ot-log-entry {
    padding: 2px 6px; border-left: 2px solid transparent;
    animation: logSlideIn 0.25s ease-out;
    transition: all 0.15s; border-radius: 2px;
}
.ot-log-entry:hover {
    background: rgba(232, 89, 12, 0.03);
    border-left-color: var(--ot-accent);
    padding-left: 10px;
}
@keyframes logSlideIn {
    from { opacity: 0; transform: translateX(-6px); }
    to { opacity: 1; transform: translateX(0); }
}
.ot-log-time { color: #333; margin-right: 6px; }
.ot-log-tag { font-weight: 700; margin-right: 4px; }

.ot-log-sys { color: var(--ot-accent); }
.ot-log-trade { color: var(--ot-green); }
.ot-log-signal { color: #60a5fa; }
.ot-log-grid { color: var(--ot-cyan); }
.ot-log-warn { color: var(--ot-amber); }
.ot-log-error { color: var(--ot-red); }
.ot-log-health { color: var(--ot-muted); }

/* --- TECHNICAL INDICATOR ROWS (legacy) --- */
.ot-tech-row {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 6px; border-radius: 6px;
    transition: all 0.15s; border: 1px solid transparent;
}
.ot-tech-row:hover {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(232, 89, 12, 0.08);
}
.ot-tech-icon {
    width: 22px; height: 22px; border-radius: 5px;
    display: flex; align-items: center; justify-content: center;
    font-size: 7px; font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    flex-shrink: 0;
}

/* --- TECH ANALYSIS BAR ROWS (v1.3) --- */
.ot-tech-bar-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 5px 6px;
    border-radius: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: all 0.15s;
}
.ot-tech-bar-row:last-child { border-bottom: none; }
.ot-tech-bar-row:hover {
    background: rgba(232, 89, 12, 0.03);
}
.ot-tech-bar-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--ot-muted);
    font-family: 'JetBrains Mono', monospace;
}
.ot-tech-bar-content {
    display: flex;
    align-items: center;
    gap: 6px;
}
.ot-tech-bar-value {
    font-size: 10px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    min-width: 52px;
    text-align: right;
    flex-shrink: 0;
}
.ot-tech-bar-status {
    font-size: 7px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* --- SAFETY SHIELD --- */
.ot-shield-bar {
    height: 6px; background: rgba(255,255,255,0.06);
    border-radius: 3px; overflow: hidden;
}
.ot-shield-fill {
    height: 100%; border-radius: 3px; transition: all 0.5s ease;
}

/* --- BOTTOM TICKER BAR --- */
.ot-bottom-ticker {
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 50;
    background: rgba(8, 8, 8, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--ot-border);
    display: flex; align-items: center;
    height: 32px; padding: 0 12px; gap: 10px;
}
.ot-bottom-ticker-label {
    display: flex; align-items: center; gap: 4px;
    flex-shrink: 0; font-size: 8px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    color: var(--ot-accent); padding-right: 10px;
    border-right: 1px solid var(--ot-border);
}
.ot-bottom-ticker-track-wrapper {
    flex: 1; overflow: hidden; position: relative;
}
.ot-bottom-ticker-track {
    display: flex; align-items: center; gap: 0;
    white-space: nowrap;
    animation: bottomTicker 60s linear infinite;
}
.ot-bottom-ticker-track:hover { animation-play-state: paused; }
@keyframes bottomTicker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.ot-bottom-item {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 0 12px; font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
}
.ot-bottom-symbol { color: var(--ot-muted); font-weight: 700; }
.ot-bottom-score { font-weight: 700; font-size: 10px; }
.ot-bottom-dir { font-size: 8px; font-weight: 700; padding: 1px 4px; border-radius: 3px; }
.ot-bottom-dir.buy { background: rgba(16, 185, 129, 0.12); color: var(--ot-green); }
.ot-bottom-dir.sell { background: rgba(239, 68, 68, 0.12); color: var(--ot-red); }
.ot-bottom-sep { color: var(--ot-border); padding: 0 4px; font-size: 8px; }
.ot-bottom-status {
    display: flex; align-items: center; gap: 8px;
    flex-shrink: 0; padding-left: 10px;
    border-left: 1px solid var(--ot-border);
}

/* --- PULSE DOT --- */
.ot-pulse-dot { position: relative; }
.ot-pulse-dot::after {
    content: ''; position: absolute; inset: -3px;
    border-radius: 50%; border: 1.5px solid currentColor;
    opacity: 0; animation: otPulse 2s infinite;
}
@keyframes otPulse {
    0% { transform: scale(1); opacity: 0.4; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* --- EXCHANGE SESSION DOTS --- */
.ot-exchange-dot {
    width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.ot-exchange-dot.active { background: var(--ot-green); box-shadow: 0 0 6px rgba(16, 185, 129, 0.5); }
.ot-exchange-dot.closed { background: var(--ot-dim); }

/* --- SCROLLBAR --- */
.ot-scrollable::-webkit-scrollbar { width: 3px; }
.ot-scrollable::-webkit-scrollbar-track { background: transparent; }
.ot-scrollable::-webkit-scrollbar-thumb { background: rgba(232, 89, 12, 0.15); border-radius: 2px; }
.ot-scrollable::-webkit-scrollbar-thumb:hover { background: rgba(232, 89, 12, 0.3); }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(232, 89, 12, 0.15); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(232, 89, 12, 0.3); }

/* --- ECONOMIC CALENDAR PROXIMITY ANIMATIONS --- */
.ot-eco-imminent-high {
    animation: ecoImminentHigh 0.6s ease-in-out infinite alternate;
    border-radius: 4px;
}
@keyframes ecoImminentHigh {
    0% { background: rgba(239, 68, 68, 0.05); box-shadow: 0 0 0px rgba(239, 68, 68, 0); }
    100% { background: rgba(239, 68, 68, 0.18); box-shadow: 0 0 12px rgba(239, 68, 68, 0.3); }
}

.ot-eco-soon-high {
    background: rgba(239, 68, 68, 0.08);
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.12);
}

.ot-eco-imminent-med {
    animation: ecoImminentMed 0.8s ease-in-out infinite alternate;
    border-radius: 4px;
}
@keyframes ecoImminentMed {
    0% { background: rgba(245, 158, 11, 0.05); box-shadow: 0 0 0px rgba(245, 158, 11, 0); }
    100% { background: rgba(245, 158, 11, 0.15); box-shadow: 0 0 10px rgba(245, 158, 11, 0.2); }
}

.ot-eco-soon {
    background: rgba(245, 158, 11, 0.05);
    border-radius: 4px;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.08);
}

/* Log filter active state */
.ot-log-filter.active {
    background: rgba(232, 89, 12, 0.12);
    color: var(--ot-accent);
    border-radius: 4px;
}

/* --- RESPONSIVE --- */
@media (max-width: 1280px) {
    .ot-grid { grid-template-columns: 1fr; }
    .ot-col-left, .ot-col-right { display: none; }
    .ot-metrics-row { grid-template-columns: repeat(2, 1fr); padding-top: 58px; }
}
@media (max-width: 768px) {
    .ot-metrics-row { grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 56px 8px 0; }
    .ot-grid { padding: 4px 8px 44px; }
    .ot-metric-value { font-size: 16px; }
}
