/* Sidebar */
.sidebar {
    width: 260px;
    background: #1F1F1B;
    border-right: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1100;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: transparent;
    color: #666;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 6px;
    transition: all 0.2s;
}

.sidebar:not(.collapsed) .sidebar-close {
    display: flex;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #999;
}

.sidebar-close svg {
    width: 20px;
    height: 20px;
}

.sidebar.collapsed {
    cursor: pointer;
}

.sidebar.collapsed:hover {
    background: #1a1a1a;
}


/* Sidebar Menu Items */
.sidebar-menu {
    padding: 10px;
    padding-top: 40px; /* Отступ для кнопки закрытия */
}

.menu-item {
    padding: 10px 15px;
    margin-bottom: 2px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    position: relative;
    color: #caa999;
}

.menu-item:hover {
    background: #1a1a1a;
}

.menu-item.active {
    background: #1a1a1a;
    color: #79d3d3;
}

.menu-icon {
    width: 20px;
    text-align: center;
}

.menu-badge {
    position: absolute;
    right: 15px;
    background: #FF6B6B;
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* Market badge - убираем фон для emoji индикатора */
.menu-badge#marketBadge {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 14px;
}

/* Reports Submenu */
.menu-item.has-submenu {
    justify-content: flex-start;
}

.submenu-arrow {
    margin-left: auto;
    transition: transform 0.2s;
    opacity: 0.6;
}

.menu-item.has-submenu.open .submenu-arrow {
    transform: rotate(90deg);
}

.submenu {
    display: none;
    padding-left: 20px;
    margin-bottom: 5px;
}

.submenu.open {
    display: block;
}

.submenu-item {
    padding: 8px 12px;
    margin-bottom: 2px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #999;
    transition: all 0.2s;
}

.submenu-item:hover {
    background: #1a1a1a;
    color: #caa999;
}

.submenu-icon {
    width: 16px;
    opacity: 0.7;
}

.sidebar.collapsed .submenu-arrow {
    display: none;
}

.sidebar.collapsed .submenu {
    display: none;
    position: fixed;
    left: 60px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 6px;
    padding-left: 6px;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 1200;
    margin-bottom: 0;
}

.sidebar.collapsed .submenu.open {
    display: block;
}

/* Chat History */
.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.section-title {
    font-size: 11px;
    text-transform: uppercase;
    color: #666;
    padding: 10px;
    font-weight: 600;
}

.chat-item {
    padding: 10px;
    margin-bottom: 2px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    position: relative;
}

.chat-item:hover {
    background: #1a1a1a;
}

.chat-item.active {
    background: #1a1a1a;
    border-left: 2px solid #4CAF50;
    padding-left: 8px;
}

.chat-item-content {
    flex: 1;
    min-width: 0;
}

.chat-item-title {
    color: #e3e3e3;
    margin-bottom: 4px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-preview {
    color: #666;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-time {
    color: #555;
    font-size: 11px;
    margin-top: 4px;
}

.chat-item-menu {
    position: relative;
    opacity: 0;
    transition: opacity 0.2s;
}

.chat-item:hover .chat-item-menu {
    opacity: 1;
}

.chat-item-menu-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #888;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-item-menu-btn:hover {
    background: #333;
    color: #fff;
}

.chat-item-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    min-width: 120px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    overflow: hidden;
}

.chat-item-dropdown.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    color: #e3e3e3;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
}

.dropdown-item:hover {
    background: #333;
}

.dropdown-item.delete {
    color: #ff6b6b;
}

.dropdown-item.delete:hover {
    background: rgba(255, 107, 107, 0.15);
}

.chat-item.no-sessions {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    margin-left: 60px;
    width: calc(100% - 60px);
}

.main-content::-webkit-scrollbar {
    display: none;
}

