/* Alerts Panel - ФИКСИРОВАННАЯ 1/3 высоты */
.alerts-panel {
    height: 33.33vh; /* Строго 1/3 высоты экрана */
    border-bottom: 1px solid #2a2a2a;
    background: #0f0f0f;
    display: none; /* По умолчанию скрыты */
    flex-direction: column;
}

.alerts-panel.hidden {
    display: none;
}

.alerts-header {
    padding: 15px 20px;
    background: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.close-panel {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    color: #e3e3e3;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.close-panel:hover {
    background: #2a2a2a;
    border-color: #3a3a3a;
    transform: translateY(-1px);
}

.alerts-title {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Alert Filter Buttons */
.alert-filters {
    display: flex;
    gap: 8px;
    margin-left: 15px;
}

.filter-btn {
    padding: 4px 12px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    color: #999;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.filter-btn:hover {
    background: #2a2a2a;
    border-color: #3a3a3a;
}

.filter-btn.active {
    color: #fff;
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.2);
}

.filter-btn.buy {
    border-color: #00dd77;
}

.filter-btn.buy.active {
    background: rgba(0, 221, 119, 0.2);
    color: #00dd77;
}

.filter-btn.sell {
    border-color: #FF6B6B;
}

.filter-btn.sell.active {
    background: rgba(255, 68, 68, 0.2);
    color: #FF6B6B;
}

.filter-btn.portfolio {
    border-color: #8b5cf6;
}

.filter-btn.portfolio.active {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
}

.filter-btn .filter-count {
    background: rgba(255, 255, 255, 0.1);
    padding: 1px 5px;
    border-radius: 10px;
    font-size: 10px;
    margin-left: 2px;
}

.ticker-filter {
    position: relative;
    display: flex;
    align-items: center;
}

.ticker-input {
    padding: 4px 30px 4px 8px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    color: #e3e3e3;
    border-radius: 6px;
    font-size: 12px;
    width: 150px;
    transition: all 0.2s;
}

.ticker-input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: #252525;
}

.ticker-input::placeholder {
    color: #666;
}

.clear-ticker-btn {
    position: absolute;
    right: 6px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 2px;
    border-radius: 2px;
    font-size: 14px;
    line-height: 1;
    transition: color 0.2s;
}

.clear-ticker-btn:hover {
    color: #FF6B6B;
}

/* Market Selector Styles */
.market-selector-container {
    position: relative;
    display: inline-block;
}

.market-selector-btn {
    padding: 8px 16px;
    background-color: rgba(0, 200, 200, 0.15);
    border: 1px solid rgba(124, 195, 228, 0.5);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    justify-content: space-between;
    color: #7CC3E4;
}

.market-selector-btn:hover {
    background: #2a2a2a;
}

.market-selector-btn.active {
    background-color: rgba(0, 200, 200, 0.15);
    border-color: rgba(124, 195, 228, 0.5);
    color: #7CC3E4;
}

.market-selector-arrow {
    transition: transform 0.2s;
}

.market-selector-btn.active .market-selector-arrow {
    transform: rotate(180deg);
}

.market-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    margin-top: 4px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 200px;
}

.market-dropdown-list {
    display: flex;
    flex-direction: column;
}

.market-dropdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.market-column {
    display: flex;
    flex-direction: column;
}

.market-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    border-right: 1px solid #2a2a2a;
    font-size: 12px;
}

.market-column:last-child .market-item {
    border-right: none;
}

.market-item:hover {
    background: #2a2a2a;
}

.market-item.active {
    background-color: rgba(0, 200, 200, 0.15);
    border-color: rgba(124, 195, 228, 0.5);
    color: #7CC3E4;
}

.market-flag {
    font-size: 14px;
    min-width: 16px;
}

.market-name {
    flex: 1;
    color: #e3e3e3;
}

.market-currency {
    color: #666;
    font-size: 10px;
    font-weight: 500;
}

.market-item.active .market-name {
    color: #7CC3E4;
}

.market-item.active .market-currency {
    color: #7CC3E4;
}

