/**
 * Forecaster Integration Styles
 * Стили для виджетов прогнозов акций
 */

:root {
    --color-success: #10b981;
    --color-danger: #ef4444;
    --color-primary: #2563eb;
    --color-warning: #f59e0b;
    --color-neutral: #6b7280;
    --color-bg: #ffffff;
    --color-bg-light: #f9fafb;
    --color-bg-dark: #0f172a;
    --color-text: #1f2937;
    --color-text-light: #6b7280;
    --color-border: #e5e7eb;
    --border-radius: 12px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Общие стили */
.forecast-widget,
.indicators-widget,
.news-widget {
    margin: 24px 0;
}

/* Загрузка */
.forecast-loading,
.indicators-loading,
.news-loading,
.fundamental-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-light);
}

.loading-spinner {
    border: 3px solid var(--color-border);
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ошибки */
.forecast-error,
.indicators-error,
.news-error {
    padding: 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--border-radius);
    color: var(--color-danger);
    text-align: center;
}

.retry-button {
    margin-top: 12px;
    padding: 8px 16px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.retry-button:hover {
    background: #1d4ed8;
}

/* Заголовок прогноза */
.forecast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--color-border);
}

.ticker-name {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.current-price {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.price-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-primary);
    font-family: 'Courier New', monospace;
}

.price-currency {
    font-size: 20px;
    color: var(--color-text-light);
    margin-left: 4px;
}

.price-change {
    font-size: 16px;
    font-weight: 600;
    margin-left: 12px;
    padding: 4px 8px;
    border-radius: 4px;
}

.price-change.positive {
    color: var(--color-success);
    background: #d1fae5;
}

.price-change.negative {
    color: var(--color-danger);
    background: #fee2e2;
}

/* График */
.forecast-chart-container {
    position: relative;
    width: 100%;
    height: 400px;
    margin: 24px 0;
    padding: 20px;
    background: var(--color-bg-light);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.forecast-chart-container canvas {
    max-height: 100% !important;
    max-width: 100% !important;
}

.chart-error {
    padding: 20px;
    text-align: center;
    color: var(--color-danger);
    background: #fef2f2;
    border-radius: var(--border-radius);
}

@media (max-width: 768px) {
    .forecast-chart-container {
        height: 300px;
        padding: 12px;
    }
}

/* Таблица прогнозов */
.forecast-table-container {
    margin: 24px 0;
}

.forecast-table-container h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--color-text);
}

.forecast-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.forecast-table thead {
    background: var(--color-bg-dark);
    color: white;
}

.forecast-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.forecast-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
}

.forecast-table tbody tr:hover {
    background: var(--color-bg-light);
}

.forecast-table tbody tr:last-child td {
    border-bottom: none;
}

.forecast-row.direction-up {
    border-left: 3px solid var(--color-success);
}

.forecast-row.direction-down {
    border-left: 3px solid var(--color-danger);
}

.forecast-row.direction-sideways {
    border-left: 3px solid var(--color-neutral);
}

.forecast-table .point {
    font-weight: 600;
    color: var(--color-text);
}

.forecast-table .price {
    font-weight: 600;
    font-family: 'Courier New', monospace;
    color: var(--color-text);
}

.forecast-table .confidence {
    min-width: 120px;
}

.confidence-bar {
    position: relative;
    width: 100%;
    height: 24px;
    background: var(--color-border);
    border-radius: 12px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-success));
    transition: width 0.3s ease;
}

.confidence-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text);
    z-index: 1;
}

.forecast-table .direction {
    display: flex;
    align-items: center;
    gap: 8px;
}

.direction-icon {
    font-size: 20px;
    font-weight: bold;
}

.direction-text {
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
}

.direction-up .direction-icon,
.direction-up .direction-text {
    color: var(--color-success);
}

.direction-down .direction-icon,
.direction-down .direction-text {
    color: var(--color-danger);
}

.direction-sideways .direction-icon,
.direction-sideways .direction-text {
    color: var(--color-neutral);
}

.forecast-table .reasoning {
    color: var(--color-text-light);
    font-size: 13px;
    line-height: 1.5;
}

/* Сводка прогноза */
.forecast-summary {
    margin-top: 24px;
    padding: 20px;
    background: var(--color-bg-light);
    border-radius: var(--border-radius);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-item .label {
    font-size: 12px;
    color: var(--color-text-light);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.summary-item .value {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
}

.summary-item .value.direction-up {
    color: var(--color-success);
}

.summary-item .value.direction-down {
    color: var(--color-danger);
}

.summary-item .value.direction-sideways {
    color: var(--color-neutral);
}

.summary-reasoning {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.summary-reasoning h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-text);
}

.summary-reasoning p {
    color: var(--color-text-light);
    line-height: 1.6;
    margin: 0;
}

/* Индикаторы */
.indicators-widget-content h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--color-text);
}

.indicators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.indicator-card {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.indicator-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.indicator-label {
    font-size: 12px;
    color: var(--color-text-light);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.indicator-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    font-family: 'Courier New', monospace;
    margin-bottom: 8px;
}

.indicator-signal {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.indicator-card.signal-overbought .indicator-signal {
    background: #fee2e2;
    color: var(--color-danger);
}

.indicator-card.signal-oversold .indicator-signal {
    background: #d1fae5;
    color: var(--color-success);
}

.indicator-card.signal-bullish .indicator-signal {
    background: #d1fae5;
    color: var(--color-success);
}

.indicator-card.signal-bearish .indicator-signal {
    background: #fee2e2;
    color: var(--color-danger);
}

.indicator-card.signal-neutral .indicator-signal {
    background: #f3f4f6;
    color: var(--color-neutral);
}

/* Новости */
.news-widget-content h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--color-text);
}

.news-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.news-item {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}

.news-item:hover {
    box-shadow: var(--shadow-lg);
}

.news-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}

.news-snippet {
    font-size: 14px;
    color: var(--color-text-light);
    line-height: 1.6;
    margin-bottom: 12px;
}

.news-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--color-text-light);
}

.news-summary {
    background: var(--color-bg-light);
    padding: 16px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    line-height: 1.6;
    color: var(--color-text);
}

/* Страница акции */
.stock-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.stock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--color-border);
}

.stock-ticker {
    font-size: 36px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

/* Табы */
.stock-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--color-border);
}

.tab-button {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-light);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.tab-button:hover {
    color: var(--color-primary);
}

.tab-button.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.tab-content {
    margin-top: 24px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s;
}

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

/* Адаптивность */
@media (max-width: 768px) {
    .forecast-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .ticker-name {
        font-size: 24px;
    }
    
    .price-value {
        font-size: 28px;
    }
    
    .forecast-table {
        font-size: 12px;
    }
    
    .forecast-table th,
    .forecast-table td {
        padding: 8px 12px;
    }
    
    .forecast-table .reasoning {
        display: none;
    }
    
    .indicators-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .stock-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stock-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-button {
        white-space: nowrap;
        padding: 10px 16px;
        font-size: 14px;
    }
}

