﻿/* Общие стили */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #1a1d29;
    color: #d1d4dc;
    line-height: 1.6;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 20px;
}


/* Заголовок */

header {
    background: #1e2229;
    padding: 14px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

header h1 {
    font-size: 28px;
    margin-bottom: 15px;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.header-right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}


/* Бейдж подключения */

.connection-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.connection-badge.disconnected {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
}

.connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
    flex-shrink: 0;
}

.connection-badge.disconnected .connection-dot {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.status-value {
    font-weight: 600;
    font-size: 13px;
    color: #d1d4dc;
    white-space: nowrap;
}

.status-value.connected {
    color: #10b981;
}

.status-value.disconnected {
    color: #ef4444;
}


/* Бейджи бирж */

.exchange-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.exchange-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
    cursor: default;
}

.exchange-badge:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.12);
}

.exchange-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6b7280;
    flex-shrink: 0;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.exchange-badge.active .exchange-dot {
    background: #10b981;
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.5);
}

.exchange-badge.error .exchange-dot {
    background: #ef4444;
}

.exchange-name {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
    white-space: nowrap;
}

.exchange-badge.active .exchange-name {
    color: #d1d4dc;
}

.exchange-count {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.exchange-badge.active .exchange-count {
    color: #10b981;
    background: rgba(16, 185, 129, 0.12);
}


/* Разделитель между строками в header */

.header-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08) 20%, rgba(255, 255, 255, 0.08) 80%, transparent);
    margin: 12px 0;
}


/* Панель фильтров (внутри header) */

.filters-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filters-main {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 120px;
    min-width: 100px;
}

.filter-item .search-input-wrapper {
    width: 100%;
}

.filter-item .custom-select-wrapper {
    width: 100%;
}

.filter-item-narrow {
    flex: 0 1 90px;
    min-width: 70px;
}

.filter-item-narrow .filter-input {
    width: 100%;
    padding: 8px 10px;
    background: #2b3139;
    border: 1px solid #3e4651;
    border-radius: 8px;
    color: #d1d4dc;
    font-size: 13px;
    height: 38px;
    text-align: center;
}

.filter-item-narrow .filter-input:focus {
    outline: none;
    border-color: #667eea;
}

.filter-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.filter-label i {
    font-size: 14px;
    color: #667eea;
}

.filter-unit {
    font-size: 12px;
    color: #6b7280;
}

.filter-input-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.filter-actions {
    display: flex;
    gap: 8px;
    flex: 1 1 200px;
    min-width: 150px;
    align-self: flex-end;
}

.filter-actions .btn {
    height: 38px;
    padding: 0 14px;
    justify-content: center;
    border-radius: 10px;
    font-size: 13px;
    white-space: nowrap;
    flex: 1 1 0;
    min-width: 0;
}

.filter-actions .btn i {
    font-size: 16px;
}

.buttons-group {
    display: contents;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 3px;
}

