/* Базовые стили для HTML и Body */
html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    transition: background 0.3s ease;
    background: #000000; /* Черный фон по умолчанию */
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.light {
    background: #f0f2f5;
}

/* Переменные для цветовых схем */
:root {
    --bg-color-dark: #000;
    --text-color-dark: #e0e0e0;
    --panel-bg-dark: #2d3436;
    --panel-border-dark: #444;
    --toolbar-bg-dark: #1e2426;
    --button-bg-dark: #3a4143;
    --button-hover-dark: #50585a;

    --bg-color-light: #f0f2f5;
    --text-color-light: #222;
    --panel-bg-light: #fff;
    --panel-border-light: #ddd;
    --toolbar-bg-light: #e0e0e0;
    --button-bg-light: #ccc;
    --button-hover-light: #bbb;
}

body.dark {
    color: var(--text-color-dark);
}

body.light {
    color: var(--text-color-light);
}

/* Анимация пульсации для подсветки Магнит */
@keyframes pulse-glow {
    0%, 100% {
        opacity: 0.7;
        transform: scale(1);
        filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.9));
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
        filter: drop-shadow(0 0 16px rgba(59, 130, 246, 1));
    }
}

@keyframes pulse-glow-inner {
    0%, 100% {
        opacity: 0.5;
        filter: drop-shadow(0 0 4px rgba(96, 165, 250, 0.8));
    }
    50% {
        opacity: 0.9;
        filter: drop-shadow(0 0 10px rgba(96, 165, 250, 1));
    }
}

.magnit-glow-outer {
    animation: pulse-glow 1.5s ease-in-out infinite;
}

.magnit-glow-inner {
    animation: pulse-glow-inner 1.5s ease-in-out infinite;
}

/* SVG и элементы графа */
#network {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
}

.node text {
    fill: var(--text-color-dark);
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
    user-select: none;
}
.light .node text {
    fill: var(--text-color-light);
}

.link {
    fill: none;
    stroke-linecap: round;
    transition: stroke 0.3s ease;
    stroke: var(--panel-border-dark);
}
.light .link {
    stroke: var(--panel-border-light);
}

.pill {
    stroke-width: 1.5px;
}
.badge {
    fill: #fff;
    font-size: 8px;
    font-weight: bold;
    user-select: none;
    pointer-events: none;
}

/* Панели */
.floating-panel {
    position: fixed;
    background: var(--panel-bg-dark);
    border: 1px solid var(--panel-border-dark);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 15px;
    max-width: 350px;
    color: var(--text-color-dark);
    z-index: 1000;
    display: none;
    flex-direction: column;
    transition: all 0.3s ease-in-out;
}
.light .floating-panel {
    background: var(--panel-bg-light);
    border: 1px solid var(--panel-border-light);
    color: var(--text-color-light);
}

.floating-panel.visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

#info-panel {
    top: 60px;
    left: 20px;
}

#legend-panel {
    top: 60px;
    right: 20px;
}

#filter-panel {
    top: 60px;
    left: 100px;
}

#privacy-panel {
    bottom: 60px;
    left: 100px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--panel-border-dark);
    padding-bottom: 10px;
    margin-bottom: 10px;
}
.light .panel-header {
    border-bottom: 1px solid var(--panel-border-light);
}

.panel-header h3 {
    margin: 0;
    font-size: 1.2em;
}

.panel-content p {
    margin: 5px 0;
    line-height: 1.5;
}

/* Кнопка закрытия */
.close-btn {
    background: none;
    border: none;
    color: var(--text-color-dark);
    font-size: 1.5rem;
    cursor: pointer;
    font-weight: bold;
}
.light .close-btn {
    color: var(--text-color-light);
}