.main-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Telegram Link Button */
.tg-link-btn {
    position: absolute;
    bottom: 72px;
    left: 22px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #888;
    transition: all 0.2s;
    z-index: 2;
}
.tg-link-btn:hover { background: #229ED9; color: #fff; }
.tg-link-btn.linked { color: #229ED9; }
.tg-link-btn.linked:hover { background: #229ED9; color: #fff; }

/* TG Link QR Modal */
.tg-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}
.tg-modal-overlay.active { display: flex; }
.tg-modal {
    background: #1a1a2e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    max-width: 360px;
    width: 90%;
    position: relative;
}
.tg-modal h3 {
    color: #e3e3e3;
    margin: 0 0 8px;
    font-size: 18px;
}
.tg-modal p {
    color: #888;
    font-size: 13px;
    margin: 0 0 20px;
    line-height: 1.5;
}
.tg-modal .qr-container {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    display: inline-block;
    margin-bottom: 16px;
}
.tg-modal .qr-container canvas { display: block; }
.tg-modal .tg-status {
    font-size: 13px;
    color: #888;
    margin-top: 12px;
}
.tg-modal .tg-status.success {
    color: #10b981;
    font-weight: 600;
}
.tg-modal .tg-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: #888;
    font-size: 22px;
    cursor: pointer;
}
.tg-modal .tg-close:hover { color: #fff; }
.tg-modal .tg-already-linked {
    color: #10b981;
    font-size: 14px;
}

/* User Avatar */
.user-avatar {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 220px;
    display: flex;
    align-items: center;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.user-avatar:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
    margin-right: 12px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.sidebar.collapsed .user-avatar-circle {
    width: 32px;
    height: 32px;
    font-size: 14px;
    margin-right: 0;
}

.user-info {
    min-width: 0;
    flex: 1;
}

.user-name {
    color: #e3e3e3;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status {
    color: #10b981;
    font-size: 12px;
    font-weight: 400;
}

/* Settings Menu */
.settings-menu {
    position: absolute;
    bottom: 80px;
    left: 20px;
    width: 220px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    max-height: 400px;
    overflow: visible;
    display: none;
    z-index: 1000;
}

.settings-menu-header {
    padding: 16px 20px 12px;
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    border-bottom: 1px solid #2a2a2a;
}

.settings-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    color: #e3e3e3;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-menu-item:hover {
    background: #2a2a2a;
    color: #fff;
}

.settings-value {
    color: #8b5cf6;
    font-size: 12px;
    font-weight: 500;
}

.settings-menu-divider {
    height: 1px;
    background: #2a2a2a;
    margin: 4px 0;
}

.settings-menu-item.logout-item {
    color: #ef4444;
    border-top: 1px solid #2a2a2a;
    margin-top: 4px;
}

.settings-menu-item.logout-item:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

/* Language submenu */
.language-item {
    position: relative;
}

.settings-arrow {
    color: #666;
    font-size: 16px;
    transition: transform 0.2s;
}

.language-submenu {
    position: absolute;
    left: 100%;
    top: 0;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    width: 140px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.2s ease;
    z-index: 10000;
}

.language-item:hover .language-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.language-item:hover .settings-arrow {
    transform: rotate(90deg);
}

.language-option {
    padding: 12px 16px;
    color: #e3e3e3;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.language-option:hover {
    background: #2a2a2a;
    color: #fff;
}

.language-option:first-child {
    border-radius: 8px 8px 0 0;
}

.language-option:last-child {
    border-radius: 0 0 8px 8px;
}

.language-option.active {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
}

/* Collapsed sidebar styles */

.sidebar.collapsed .sidebar-menu {
    padding: 5px;
    padding-top: 40px; /* Сохраняем отступ и в свернутом состоянии */
}

.sidebar.collapsed .menu-item {
    padding: 10px 8px;
    justify-content: center;
}

.sidebar.collapsed .menu-item span:not(.menu-icon) {
    display: none;
}

.sidebar.collapsed .menu-icon {
    margin-right: 0;
    font-size: 16px;
}

.sidebar.collapsed .chat-list {
    display: none;
}

.sidebar.collapsed .user-info {
    display: none;
}

.sidebar.collapsed .user-avatar {
    width: auto;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 4px;
    justify-content: center;
}
.sidebar.collapsed .tg-link-btn {
    left: 50%;
    transform: translateX(-50%);
}

/* Position Detail Styles */
.position-left-panel {
    width: 320px;
    background: #1a1a1a;
    border-right: 1px solid #2a2a2a;
    padding: 24px;
    overflow-y: auto;
}

.position-right-panel {
    flex: 1;
    background: #0a0a0a;
    padding: 24px;
    overflow-y: auto;
}

.stock-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.stock-price-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stock-symbol {
    font-size: 24px;
    font-weight: 700;
    color: white;
}

.stock-price {
    font-size: 32px;
    font-weight: 700;
    color: white;
}

.stock-change {
    font-size: 16px;
    font-weight: 600;
}

.stock-chart-mini {
    display: flex;
    align-items: center;
}

.stock-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.stock-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-label {
    color: #888;
    font-size: 14px;
}

.detail-value {
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.recent-transactions-section {
    background: #1a1a1a;
    border-top: 1px solid #2a2a2a;
    padding: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h3 {
    color: white;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.transaction-search {
    position: relative;
    display: flex;
    align-items: center;
}

.transaction-search svg {
    position: absolute;
    left: 12px;
    color: #666;
    z-index: 1;
}

.transaction-search input {
    padding: 8px 12px 8px 40px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    width: 200px;
}

.transaction-search input::placeholder {
    color: #666;
}

.transactions-table {
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    border: none;
}

.transactions-table .table-header {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 0.8fr 1fr 1fr 1fr;
    padding: 16px 20px;
    background: transparent;
    border-bottom: 1px solid #2a2a2a;
    font-weight: 600;
    color: #ccc;
    font-size: 14px;
}

.transactions-table .table-body {
    max-height: 400px;
    overflow-y: auto;
}

.transaction-row {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 0.8fr 1fr 1fr 1fr;
    padding: 16px 20px;
    border-bottom: 1px solid #2a2a2a;
    align-items: center;
    transition: background-color 0.2s;
}

.transaction-row:hover {
    background: #1a1a1a;
}

.transaction-row:last-child {
    border-bottom: none;
}

.transaction-date {
    color: #ccc;
    font-size: 14px;
}

.transaction-type {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.transaction-type.buy {
    color: #7CC3E4;
}

.transaction-type.sell {
    color: #FF6B6B;
}

.transaction-quantity {
    color: white;
    font-weight: 600;
}

.transaction-price {
    color: white;
    font-weight: 600;
}

.transaction-total {
    color: white;
    font-weight: 600;
}

.transaction-gain {
    font-weight: 600;
}

/* Position Detail View Styles */
.position-detail-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #0a0a0a;
    overflow-y: auto;
}

.position-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: #0a0a0a;
}

.position-content {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
    background: #0a0a0a;
    max-width: 1000px; /* Same width as Stock Detail */
    margin: 0 auto; /* Center the content */
}

.back-button {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.back-button:hover {
    background: #333;
}

.position-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    margin-left: 20px;
}

.position-logo {
    width: 30px; /* Уменьшили на 25% (было 40px) */
    height: 30px; /* Уменьшили на 25% (было 40px) */
    border-radius: 6px; /* Пропорционально уменьшили (было 8px) */
    background: #8b5cf6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px; /* Уменьшили на 25% (было 18px) */
}

.position-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.position-info h2 {
    color: #fff;
    margin: 0;
    font-size: 18px; /* Сделали такой же как у цены */
    font-weight: 600;
}

.position-info span {
    color: #888;
    font-size: 14px;
}

.position-actions {
    display: flex;
    gap: 12px;
}

.edit-asset-btn {
    background: #1a1a1a;
    color: white;
    border: 1px solid #2a2a2a;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    transition: background 0.2s;
}

.edit-asset-btn:hover {
    background: #333;
}

.edit-asset-dropdown {
    position: relative;
}

.edit-asset-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 4px;
    min-width: 140px;
    z-index: 1000;
    margin-top: 4px;
}

.dropdown-item {
    width: 100%;
    background: transparent;
    border: none;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: background 0.2s;
    text-align: left;
}

.dropdown-item:hover {
    background: #2a2a2a;
}

.dropdown-item.delete-item:hover {
    background: #dc2626;
}
