:root {
    --bg-dark: #121418;
    --panel-bg: rgba(22, 29, 45, 0.75);
    --border-color: rgba(109, 117, 143, 0.15);
    --text-primary: #FFFFFF;
    --text-muted: #8c95a5;
    --accent-green: #8cd401;
    --danger: #FF4560;
    --success: #8cd401;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

h1, h2, h3, h4, h5, h6, .sidebar-logo h2, .card-title {
    font-family: 'Jost', 'DM Sans', 'Inter', sans-serif;
}

/* === APP LAYOUT === */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* === SIDEBAR === */
.sidebar {
    width: 260px;
    background-color: var(--bg-dark);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.sidebar-logo h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(140, 212, 1, 0.12) 0%, rgba(140, 212, 1, 0.01) 100%);
    border-left-color: var(--accent-green);
    color: var(--accent-green);
    font-weight: 600;
    box-shadow: inset 4px 0 10px rgba(140, 212, 1, 0.03);
}

.nav-item svg {
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.nav-item:hover svg, .nav-item.active svg {
    opacity: 1;
}

.sidebar-footer {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* === MAIN CONTENT === */
.main-content {
    flex: 1;
    overflow-y: auto;
    background-color: var(--bg-dark);
    padding: 2rem 3rem;
}

.top-header {
    margin-bottom: 2rem;
}

.top-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

/* === CARDS & PANELS === */
.card {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.08);
}

.card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.top-panels {
    grid-template-columns: 2fr 1fr;
}

.huge-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.huge-value span {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* === TABS HIDDEN (Managed by Sidebar) === */
.tab-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === WIDGETS / GRID === */
#dashboard-grid, .dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.widget {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.widget:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 227, 150, 0.2);
    box-shadow: 0 12px 40px 0 rgba(0, 227, 150, 0.1);
}

.widget h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.metric .label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.metric .value {
    font-size: 2rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* === TABLES === */
.table-container {
    overflow-x: auto;
}

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

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

/* Numeric columns align right */
th.num-col, td.num-col {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

th {
    background-color: transparent;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

.controls-bar {
    margin-bottom: 1rem;
}

.controls-bar input {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    width: 100%;
    max-width: 300px;
    font-family: 'Inter', sans-serif;
}

.controls-bar input:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 10px rgba(0, 227, 150, 0.15);
}

th.sortable {
    cursor: pointer;
    transition: color 0.2s;
}

th.sortable:hover {
    color: var(--accent-green);
}

th {
    background: rgba(0,0,0,0.2);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

tr:last-child td {
    border-bottom: none;
}

.flash {
    animation: flashRow 1s ease-out;
}

@keyframes flashRow {
    0% { background-color: rgba(239, 68, 68, 0.3); }
    100% { background-color: transparent; }
}

@keyframes updatePulseUp {
    0% { text-shadow: 0 0 0 transparent; }
    50% { text-shadow: 0 0 15px var(--positive); }
    100% { text-shadow: 0 0 0 transparent; }
}
@keyframes updatePulseDown {
    0% { text-shadow: 0 0 0 transparent; }
    50% { text-shadow: 0 0 15px var(--negative); }
    100% { text-shadow: 0 0 0 transparent; }
}

.pulse-up { animation: updatePulseUp 0.5s ease-out; }
.pulse-down { animation: updatePulseDown 0.5s ease-out; }

/* === TOGGLE SWITCH === */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    transition: .3s;
    border-radius: 34px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: .3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .slider {
    background-color: rgba(0, 227, 150, 0.2);
    border-color: var(--accent-green);
}

.toggle-switch input:checked + .slider:before {
    background-color: var(--accent-green);
    transform: translateX(24px);
}

/* === RESPONSIVE MEDIA QUERIES === */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 1rem;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .sidebar-logo {
        margin-bottom: 0;
        width: 100%;
    }
    
    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        justify-content: flex-start;
        align-items: center;
    }

    .nav-section-title {
        display: none;
    }

    .nav-item {
        padding: 0.5rem;
    }

    .nav-item svg {
        margin-right: 0;
    }

    .sidebar-footer {
        display: none;
    }

    .main-content {
        padding: 1rem;
    }
    
    .top-panels {
        grid-template-columns: 1fr;
    }
}

/* === TEXT COLORS === */
.positive-text {
    color: var(--success) !important;
}
.negative-text {
    color: var(--danger) !important;
}

/* === SIGNAL BADGES === */
.signal-badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    transition: all 0.3s ease;
}

.signal-neutral {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.signal-long, .signal-badge[class*="LONG"] {
    background-color: rgba(140, 212, 1, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(140, 212, 1, 0.3);
}

.signal-short, .signal-badge[class*="SHORT"] {
    background-color: rgba(255, 69, 96, 0.15);
    color: var(--danger);
    border: 1px solid rgba(255, 69, 96, 0.3);
}

@keyframes signalPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.signal-badge.pulse {
    animation: signalPulse 0.5s ease-in-out;
}

/* === TIMEFRAME SELECTOR === */
.timeframe-selector {
    display: flex;
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2px;
}

.tf-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tf-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.02);
}

.tf-btn.active {
    background-color: rgba(140, 212, 1, 0.1);
    color: var(--accent-green);
}

/* === SPARKLINE === */
.sparkline-svg {
    width: 100px;
    height: 30px;
    display: inline-block;
    vertical-align: middle;
}

/* === GLOW & GLASS SYSTEM ENHANCEMENTS === */
@keyframes pulseGlow {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(140, 212, 1, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(140, 212, 1, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(140, 212, 1, 0);
    }
}

.header-badge {
    background: rgba(255, 255, 255, 0.02) !important;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 30px;
    padding: 6px 14px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.header-badge:hover {
    border-color: rgba(140, 212, 1, 0.3) !important;
    background: rgba(140, 212, 1, 0.05) !important;
}

/* Position Type Badges */
.sc-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

/* Position Close Button */
.close-btn {
    background: var(--danger) !important;
    color: #ffffff !important;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(255, 69, 96, 0.15);
}

.close-btn:hover {
    background: #ff6b8b !important;
    box-shadow: 0 4px 16px rgba(255, 69, 96, 0.4);
    transform: translateY(-1px);
}

.close-btn:active {
    transform: translateY(0);
}

/* Settings Primary Apply Button */
.primary-btn {
    background: linear-gradient(135deg, #8ad200 0%, #a6fa04 100%) !important;
    color: #080a10 !important;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(140, 212, 1, 0.15);
}

.primary-btn:hover {
    background: #a6fa04 !important;
    box-shadow: 0 4px 16px rgba(140, 212, 1, 0.4);
    transform: translateY(-1px);
}

.primary-btn:active {
    transform: translateY(0);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Sidebar Connection Status Indicators */
.status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--danger);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.dot.connected {
    background-color: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

.dot.disconnected {
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

/* === WIDGET SUB-COMPONENTS === */
.widget-signals {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.signal-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.signal-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.75px;
    font-weight: 600;
}

.widget-metrics {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.015);
    padding: 0.65rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.metric-row:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.06);
}

.metric-label {
    font-size: 0.775rem;
    color: var(--text-muted);
    font-weight: 500;
}

.metric-value {
    font-size: 1.15rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