/* Легенда */
.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.legend-color {
    width: 20px;
    height: 12px;
    border-radius: 4px;
    margin-right: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.legend-color.very_high { background: #f44336; border-color: #d32f2f; }
.legend-color.high { background: #ff9800; border-color: #f57c00; }
.legend-color.medium { background: #ffeb3b; border-color: #fbc02d; }
.legend-color.low { background: #4caf50; border-color: #388e3c; }
.legend-color.very_low { background: #03a9f4; border-color: #0288d1; }

.legend-line {
    width: 25px;
    height: 2px;
    background: #bbb;
    margin-right: 10px;
}

.legend-line.very_high { height: 4px; }
.legend-line.high { height: 3px; }
.legend-line.medium { height: 2px; }
.legend-line.low { height: 1px; }

.legend-node-circle, .legend-node-square {
    width: 15px;
    height: 15px;
    margin-right: 10px;
    background-color: #666;
    border: 1px solid #999;
}
.legend-node-circle { border-radius: 50%; }
.legend-node-square { border-radius: 4px; }

/* Фильтры */
#filter-panel label {
    display: block;
    margin-top: 10px;
    font-size: 0.9em;
}
#filter-panel select, #filter-panel input {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    box-sizing: border-box;
    background: #444;
    border: 1px solid #666;
    color: #fff;
    border-radius: 4px;
}
.light #filter-panel select, .light #filter-panel input {
    background: #eee;
    border: 1px solid #ccc;
    color: #333;
}
.filter-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

/* Тулы */
.tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    pointer-events: none;
    z-index: 2000;
}

/* === TradingView Glassmorphism Panels (универсальный стиль) === */
.glass-panel {
    background: rgba(24, 26, 32, 0.82) !important;
    border: none !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 24px 0 rgba(24,26,32,0.18) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}
.light .glass-panel {
    background: rgba(255,255,255,0.85) !important;

}

/* === TradingView Glassmorphism Panels (универсальный стиль) === */
.toolbar-top, .left-toolbar, .right-panel {
    background: rgba(24, 26, 32, 0.82);
    border: none;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    transition: background 0.3s, 
}
.light .toolbar-top, .light .left-toolbar, .light .right-panel {
    background: rgba(255,255,255,0.85);
    color: #222;

}



.toolbar-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: #000;
    border-bottom: 4px solid #333;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    z-index: 1000;
    border-radius: 0;
    color: #fff;
}

.left-toolbar {
    position: fixed;
    top: 40px;
    left: 0;
    width: 40px;
    height: calc(100vh - 48px);
    background: #000;
    border-top-right-radius: 0px;
    border-bottom-right-radius: 0px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-right: 4px solid #333;
    border-top: 4px solid #333;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    z-index: 1000;
    gap: 8px;
}

.right-panel {
    position: fixed;
    top: 40px;
    right: 0;
    width: 40px;
    height: calc(100vh - 40px);
    background: #000;
    border-top-left-radius: 0px;
    border-bottom-left-radius: 0px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-left: 4px solid #333;
    border-top: 4px solid #333;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 0;
    z-index: 1000;
    gap: 8px;
}

.toolbar-logo-title {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
    flex-shrink: 0;
}

.exchange-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
    background: transparent;
    flex-shrink: 0;
}

.exchange-title {
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: #e0e0e0;
    white-space: nowrap;
    margin-left: 4px;
}
.light .exchange-title {
    color: #333;
}

.toolbar-search {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    background: #23262b;
    border-radius: 4px;
    padding: 0 10px;
    height: 32px;
    border: 1px solid #333;
    max-width: 340px;
    margin: 0 18px;
    min-width: 0;
}
.light .toolbar-search {
    background: #f0f0f0;
    border: 1px solid #ccc;
}

