/* Time Series Analysis — Lab-style, scoped to #tsContainer */

#tsContainer {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px;
    background-color: #0a0a0a;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    border-radius: 8px;
    border: 1px solid #333;
    box-sizing: border-box;
}

#tsContainer *,
#tsContainer *::before,
#tsContainer *::after {
    box-sizing: border-box;
}

/* === Chart wrappers === */
#tsContainer .chart-wrap {
    position: relative;
    height: 340px;
    width: 100%;
    background: #111;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #333;
    overflow: hidden;
}

#tsContainer .chart-wrap-short {
    position: relative;
    height: 140px;
    width: 100%;
    background: #111;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
    border: 1px solid #333;
    overflow: hidden;
}

#tsContainer .chart-title {
    font-size: 12px;
    font-weight: bold;
    color: #ccc;
    margin-bottom: 6px;
}

/* === Legend === */
#tsContainer .legend-row {
    display: flex;
    gap: 14px;
    margin-bottom: 8px;
    font-size: 11px;
    flex-wrap: wrap;
}

#tsContainer .legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 5px;
    vertical-align: middle;
}

#tsContainer .legend-dot.hist { background: #60a5fa; }
#tsContainer .legend-dot.fitted { background: #fbbf24; }
#tsContainer .legend-dot.forecast { background: #f87171; }
#tsContainer .legend-dot.level { background: #10b981; }
#tsContainer .legend-dot.trend { background: #f59e0b; }
#tsContainer .legend-dot.season { background: #a855f7; }
#tsContainer .legend-dot.ci { background: rgba(248, 113, 113, 0.25); }

/* === Control panel === */
#tsContainer .control-panel {
    background: #1a1a1a;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid #333;
}

#tsContainer .control-panel-title {
    font-size: 11px;
    font-weight: bold;
    color: #808080;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

#tsContainer .control-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

#tsContainer .control-row:last-child {
    margin-bottom: 0;
}

#tsContainer .control-row label {
    min-width: 130px;
    font-size: 12px;
    color: #b0b0b0;
    white-space: nowrap;
}

#tsContainer .control-row input[type="range"] {
    flex: 1;
    min-width: 100px;
    height: 6px;
    background: #2a2a2a;
    border-radius: 3px;
    accent-color: #3b82f6;
}

#tsContainer .control-row .value-display {
    min-width: 36px;
    text-align: right;
    font-size: 12px;
    color: #3b82f6;
}

/* === Buttons === */
#tsContainer .btn-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

#tsContainer .btn-action {
    padding: 7px 14px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: #374151;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

#tsContainer .btn-action:hover {
    background: #4b5563;
}

#tsContainer .btn-primary {
    padding: 7px 14px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
}

#tsContainer .btn-primary:hover {
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

/* === Summary === */
#tsContainer .summary-panel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

#tsContainer .stat-card {
    background: #111;
    border-left: 4px solid #3b82f6;
    padding: 8px 10px;
    border-radius: 4px;
}

#tsContainer .stat-card .stat-label {
    font-size: 10px;
    color: #808080;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

#tsContainer .stat-card .stat-value {
    font-size: 15px;
    font-weight: bold;
    color: #93c5fd;
    margin-top: 2px;
}

/* === Equation panel === */
#tsContainer .eq-panel {
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 10px;
    font-size: 12px;
    line-height: 1.6;
    color: #ccc;
}

#tsContainer .eq-panel .eq-title {
    font-weight: bold;
    color: #e0e0e0;
    margin-bottom: 4px;
}

#tsContainer .eq-panel .eq-line {
    color: #bbb;
    margin-bottom: 2px;
}

#tsContainer .eq-panel .val {
    color: #ffdd00;
}

/* === Insight === */
#tsContainer .insight-box {
    margin-top: 10px;
    padding: 10px 12px;
    background: #1a1a2e;
    border-radius: 6px;
    border: 1px solid #333;
    font-size: 12px;
    line-height: 1.5;
    color: #c0c0c0;
}

#tsContainer .insight-box strong {
    color: #93c5fd;
}

/* === Step buttons === */
#tsContainer .btn-step {
    padding: 7px 14px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: #1e3a5f;
    color: #93c5fd;
    border: 1px solid #3b82f6;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

#tsContainer .btn-step:hover:not(:disabled) {
    background: #2563eb;
    color: #fff;
}

#tsContainer .btn-step:disabled {
    opacity: 0.35;
    cursor: default;
}

#tsContainer .btn-step-run {
    padding: 7px 14px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: #065f46;
    color: #6ee7b7;
    border: 1px solid #10b981;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

#tsContainer .btn-step-run:hover {
    background: #059669;
    color: #fff;
}

#tsContainer .btn-step-reset {
    padding: 7px 14px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: #374151;
    color: #d1d5db;
    border: 1px solid #555;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

#tsContainer .btn-step-reset:hover {
    background: #4b5563;
}

/* === Step info box === */
#tsContainer .step-info-box {
    margin-top: 10px;
    padding: 10px 14px;
    background: #0f172a;
    border: 1px solid #1e3a5f;
    border-left: 4px solid #3b82f6;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.7;
    color: #ccc;
    max-height: 320px;
    overflow-y: auto;
}

#tsContainer .step-info-box .val {
    color: #fbbf24;
    font-weight: bold;
}

#tsContainer .step-info-box b {
    color: #93c5fd;
}

/* === Custom scrollbars === */
#tsContainer ::-webkit-scrollbar { width: 6px; height: 6px; }
#tsContainer ::-webkit-scrollbar-track { background: transparent; }
#tsContainer ::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
#tsContainer ::-webkit-scrollbar-thumb:hover { background: #555; }
#tsContainer * { scrollbar-width: thin; scrollbar-color: #333 transparent; }
