/**
 * v31.0: Statistical Analysis Panel 樣式
 * 使用 brand-system.css 設計變數，自動適配暗色主題
 */

/* Container */
.sa-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 0;
}

/* Progress */
.sa-progress {
    padding: 8px 12px;
}

.sa-progress-bar {
    height: 4px;
    background: var(--border-secondary, #2a2a2a);
    border-radius: 2px;
    overflow: hidden;
}

.sa-progress-fill {
    height: 100%;
    background: var(--accent, #6366f1);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.sa-progress-text {
    font-size: var(--text-xs, 11px);
    color: var(--text-tertiary, #666);
    margin-top: 4px;
}

/* Results wrapper */
.sa-results {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sa-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Stock card */
.sa-stock-card,
.sa-seasonality-card {
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-primary, #333);
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
}

.sa-stock-header {
    padding: 10px 14px;
    font-weight: 600;
    font-size: var(--text-sm, 13px);
    color: var(--text-primary, #e0e0e0);
    background: var(--bg-tertiary, #222);
    border-bottom: 1px solid var(--border-primary, #333);
}

/* Table */
.sa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-xs, 11px);
}

.sa-table th {
    padding: 6px 10px;
    text-align: left;
    font-weight: 500;
    color: var(--text-tertiary, #888);
    background: var(--bg-tertiary, #222);
    border-bottom: 1px solid var(--border-primary, #333);
    white-space: nowrap;
}

.sa-table td {
    padding: 6px 10px;
    color: var(--text-secondary, #ccc);
    border-bottom: 1px solid var(--border-secondary, #2a2a2a);
}

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

/* Positive/Negative colors with intensity */
.sa-positive .sa-return-cell,
.sa-positive.sa-heat-cell {
    color: var(--green, #22c55e);
}

.sa-negative .sa-return-cell,
.sa-negative.sa-heat-cell {
    color: var(--red, #ef4444);
}

.sa-positive {
    background: rgba(34, 197, 94, calc(var(--intensity, 0) * 0.15));
}

.sa-negative {
    background: rgba(239, 68, 68, calc(var(--intensity, 0) * 0.15));
}

/* Heatmap cells */
.sa-heatmap td.sa-heat-cell {
    text-align: center;
    font-weight: 500;
    font-size: 10px;
    padding: 4px 6px;
    min-width: 52px;
}

.sa-code-cell {
    font-weight: 600;
    color: var(--text-primary, #e0e0e0) !important;
    white-space: nowrap;
}

/* Stock footer stats */
.sa-stock-footer {
    display: flex;
    justify-content: space-between;
    padding: 8px 14px;
    font-size: var(--text-xs, 11px);
    color: var(--text-tertiary, #888);
    background: var(--bg-tertiary, #222);
    border-top: 1px solid var(--border-primary, #333);
}

/* Analysis card */
.sa-analysis-card {
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-primary, #333);
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
}

.sa-analysis-header {
    padding: 10px 14px;
    font-weight: 600;
    font-size: var(--text-sm, 13px);
    color: var(--text-primary, #e0e0e0);
    background: var(--bg-tertiary, #222);
    border-bottom: 1px solid var(--border-primary, #333);
}

.sa-analysis-content {
    padding: 12px 14px;
    font-size: var(--text-sm, 13px);
    line-height: 1.6;
    color: var(--text-secondary, #ccc);
}

.sa-analysis-content p {
    margin: 0 0 8px;
}

.sa-analysis-content p:last-child {
    margin-bottom: 0;
}

/* Typing cursor */
.sa-typing-cursor {
    display: inline-block;
    width: 2px;
    height: 14px;
    background: var(--accent, #6366f1);
    animation: sa-blink 0.8s step-end infinite;
    vertical-align: text-bottom;
    margin-left: 2px;
}

@keyframes sa-blink {
    50% { opacity: 0; }
}

/* Error */
.sa-error {
    padding: 12px 14px;
    color: var(--red, #ef4444);
    font-size: var(--text-sm, 13px);
    background: rgba(239, 68, 68, 0.08);
    border-radius: var(--radius-lg, 12px);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .sa-heatmap {
        font-size: 9px;
    }
    .sa-heatmap td.sa-heat-cell {
        min-width: 40px;
        padding: 3px 4px;
    }
}