.input-group label .hint {
    font-size: 10px;
    color: #6b7280;
    font-style: italic;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper i {
    position: absolute;
    left: 10px;
    color: #6b7280;
    font-size: 16px;
    pointer-events: none;
}

.search-input {
    padding: 8px 10px 8px 34px !important;
    background: #2b3139;
    border: 1px solid #3e4651;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    height: 38px;
    width: 100%;
    text-transform: uppercase;
}

.search-input::placeholder {
    text-transform: none !important;
    color: #6b7280;
    opacity: 1;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

.input-group input,
.input-group select {
    padding: 10px 12px;
    background: #2b3139;
    border: 1px solid #3e4651;
    border-radius: 8px;
    color: #d1d4dc;
    font-size: 14px;
    height: 42px;
}

.input-group select[multiple] {
    padding: 4px;
    min-height: 60px;
}

.input-group select[multiple] option {
    padding: 4px 8px;
    border-radius: 3px;
    margin: 2px 0;
}

.input-group select[multiple] option:checked {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #667eea;
}


/* Кастомный dropdown с чекбоксами */

.custom-select-wrapper {
    position: relative;
}

.custom-select {
    position: relative;
    cursor: pointer;
}

.custom-select-trigger {
    padding: 8px 28px 8px 10px;
    background: #2b3139;
    border: 1px solid #3e4651;
    border-radius: 8px;
    color: #d1d4dc;
    font-size: 13px;
    display: block;
    height: 38px;
    line-height: 22px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.custom-select-trigger::after {
    content: '▼';
    font-size: 8px;
    color: #6b7280;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s;
}

.custom-select.open .custom-select-trigger::after {
    transform: rotate(180deg);
}

.custom-select.open .custom-select-trigger {
    border-color: #667eea;
}

.custom-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #2b3139;
    border: none;
    border-radius: 0 0 8px 8px;
    max-height: 0;
    overflow: hidden;
    z-index: 100;
    transition: max-height 0.3s ease-out;
    box-shadow: none;
}

.custom-select.open .custom-options {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #3e4651;
    border-top: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.custom-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    gap: 8px;
}

.custom-option:hover {
    background-color: #252833;
}

.custom-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin: 0;
}

.custom-option span {
    color: #d1d4dc;
    font-size: 14px;
}

.custom-option input[type="checkbox"]:checked+span {
    color: #667eea;
    font-weight: 600;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 20px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.checkbox-group-inline {
    display: flex;
    gap: 15px;
    padding: 8px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #d1d4dc;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.btn {
    padding: 10px 18px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
    align-self: end;
    height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #5a6fd6 100%);
    color: white;
    grid-column: span 1;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #4c5fc4 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
    background: #3d4fb8;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    grid-column: span 1;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #c42020 100%);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
    background-color: #374151;
    color: #d1d4dc;
    grid-column: span 1;
}

.btn-secondary:hover {
    background-color: #4b5563;
}


/* Профили уведомлений */

.profile-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-section .filter-label {
    flex-shrink: 0;
}

.profile-buttons {
    display: flex;
    gap: 6px;
}

.profile-btn-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.profile-btn {
    position: relative;
    width: 42px;
    height: 36px;
    padding: 0;
    border: 1px solid #3e4651;
    border-radius: 8px;
    background: #2b3139;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-clear-btn {
    width: 42px;
    height: 16px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

.profile-btn-wrapper:hover .profile-clear-btn {
    opacity: 1;
}

.profile-clear-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.profile-btn .profile-number {
    font-size: 18px;
    font-weight: 700;
    transition: opacity 0.2s;
}

.profile-btn .profile-icon {
    position: absolute;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s;
}

.profile-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.profile-btn:hover .profile-number {
    opacity: 0.3;
}

.profile-btn:hover .profile-icon {
    opacity: 1;
}

.profile-btn.saved {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.profile-btn.saved .profile-icon {
    opacity: 0;
}

.profile-btn.saved .profile-number {
    opacity: 1;
}

.profile-btn.saving {
    border-color: #f59e0b;
    animation: pulse-save 0.5s ease;
}

@keyframes pulse-save {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}


/* Таблица пар */

.pairs-table-container {
    background: #1e2229;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow-x: auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

#pairsTable {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}


/* Столбец Монета - фиксированная ширина */

#pairsTable thead th:nth-child(1),
#pairsTable tbody td:nth-child(1) {
    width: 150px;
    min-width: 150px;
    text-align: left;
    padding-left: 15px;
}


/* Средние столбцы - гибкая ширина */

#pairsTable thead th:nth-child(2),
#pairsTable thead th:nth-child(3),
#pairsTable thead th:nth-child(4),
#pairsTable thead th:nth-child(5),
#pairsTable tbody td:nth-child(2),
#pairsTable tbody td:nth-child(3),
#pairsTable tbody td:nth-child(4),
#pairsTable tbody td:nth-child(5) {
    text-align: center;
}


/* Столбец с кнопками - фиксированная ширина */

#pairsTable thead th:nth-child(6),
#pairsTable tbody td:nth-child(6) {
    width: 160px;
    min-width: 160px;
    text-align: center;
    padding-left: 55px;
}

#pairsTable thead th {
    text-align: left;
    padding: 12px;
    background-color: #252833;
    font-size: 12px;
    color: #71717a;
    border-bottom: 1px solid #2b3139;
    white-space: nowrap;
}


/* Кнопка */

#pairsTable tbody td {
    padding: 12px;
    border-bottom: 1px solid #2b3139;
    font-size: 14px;
}

#pairsTable tbody tr {
    transition: background-color 0.3s ease;
}