.search-icon {
    color: #888;
    margin-right: 6px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.toolbar-search input {
    border: none;
    background: transparent;
    color: #e0e0e0;
    font-size: 13px;
    outline: none;
    width: 100%;
    min-width: 0;
    padding: 0;
    height: 28px;
}
.light .toolbar-search input {
    color: #333;
}

.toolbar-search input::placeholder {
    color: #bfc9d4;
    font-style: italic;
    font-size: 13px;
    opacity: 1;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    min-width: 0;
}

.toolbar-button {
    padding: 0 6px;
    background-color: transparent;
    color: #e0e0e0;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
}
.light .toolbar-button {
    color: #333;
}
.toolbar-button:hover {
    background-color: #333;
}
.light .toolbar-button:hover {
    background-color: #ddd;
}

.toolbar-button i[data-lucide] {
    width: 22px;
    height: 22px;
    fill: currentColor;
    vertical-align: middle;
}

.toolbar-button.wide span {
    display: inline-block;
    margin-left: 4px;
    font-size: 13px;
    font-weight: 400;
}

@media (max-width: 1200px) {
    .toolbar-button.wide span { display: none; }
    .toolbar-search { max-width: 220px; margin: 0 8px; }
}
@media (max-width: 900px) {
    .exchange-title { display: none; }
    .toolbar-search { display: none; }
}
@media (max-width: 600px) {
    .toolbar-top { padding: 0 4px; }
    .toolbar-button { min-width: 32px; min-height: 32px; height: 32px; }
    .toolbar-logo-title { gap: 4px; }
}

.toolbar-dropdown {
    position: relative;
}
.dropdown-panel {
    display: none;
    position: absolute;
    top: 52px;
    left: 0;
    min-width: 160px;
    background: var(--panel-bg-dark);
    border: 1px solid var(--panel-border-dark);
    border-radius: 8px;

    z-index: 1000;
    flex-direction: column;
    padding: 8px 0;
}
.light .dropdown-panel {
    background: var(--panel-bg-light);
    border: 1px solid var(--panel-border-light);
}
.dropdown-panel .dropdown-item {
    background: none;
    border: none;
    color: inherit;
    padding: 10px 18px;
    text-align: left;
    width: 100%;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
}
.dropdown-panel .dropdown-item:hover {
    background: var(--button-hover-dark);
}
.light .dropdown-panel .dropdown-item:hover {
    background: var(--button-hover-light);
}

.tool-button, .bottom-icon {
    background: none;
    border: none;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px 0;
    transition: background 0.18s; 
    cursor: pointer;
    box-shadow: none;
    outline: none;
    stroke: #fff;
}
.tool-button i[data-lucide], .bottom-icon i[data-lucide] {
    width: 28px;
    height: 28px;
    color: #ffffff;
    stroke: #fff;
    stroke-width: 2.3px;
    transition: color 0.18s, filter 0.18s;
    filter: drop-shadow(0 1px 0 rgba(250, 249, 249, 0.533));
}
.tool-button:hover, .bottom-icon:hover {
    background: rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px 0 rgba(24,26,32,0.18);
}
.tool-button:hover i[data-lucide], .bottom-icon:hover i[data-lucide] {
    color: #fff;
    filter: drop-shadow(0 2px 6px #fff5);
}



















.left-toolbar svg, .right-panel svg,
.tool-button svg, .bottom-icon svg,
.tool-button i[data-lucide], .bottom-icon i[data-lucide] {
    color: #fff !important;
    stroke: #fff !important;
    fill: none !important;
    stroke-width: 1.5px !important;
    width: 24px !important;
    height: 24px !important;
    transition: color 0.18s, filter 0.18s;
    filter: none !important;
}


/* Иконки в верхней панели */
.toolbar-top svg,
.toolbar-top i[data-lucide] {
    color: #fff !important;
    stroke: #fff !important;
    fill: none !important;
    stroke-width: 1.5px !important;
    width: 24px !important;
    height: 24px !important;
    transition: color 0.18s, filter 0.18s;
    filter: none !important;
}
.toolbar-top .toolbar-button:hover svg,
.toolbar-top .toolbar-button:hover i[data-lucide] {
    color: #fff !important;
    stroke: #fff !important;
    filter: none !important;
}

/* --- Сайдбар с вочлистом (широкий, черный, справа от левой панели) --- */
.sidebar {
    position: fixed;
    top: 40px;
    left: 40px;
    width: 260px;
    height: calc(100vh - 35px);
    background: #000000;
    color: #fff;
    border-radius: 0 12px 12px 0;
    box-shadow: 2px 0 16px 0 rgba(0,0,0,0.18);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    padding: 0;
    border-left: none;
    border-right: 4px solid #333;
    border-left: 4px solid #333;
    border-top: 4px solid #333;
}

.watchlist-container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.watchlist-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 16px 18px 10px 18px;
    font-size: 15px;
    font-weight: 600;
    border-bottom: 1px solid #23243a;
    background: #000000;
    border-radius: 0 12px 0 0;
}

.watchlist-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    flex: 1 1 auto;
}

