/* Intelligent Alert System Styling */

.intelligent-alerts-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header Styling */
.alerts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.header-title h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: normal;
}

.alert-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.form-control {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.auto-refresh-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
}

.auto-refresh-toggle input[type="checkbox"] {
    margin: 0;
}

/* Market Status */
.market-status {
    margin-bottom: 2rem;
}

.status-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 2rem;
    align-items: center;
}

.status-symbol {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.status-scenario {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    color: white;
}

.status-scenario.bull_momentum { background: var(--success-color); }
.status-scenario.bear_breakdown { background: var(--danger-color); }
.status-scenario.range_bound { background: #6b7280; }
.status-scenario.volatility_spike { background: #f59e0b; }
.status-scenario.earnings_setup { background: #8b5cf6; }

.status-metrics {
    display: flex;
    gap: 1.5rem;
}

.metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-weight: 600;
    font-size: 0.875rem;
}

.metric-value.bullish { color: var(--success-color); }
.metric-value.bearish { color: var(--danger-color); }
.metric-value.neutral { color: var(--text-secondary); }

.status-loading, .status-error {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

.status-error {
    color: var(--danger-color);
}

/* Alerts Section */
.alerts-section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.alert-count {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.no-alerts {
    padding: 3rem;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    background: var(--card-bg);
    border-radius: 8px;
    border: 2px dashed var(--border-color);
}

/* Alert Cards */
.alert-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border-left: 4px solid;
    transition: all 0.3s ease;
}

.alert-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.alert-card.priority-high { border-left-color: var(--danger-color); }
.alert-card.priority-medium { border-left-color: var(--primary-color); }
.alert-card.priority-low { border-left-color: var(--text-secondary); }

.alert-header {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.alert-symbol {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.alert-scenario {
    font-weight: 600;
    color: var(--text-primary);
}

.alert-confidence {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.alert-confidence.confidence-high {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.alert-confidence.confidence-medium {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary-color);
}

.alert-confidence.confidence-low {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

.alert-time {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.alert-content {
    margin-bottom: 1.5rem;
}

.market-context {
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.key-levels {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.level {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.level.support {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.level.resistance {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

.level.stop {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary-color);
}

.alert-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.alert-actions button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-view-scenario {
    background: var(--primary-color);
    color: white;
}

.btn-view-playbook {
    background: var(--success-color);
    color: white;
}

.btn-acknowledge {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-dismiss {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.alert-actions button:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

/* Scenario Analysis */
.scenario-section, .playbook-section {
    margin-bottom: 2rem;
}

.scenario-section h4, .playbook-section h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.scenario-card, .playbook-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.scenario-header, .strategy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.scenario-header h5, .strategy-header h5 {
    margin: 0;
    color: var(--text-primary);
}

.scenario-probability, .ai-confidence {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.probability-value {
    color: var(--primary-color);
    font-weight: 600;
}

.scenario-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.scenario-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.detail-section h6 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.triggers-list {
    margin: 0;
    padding-left: 1rem;
    color: var(--text-secondary);
}

.triggers-list li {
    margin-bottom: 0.25rem;
}

@media (max-width: 900px) {
    .alerts-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .alert-controls {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .alert-controls .form-control,
    .alert-controls button {
        width: 100%;
    }

    .status-card {
        grid-template-columns: 1fr;
        gap: 1rem;
        text-align: left;
    }

    .status-metrics {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
}

@media (max-width: 600px) {
    .alert-header {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .alert-actions {
        flex-direction: column;
    }

    .alert-actions button {
        width: 100%;
    }

    .key-levels {
        flex-direction: column;
        align-items: flex-start;
    }

    .scenario-details {
        grid-template-columns: 1fr;
    }
}

.catalysts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.catalyst-tag {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Trading Playbook */
.trading-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.trading-section {
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem;
    border-radius: 6px;
}

.trading-section h6 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.trading-section ul {
    margin: 0;
    padding-left: 1rem;
    color: var(--text-secondary);
}

.trading-section li {
    margin-bottom: 0.25rem;
}

.risk-management {
    background: rgba(239, 68, 68, 0.1);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.risk-assessment {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

.risk-item {
    display: flex;
    gap: 0.5rem;
}

.risk-label {
    color: var(--text-secondary);
}

.risk-value {
    font-weight: 600;
}

.risk-value.moderate { color: var(--primary-color); }
.risk-value.elevated { color: #f59e0b; }
.risk-value.high { color: var(--danger-color); }

.ai-insights {
    background: rgba(59, 130, 246, 0.1);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.ai-insight-text {
    color: var(--text-primary);
    font-style: italic;
    margin: 0;
}

.risk-mitigation {
    background: rgba(16, 185, 129, 0.1);
    padding: 1rem;
    border-radius: 6px;
}

.mitigation-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.mitigation-tag {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .alerts-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .alert-controls {
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .status-card {
        grid-template-columns: 1fr;
        gap: 1rem;
        text-align: center;
    }

    .status-metrics {
        justify-content: center;
    }

    .alert-header {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        text-align: center;
    }

    .key-levels {
        justify-content: center;
    }

    .alert-actions {
        justify-content: center;
    }

    .scenario-details {
        grid-template-columns: 1fr;
    }

    .trading-grid {
        grid-template-columns: 1fr;
    }

    .risk-assessment {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .intelligent-alerts-container {
        padding: 0.5rem;
    }

    .alerts-header {
        padding: 1rem;
    }

    .alert-card {
        padding: 1rem;
    }

    .alert-actions button {
        flex: 1;
        text-align: center;
    }
}

/* =============================================================================
   SIGNALS TABLE STYLES
   ============================================================================= */

.signals-table-section {
    margin-top: 1.5rem;
}

.signals-table-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.table-container {
    background: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 12px;
    overflow: hidden;
}

.signals-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.signals-table thead {
    background: linear-gradient(135deg, #262626 0%, #1a1a1a 100%);
    border-bottom: 1px solid #404040;
}

.signals-table th {
    padding: 1rem 0.75rem;
    color: #a3a3a3;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.75rem;
}

.signals-table th.text-right {
    text-align: right;
}

.signals-table tbody tr {
    border-bottom: 1px solid #2a2a2a;
    transition: background 0.2s ease;
}

.signals-table tbody tr:hover {
    background: #262626;
}

.signals-table td {
    padding: 1rem 0.75rem;
    vertical-align: top;
}

.signals-table td.text-right {
    text-align: right;
}

/* Symbol Cell */
.symbol-cell {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.symbol-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
}

.symbol-badge.bullish {
    background: #10b981;
    color: white;
}

.symbol-badge.bearish {
    background: #ef4444;
    color: white;
}

.confidence-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.confidence-badge.high {
    background: #10b981;
    color: white;
}

.confidence-badge.medium {
    background: #f59e0b;
    color: white;
}

.confidence-badge.low {
    background: #6b7280;
    color: white;
}

/* Setup Cell */
.setup-cell {
    max-width: 300px;
}

.setup-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setup-text {
    color: #f5f5f5;
    line-height: 1.4;
}

.alerts-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.alert-badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    background: #f59e0b;
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Score Cell */
.score-cell {
    font-weight: 600;
}

.score-cell.score-high {
    color: #10b981;
}

.score-cell.score-medium {
    color: #f59e0b;
}

.score-cell.score-low {
    color: #ef4444;
}

/* Price Cell */
.price-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.price-value {
    color: #f5f5f5;
    font-weight: 500;
    font-family: 'Monaco', 'Consolas', monospace;
}

.timestamp {
    color: #a3a3a3;
    font-size: 0.75rem;
}

/* Volume Cell */
.volume-cell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.volume-value {
    color: #f5f5f5;
    font-weight: 500;
}

.volume-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.volume-indicator.volume-high {
    background: #10b981;
}

.volume-indicator.volume-medium {
    background: #f59e0b;
}

.volume-indicator.volume-low {
    background: #6b7280;
}

/* IV Rank */
.iv-rank {
    color: #f5f5f5;
    font-weight: 500;
}

/* Risk/Target Cell */
.risk-target {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stop-loss {
    color: #ef4444;
    font-size: 0.75rem;
    font-weight: 500;
}

.take-profit {
    color: #10b981;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-action {
    padding: 0.375rem 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-action.btn-primary {
    background: #0ea5e9;
    color: white;
}

.btn-action.btn-primary:hover {
    background: #0284c7;
}

.btn-action.btn-secondary {
    background: transparent;
    color: #a3a3a3;
    border: 1px solid #525252;
}

.btn-action.btn-secondary:hover {
    background: #525252;
    color: #f5f5f5;
}

/* LLM Alert Fallback Styling */
.llm-alert-fallback {
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.fallback-header {
    text-align: center;
    margin-bottom: 2rem;
}

.fallback-header h3 {
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
}

.fallback-header p {
    color: var(--text-secondary);
    margin: 0;
}

.fallback-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.loading-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    background: rgba(14, 165, 233, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(14, 165, 233, 0.3);
    border-top: 2px solid #0ea5e9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-message p {
    color: #0ea5e9;
    margin: 0;
    font-weight: 500;
}

.fallback-table h4 {
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
}

.simple-signals-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--table-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.simple-signals-table th,
.simple-signals-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.simple-signals-table th {
    background: var(--header-bg);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.simple-signals-table td {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.simple-signals-table tbody tr:hover {
    background: var(--row-hover);
}

.simple-signals-table tbody tr:last-child td {
    border-bottom: none;
}

.symbol-tag {
    background: #0ea5e9;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
}

.score.high {
    color: #10b981;
    font-weight: 600;
}

.score.medium {
    color: #f59e0b;
    font-weight: 600;
}

.btn-simple {
    padding: 0.375rem 0.75rem;
    background: #0ea5e9;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-simple:hover {
    background: #0284c7;
}