#pairsTable tbody tr:hover {
    background-color: #252833;
}


/* Строка выходит из фильтра - краснеет перед удалением */

#pairsTable tbody tr.row-fading {
    background-color: rgba(239, 68, 68, 0.2);
    animation: fade-red 2s ease-out;
}


/* Строка вернулась в фильтр - мигает зелёным */

#pairsTable tbody tr.row-recovered {
    background-color: rgba(16, 185, 129, 0.3);
    animation: flash-green 0.5s ease-out;
}

@keyframes fade-red {
    0% {
        background-color: rgba(239, 68, 68, 0.3);
    }
    100% {
        background-color: rgba(239, 68, 68, 0.15);
    }
}

@keyframes flash-green {
    0% {
        background-color: rgba(16, 185, 129, 0.4);
    }
    50% {
        background-color: rgba(16, 185, 129, 0.2);
    }
    100% {
        background-color: transparent;
    }
}

.positive {
    color: #10b981;
}

.negative {
    color: #ef4444;
}

.exchange-label {
    font-size: 12px;
    color: #667eea;
    font-weight: normal;
    display: block;
    position: relative;
    z-index: 1;
}

.exchange-label a {
    padding: 2px 4px;
    margin: -2px -4px;
    display: inline-block;
    position: relative;
    z-index: 2;
}

.exchange-label a:hover {
    text-decoration: underline;
}

.btn-chart {
    padding: 8px 16px;
    font-size: 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.3s ease;
    font-weight: 600;
    margin-right: 5px;
    vertical-align: middle;
    line-height: 1;
    transform: translateY(6px);
}

.btn-chart:hover {
    background: #4c5fd5;
}

.btn-chart:active {
    background: #3d4fb8;
}

.btn-blacklist {
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #8b4545;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    user-select: none;
    vertical-align: middle;
    line-height: 1.2;
    white-space: nowrap;
    margin-left: -5px;
    transform: translateY(2px);
}

.btn-blacklist:hover {
    color: #d32f2f;
    text-decoration: underline;
}

.btn-blacklist:active {
    color: #b71c1c;
}


/* График */

.chart-container {
    background-color: #252833;
    padding: 20px;
    border-radius: 10px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h2 {
    font-size: 20px;
    color: #667eea;
}

.chart-controls {
    display: flex;
    gap: 10px;
}

#chart {
    height: 400px;
    border: 1px solid #374151;
    border-radius: 5px;
}


/* Детали */

.details-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #374151;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.details-section {
    background-color: #1a1d29;
    padding: 15px;
    border-radius: 8px;
}

.details-section h3 {
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #374151;
}

.exchange-binance {
    color: #f0b90b;
}

.exchange-gate {
    color: #4169e1;
}

.details-content p {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

.details-content span {
    font-weight: bold;
}


/* Страница деталей пары */

.pair-info-container {
    margin-bottom: 20px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.info-card {
    background: #252836;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #374151;
}

.info-card h3 {
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #374151;
}

.info-card p {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}


/* Стаканы ордеров */

.orderbook-container {
    margin-top: 30px;
}

.orderbook-container h2 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #667eea;
}

.orderbook-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.orderbook-card {
    background: #252836;
    padding: 20px;
    border-radius: 10px;
}

.orderbook-card h3 {
    font-size: 16px;
    margin-bottom: 15px;
}

.orderbook-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 10px 5px;
    font-size: 12px;
    color: #9ca3af;
    border-bottom: 1px solid #374151;
    margin-bottom: 10px;
}

.orderbook-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 5px;
    font-size: 13px;
}

.orderbook-row.ask {
    color: #ef4444;
}

.orderbook-row.bid {
    color: #10b981;
}

.orderbook-spread {
    text-align: center;
    padding: 10px;
    background: #374151;
    color: #fbbf24;
    margin: 10px 0;
    border-radius: 5px;
    font-weight: bold;
}


/* Поиск монеты для мобильных */

.mobile-search-wrapper {
    display: none;
}


/* Кнопка фильтров для мобильных */

.mobile-filters-toggle {
    display: none;
    width: 100%;
    padding: 12px;
    background: #2b3139;
    border: 1px solid #3e4651;
    border-radius: 8px;
    color: #d1d4dc;
    font-size: 14px;
    cursor: pointer;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.2s;
}