.add-btn, .settings-btn {
    background: none;
    border: none;
    color: #555; /* Более тёмный серый — не выделяется, но виден */
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px;
    padding: 2px 6px;
    transition: background 0.15s;
}
.add-btn:hover, .settings-btn:hover {
    background: #23243a;
    color: #fff;
}

.watchlist-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0;
    background: #000000;
}

.watchlist-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    color: #fff;
}
.watchlist-table th, .watchlist-table td {
    padding: 6px 8px;
    text-align: left;
    border: none;
    background: transparent;
}
.watchlist-table th {
    font-size: 11px;
    color: #555; /* Не #aaa — слишком светло */
    font-weight: 500;
    border-bottom: 1px solid #23243a;
    background: #000000;
    position: sticky;
    top: 0;
    z-index: 1;
}
.watchlist-table tr {
    transition: background 0.15s;
}
.watchlist-table tr:hover {
    background: #23243a;
}

.flag-icon {
    display: inline-block;
    width: 18px;
    height: 13px;
    background-size: cover;
    background-position: center;
    margin-right: 6px;
    vertical-align: middle;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.25); /* Усиленный тень для контраста */
}

.change-value.positive, .change-percent.positive {
    color: #00c853;
}
.change-value.negative, .change-percent.negative {
    color: #d32f2f;
}



/* --- Чат-бот справа, как вочлист, рядом с правой панелью --- */
.chatbot-panel {
    position: fixed;
    top: 40px;
    right: 40px;
    width: 350px;
    height: calc(100vh - 35px);
    background-color: #000000;
    color: #fff;
    border-radius: 12px 0 0 12px;
    box-shadow: -2px 0 16px 0 rgba(0,0,0,0.18);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    padding: 0;
    border-right: none;
    border-left: 4px solid #333;
    border-top: 4px solid #333;
    border-right: 4px solid #333;
}

.chatbot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px 10px 18px;
    font-size: 15px;
    font-weight: 600;
    border-bottom: 1px solid #23243a;
    background: #000000;
    border-radius: 12px 0 0 0;
}

.chatbot-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    flex: 1 1 auto;
}

.chatbot-controls {
    display: flex;
    gap: 8px;
}

.chatbot-controls button {
    background: none;
    border: none;
    color: #555;
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px;
    padding: 2px 6px;
    transition: background 0.15s;
}
.chatbot-controls button:hover {
    background: #000000;
    color: #fff;
}

.chatbot-messages {
    flex: 1 1 auto;
    padding: 16px;
    overflow-y: auto;
    background: #000000;
    scrollbar-width: none; /* Firefox */
}
.chatbot-messages::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

.message {
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
}

.avatar {
    width: 32px;
    height: 32px;
    background-color: #e4370c; /* Глубже чёрного — не белый, не серый */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999; /* Очень тусклый серый для аватарки */
    font-size: 14px;
    font-weight: 500;
}

.content {
    flex: 1;
}

.content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-input {
    padding: 12px 16px;
    border-top: 1px solid #23243a;
    background-color: #000000; /* Глубже, чем основной фон — создаёт эффект "вдавленности" */
}

.input-controls {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.input-controls button {
    background: #000000;
    border: 1px solid #23243a;
    color: #888;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}
.input-controls button:hover {
    background: #23243a;
    color: #fff;
}

.input-text {
    width: 100%;
    background-color: #121417;
    border: 1px solid #23243a;
    color: #fff;
    padding: 8px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    resize: none;
    outline: none;
    border-radius: 4px;
    box-sizing: border-box;
}

.btn-send {
    background: none;
    border: none;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.15s;
}
.btn-send:hover {
    color: #fff;
}