.alert-count {
    background: #FF6B6B;
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

/* Alerts List with Scroll */
.alerts-list {
    flex: 1;
    overflow-y: auto;
    padding: 5px 0;
}

.alert-list-item {
    padding: 8px 20px; /* Компактнее */
    border-bottom: 1px solid #1a1a1a;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.alert-list-item:hover {
    background: #1a1a1a;
}

.alert-list-item.critical {
    border-left: 3px solid #FF6B6B;
}

.alert-list-item.high {
    border-left: 3px solid #ff8800;
}

.alert-list-item.unread {
    background: rgba(59, 130, 246, 0.05);
    border-right: 3px solid #3b82f6;
}

.alert-new-badge {
    display: inline-block;
    background: #3b82f6;
    color: white;
    font-size: 9px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.alert-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.alert-item-main {
    flex: 1;
    min-width: 0; /* Для правильного overflow */
}

/* Объединенная строка: TICKER + событие */
.alert-item-ticker-title {
    color: #e3e3e3;
    font-size: 13px;
    line-height: 1.3;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.alert-item-ticker {
    color: #8b5cf6;
    font-weight: 600;
    margin-right: 8px;
}

.alert-item-time {
    color: #666;
    font-size: 11px;
    flex-shrink: 0;
}

.alert-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-item-type {
    background: #2a2a2a;
    color: #888;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
}

.alert-item-priority {
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
}

.alert-item-priority.critical {
    background: #FF6B6B;
    color: #fff;
}

.alert-item-priority.high {
    background: #ff8800;
    color: #fff;
}

.alert-item-priority.normal {
    background: #444;
    color: #aaa;
}

/* Signal badges */
.alert-item-signal {
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    margin-right: 4px;
}

.alert-item-signal.buy {
    background: #8b5cf6;
    color: #000;
}

.alert-item-signal.sell {
    background: #FF6B6B;
    color: #fff;
}

.alert-item-signal.short {
    background: #ff8800;
    color: #fff;
}

.alert-item-signal.long {
    background: #0088ff;
    color: #fff;
}

.alert-item-signal.watch {
    background: #666;
    color: #fff;
}

/* Alert price badge */
.alert-item-price {
    background: #2d7d2d;
    color: #fff;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    margin-right: 4px;
}

/* Price change badge */
.alert-item-change {
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    margin-right: 4px;
}

.alert-item-change.positive {
    background: #7CC3E4;
    color: #fff;
}

.alert-item-change.negative {
    background: #FF6B6B;
    color: #fff;
}

/* Alert Detail View */
.alert-detail-view {
    height: 33.33vh;
    background: #0f0f0f;
    border-bottom: 1px solid #2a2a2a;
    display: none;
    flex-direction: column;
}

.alert-detail-header {
    padding: 15px 20px;
    background: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}

.alert-detail-title {
    font-size: 14px;
    font-weight: 600;
    color: #8b5cf6;
}

.fundamentals-header-title {
    font-size: 14px;
    font-weight: 600;
    color: #8b5cf6;
    display: flex;
    align-items: center;
    gap: 6px;
}

.back-btn {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    color: #e3e3e3;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.back-btn:hover {
    background: #2a2a2a;
    border-color: #3a3a3a;
    transform: translateY(-1px);
}

.alert-detail-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Alert Detail - Left Side (40%) */
.alert-detail-left {
    width: 40%;
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid #2a2a2a;
    position: relative;
}

.alert-detail-header {
    display: flex;
    align-items: baseline;
    gap: 15px;
    margin-bottom: 8px;
}

.alert-detail-ticker {
    color: #8b5cf6;
    font-size: 18px;
    font-weight: 600;
}

.alert-detail-current-price {
    color: #00ff88;
    font-size: 24px;
    font-weight: 700;
    text-shadow: 0 0 5px rgba(0, 255, 136, 0.3);
}

.alert-detail-type {
    color: #888;
    font-size: 12px;
    margin-bottom: 15px;
    padding: 4px 8px;
    background: #2a2a2a;
    border-radius: 4px;
    display: inline-block;
}

.alert-detail-description {
    color: #ccc;
    line-height: 1.6;
    font-size: 14px;
    white-space: pre-wrap;
    margin-bottom: 20px;
}

.alert-detail-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.alert-action-btn {
    padding: 8px 16px;
    border: 1px solid #2a2a2a;
    background: #1a1a1a;
    color: #e3e3e3;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.alert-action-btn:hover {
    background: #2a2a2a;
    border-color: #3a3a3a;
}

.alert-action-btn.primary {
    background: #8b5cf6;
    color: #000;
    border-color: #8b5cf6;
}

.alert-action-btn.primary:hover {
    background: #00dd77;
}

/* Fundamentals - Right Side (60%) */
.alert-detail-right {
    width: 60%;
    padding: 20px;
    overflow-y: auto;
    background: #0a0a0a;
}

.fundamentals-section {
    margin-bottom: 20px;
}

.fundamentals-title {
    color: #8b5cf6;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fundamentals-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.fundamentals-item {
    background: #1a1a1a;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #2a2a2a;
}

.fundamentals-label {
    color: #888;
    font-size: 11px;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.fundamentals-value {
    color: #e3e3e3;
    font-size: 14px;
    font-weight: 600;
}

.fundamentals-placeholder {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

.fundamentals-container {
    max-height: 300px;
    overflow-y: auto;
}

.fundamentals-loading {
    color: #666;
    text-align: center;
    padding: 20px;
    font-style: italic;
}

.fundamentals-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    background: #2a2a2a;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    overflow: hidden;
}

.fundamentals-item {
    background: #1a1a1a;
    padding: 6px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 24px;
}

.fundamentals-item:hover {
    background: #252525;
}

.fundamentals-label {
    color: #888;
    font-size: 11px;
    font-weight: 500;
}

.fundamentals-value {
    color: #e3e3e3;
    font-size: 11px;
    font-weight: 600;
    text-align: right;
}

.fundamentals-value.positive {
    color: #7CC3E4;
}

.fundamentals-value.negative {
    color: #FF6B6B;
}


.fundamentals-error {
    color: #f87171;
    text-align: center;
    padding: 20px;
    background: #1a1a1a;
    border-radius: 6px;
    border: 1px solid #2a2a2a;
}