.mobile-filters-toggle:hover {
    background: #323844;
}

.mobile-filters-toggle i {
    font-size: 20px;
}

.mobile-filters-toggle .toggle-icon {
    transition: transform 0.3s;
}

.mobile-filters-toggle.open .toggle-icon {
    transform: rotate(180deg);
}

@media (max-width: 768px) {
    /* Показываем поле поиска на мобильных */
    .mobile-search-wrapper {
        display: block;
        margin-bottom: 10px;
    }
    /* Скрываем поиск из панели фильтров на мобильных */
    .filters-row .filter-item:has(#pairSearchInput) {
        display: none;
    }
    /* Показываем кнопку фильтров на мобильных */
    .mobile-filters-toggle {
        display: flex;
    }
    /* Скрываем бейджи бирж на мобильных */
    .exchange-badges {
        display: none;
    }
    .connection-badge {
        margin-bottom: 0;
    }
    /* Панель фильтров сворачивается */
    .filters-row {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out, padding 0.3s ease-out;
        padding: 0;
    }
    .filters-row.open {
        max-height: 2000px;
        padding: 10px 0 2px 0;
    }
    .filters-main {
        flex-direction: column;
        gap: 10px;
    }
    .filter-item {
        width: 100% !important;
        flex: unset !important;
    }
    .filter-item .filter-label {
        margin-bottom: 2px;
    }
    .filter-item-narrow {
        width: 100% !important;
        flex: unset !important;
    }
    .filter-item-narrow .filter-input {
        width: 100%;
        text-align: left;
        padding-left: 12px;
    }
    .filter-input-row {
        width: 100%;
    }
    .filter-input-row .filter-input {
        flex: 1;
    }
    .filter-actions {
        margin-left: 0;
        width: 100%;
        flex: unset !important;
    }
    .filter-actions .btn {
        flex: 1;
        padding: 10px 16px;
        font-size: 14px;
    }
    .btn-danger i {
        display: none;
    }
    .header-divider {
        margin: 8px 0 0 0;
    }
    /* Профили на мобильных */
    .profile-section {
        flex-wrap: wrap;
    }
    /* Оптимизация таблицы для мобильных */
    .container {
        padding: 10px;
    }
    header {
        padding: 10px;
        margin-bottom: 10px;
    }
    .pairs-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px;
        margin-bottom: 10px;
    }
    /* Скрываем колонки Ставка, Спред ставки, Long ask / Short bid на мобильных */
    #pairsTable thead th:nth-child(2),
    #pairsTable thead th:nth-child(3),
    #pairsTable thead th:nth-child(4),
    #pairsTable tbody td:nth-child(2),
    #pairsTable tbody td:nth-child(3),
    #pairsTable tbody td:nth-child(4) {
        display: none;
    }
    /* Таблица на весь экран с одинаковыми отступами */
    #pairsTable {
        font-size: 12px;
        width: 100%;
        display: table;
        table-layout: fixed;
    }
    #pairsTable thead th,
    #pairsTable tbody td {
        padding: 8px;
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    /* Равномерное распределение ширины для всех столбцов */
    #pairsTable thead th:nth-child(1) {
        width: 33.33%;
    }
    /* Монета */
    #pairsTable thead th:nth-child(5) {
        width: 33.33%;
    }
    /* Спред курса */
    #pairsTable thead th:nth-child(6) {
        width: 33.34%;
    }
    /* Кнопки */
    /* Выравнивание последнего столбца с кнопками */
    #pairsTable thead th:last-child,
    #pairsTable tbody td:last-child {
        text-align: center;
        vertical-align: middle;
    }
    /* Выравнивание столбца спред курса - по центру с отступом под кнопку Фильтры */
    #pairsTable thead th:nth-child(5),
    #pairsTable tbody td:nth-child(5) {
        text-align: center;
        padding-left: 25px;
    }
    /* Заголовки таблицы - уменьшенный размер для лучшего переноса */
    #pairsTable thead th {
        font-size: 10px;
        line-height: 1.2;
    }
    /* Кнопки в таблице - компактные для мобильных */
    .btn-chart {
        padding: 6px 10px !important;
        font-size: 11px !important;
        vertical-align: middle !important;
        display: inline-block !important;
        margin: 0 !important;
        transform: translateY(-2px) !important;
        margin-left: 45px !important;
    }
    /* Скрываем кнопку черного списка на мобильных */
    .btn-blacklist {
        display: none !important;
    }
    .table-actions {
        display: inline-block;
    }
    /* Сокращение текста в ячейках */
    .exchange-label {
        font-size: 10px;
        display: block;
        line-height: 1.3;
    }
    /* Кнопки в таблице - вертикальный стек */
    #pairsTable tbody td:last-child {
        padding: 4px 2px;
    }
    .table-actions {
        display: flex;
        flex-direction: column;
        gap: 4px;
        align-items: stretch;
    }
    .btn-view-pair {
        padding: 6px 8px;
        font-size: 10px;
        width: 100%;
        white-space: nowrap;
    }
    .btn-blacklist {
        padding: 6px;
        font-size: 14px;
        width: 100%;
    }
    /* Модальное окно черного списка */
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    .modal-header {
        padding: 15px;
    }
    .modal-header h2 {
        font-size: 16px;
    }
    .modal-body {
        padding: 15px;
    }
    .blacklist-add-section {
        flex-direction: column;
    }
    .blacklist-input {
        width: 100%;
    }
}


/* Дополнительная оптимизация для очень маленьких экранов */

@media (max-width: 480px) {
    #pairsTable {
        font-size: 11px;
    }
    #pairsTable thead th,
    #pairsTable tbody td {
        padding: 6px;
    }
    #pairsTable thead th {
        font-size: 10px;
    }
    /* Еще более компактные колонки */
    #pairsTable thead th:nth-child(1) {
        width: 70px;
        min-width: 70px;
    }
    #pairsTable thead th:nth-child(2) {
        width: 100px;
        min-width: 100px;
    }
    #pairsTable thead th:nth-child(3) {
        width: 60px;
        min-width: 60px;
    }
    #pairsTable thead th:nth-child(4) {
        width: 90px;
        min-width: 90px;
    }
    #pairsTable thead th:nth-child(5) {
        width: 60px;
        min-width: 60px;
    }
    #pairsTable thead th:nth-child(6) {
        width: 80px;
        min-width: 80px;
    }
    .exchange-label {
        font-size: 9px;
    }
    .btn-view-pair {
        padding: 5px 6px;
        font-size: 9px;
    }
    .btn-blacklist {
        padding: 5px;
        font-size: 12px;
    }
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

.loading {
    animation: pulse 1.5s infinite;
}


/* Модальное окно черного списка */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #1e2229;
    margin: auto;
    padding: 0;
    border: 1px solid #2a2f3a;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: slideDown 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 25px;
    background-color: #252a34;
    border-bottom: 1px solid #2a2f3a;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h2 i {
    font-size: 24px;
    color: #f44336;
}

.close {
    color: #aaa;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: #fff;
}

.modal-body {
    padding: 25px;
}

.blacklist-add-section {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.blacklist-input {
    flex: 1;
    padding: 10px 15px;
    background: #252a34;
    border: 1px solid #2a2f3a;
    border-radius: 5px;
    color: #d1d4dc;
    font-size: 14px;
    transition: all 0.3s;
}

.blacklist-input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1);
}

.blacklist-input::placeholder {
    color: #666;
}

.blacklist-list-section h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #d1d4dc;
}

.blacklist-list-section h3 span {
    color: #4a90e2;
}

.blacklist-items {
    max-height: 300px;
    overflow-y: auto;
    background: #252a34;
    border-radius: 5px;
    padding: 10px;
}

.blacklist-items::-webkit-scrollbar {
    width: 8px;
}

.blacklist-items::-webkit-scrollbar-track {
    background: #1e2229;
    border-radius: 4px;
}

.blacklist-items::-webkit-scrollbar-thumb {
    background: #4a90e2;
    border-radius: 4px;
}

.blacklist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #1e2229;
    border-radius: 5px;
    margin-bottom: 8px;
    transition: all 0.3s;
}

.blacklist-item:hover {
    background: #2a2f3a;
}

.blacklist-item:last-child {
    margin-bottom: 0;
}

.blacklist-item-symbol {
    font-weight: 600;
    color: #d1d4dc;
    font-size: 14px;
}

.blacklist-item-remove {
    background: transparent;
    border: none;
    color: #f44336;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 3px;
    transition: all 0.3s;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blacklist-item-remove:hover {
    background: rgba(244, 67, 54, 0.1);
}

.blacklist-empty {
    text-align: center;
    padding: 30px;
    color: #666;
}

.blacklist-empty i {
    font-size: 48px;
    margin-bottom: 10px;
    display: block;
}

.blacklist-info {
    margin-top: 20px;
    padding: 15px;
    background: rgba(74, 144, 226, 0.1);
    border-left: 3px solid #4a90e2;
    border-radius: 5px;
}

.blacklist-info p {
    margin: 0;
    font-size: 13px;
    color: #aaa;
    display: flex;
    align-items: center;
    gap: 8px;
}

.blacklist-info i {
    font-size: 18px;
    color: #4a90e2;
}

.btn-danger i {
    font-size: 18px;
}


/* Уведомления */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #252a34;
    color: #d1d4dc;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    z-index: 2000;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification i {
    font-size: 24px;
}

.notification-success {
    border-left: 4px solid #4caf50;
}

.notification-success i {
    color: #4caf50;
}

.notification-error {
    border-left: 4px solid #f44336;
}

.notification-error i {
    color: #f44336;
}

.notification-warning {
    border-left: 4px solid #ff9800;
}

.notification-warning i {
    color: #ff9800;
}

.notification-info {
    border-left: 4px solid #4a90e2;
}

.notification-info i {
    color: #4a90e2;
}


/* ========== User Section (Header) ========== */

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: white;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 13px;
    color: #fff;
    line-height: 1.2;
}

.user-telegram {
    font-size: 11px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 3px;
    line-height: 1.2;
}

.user-telegram i {
    color: #0088cc;
    font-size: 12px;
}

.user-telegram.linked {
    color: #10b981;
}

.user-actions {
    display: flex;
    gap: 6px;
    margin-left: 8px;
}

.user-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    transition: all 0.2s;
}

.user-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    color: #d1d4dc;
}

.user-btn#linkTelegramBtn:hover {
    color: #0088cc;
    border-color: rgba(0, 136, 204, 0.4);
    background: rgba(0, 136, 204, 0.1);
}

.user-btn#logoutBtn:hover {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.1);
}

.login-prompt {
    display: flex;
    align-items: center;
}

.login-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.login-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

.login-link i {
    font-size: 18px;
}


/* ========== Telegram Modal ========== */

.telegram-modal {
    max-width: 450px;
}

.telegram-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.telegram-step {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 15px;
    background: rgba(0, 136, 204, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(0, 136, 204, 0.2);
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #0088cc;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.telegram-step p {
    color: #d1d4dc;
    font-size: 14px;
}

.telegram-bot-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #0088cc;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.telegram-bot-link:hover {
    background: #0077b5;
    transform: translateY(-1px);
}

.telegram-code {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #1a1d29;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    color: #4a90e2;
    border: 1px solid rgba(74, 144, 226, 0.3);
}

.telegram-code #linkCode {
    font-weight: 700;
    letter-spacing: 2px;
}

.copy-btn {
    padding: 6px 10px;
    background: rgba(74, 144, 226, 0.2);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 6px;
    color: #4a90e2;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: rgba(74, 144, 226, 0.3);
}

.telegram-status {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 8px;
    color: #ffc107;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.telegram-status.success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.telegram-status.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}


/* ========== Profile Section Enhanced ========== */

.profile-active-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(16, 185, 129, 0.2);
    border-radius: 4px;
    font-size: 10px;
    color: #10b981;
    margin-left: 8px;
}

.profile-btn.active {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    border-color: #10b981 !important;
}

.profile-btn.has-data {
    background: rgba(74, 144, 226, 0.2);
    border-color: rgba(74, 144, 226, 0.5);
}


/* ========== Mobile Responsive ========== */

@media (max-width: 768px) {
    .header-row {
        flex-wrap: wrap;
    }
    .header-left {
        flex: 1;
    }
    .header-right {
        flex-shrink: 0;
    }
    .user-details {
        display: none;
    }
    .user-actions {
        margin-left: 4px;
    }
}