/* METIS Frontend - Sublime Text Inspired Dark Theme */

:root {
    --bg-primary: #1e1e1e;
    --bg-secondary: #252526;
    --bg-tertiary: #2d2d30;
    --bg-hover: #3e3e42;

    --text-primary: #d4d4d4;
    --text-secondary: #9cdcfe;
    --text-muted: #808080;

    --accent: #ff9800;
    --accent-hover: #f57c00;
    --accent-glow: rgba(255, 152, 0, 0.3);

    --danger: #f44336;
    --danger-hover: #d32f2f;

    --border: #3c3c3c;
    --border-light: #4e4e4e;

    --radius: 6px;
    --radius-sm: 4px;

    --shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);
}

/* Header Metrics Bar */
.metrics-bar {
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.metric-card {
    display: flex;
    flex-direction: column;
    padding: 10px 15px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    min-width: 100px;
    flex-shrink: 0;
}

.metric-card.primary {
    background: linear-gradient(135deg, var(--accent) 0%, #059669 100%);
    border-color: transparent;
}

.metric-card.primary .metric-label {
    color: rgba(255, 255, 255, 0.8);
}

.metric-card.primary .metric-value {
    color: white;
}

.metric-card .metric-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.metric-card .metric-value {
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.pnl-positive {
    color: #10b981 !important;
}

.pnl-negative {
    color: #ef4444 !important;
}

.pnl-neutral {
    color: var(--text-secondary) !important;
}

/* Risk of Ruin colors */
.ror-safe {
    color: #10b981 !important;
}

.ror-low {
    color: #22c55e !important;
}

.ror-medium {
    color: #f59e0b !important;
}

.ror-high {
    color: #f97316 !important;
}

.ror-critical {
    color: #ef4444 !important;
    font-weight: bold;
}

.ror-card {
    border-color: var(--border);
}

.ror-card.warning {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.ror-card.danger {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.risk-normal {
    color: #10b981 !important;
}

.risk-caution {
    color: #f59e0b !important;
}

.risk-elevated {
    color: #f97316 !important;
}

.risk-high {
    color: #ef4444 !important;
}

.risk-halted {
    color: #ef4444 !important;
    font-weight: bold;
}

/* Live Status Indicator */
.live-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.status-indicator .pulse {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.status-indicator.sentinel .pulse {
    background: #8b5cf6;
}

.status-indicator.sentinel {
    color: #8b5cf6;
}

.status-indicator.offline .pulse {
    background: #ef4444;
    animation: none;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.uptime {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Quick Stats Panel */
.quick-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.quick-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quick-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.quick-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

.quick-value.timer {
    color: var(--accent);
}

.quick-value.timer.stale {
    color: #f59e0b;
}

/* Toggle Switch */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
}

.toggle {
    position: relative;
    width: 42px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-hover);
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked+.toggle-slider {
    background: #8b5cf6;
}

.toggle input:checked+.toggle-slider:before {
    transform: translateX(18px);
}

.btn-full {
    width: 100%;
    margin-bottom: 8px;
}

.input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
}

.caption {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    font-weight: 500;
}

.section-header:hover {
    color: var(--accent);
}

.chevron {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.section-content {
    padding: 10px 0;
}

.section-content.collapsed {
    display: none;
}

.btn-row {
    display: flex;
    gap: 10px;
}

.btn-row .btn {
    flex: 1;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    font-size: 0.9rem;
}

.toggle-label {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle-label input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 22px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-label input:checked+.toggle-slider {
    background-color: var(--accent);
    border-color: var(--accent);
}

.toggle-label input:checked+.toggle-slider:before {
    transform: translateX(18px);
    background-color: white;
}

.status-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.quick-stats {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
}

.stat-item {
    background: var(--bg-tertiary);
    padding: 15px 25px;
    border-radius: var(--radius);
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1rem;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
}

.modal-small {
    max-width: 400px;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 4px;
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.tab-btn {
    padding: 10px 18px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--bg-tertiary);
    color: var(--accent);
    border-color: var(--accent);
}

/* Tab Content */
.tab-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.tab-content.hidden {
    display: none;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.tab-header h2 {
    font-size: 1.3rem;
    margin: 0;
}

.tab-header .subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Main Content Layout */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Journal */
.journal-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
}

.journal-viewer {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 15px;
}

.journal-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
    color: var(--text-secondary);
}

.journal-input {
    display: flex;
    gap: 10px;
}

.journal-input textarea {
    flex: 1;
}

/* Simulation */
.sim-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    padding: 20px;
    flex: 1;
    overflow: hidden;
}

.sim-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.btn-large {
    padding: 15px 25px;
    font-size: 1rem;
    margin-top: 10px;
}

.sim-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chart-container {
    flex: 1;
    min-height: 200px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chart-placeholder {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.sim-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

/* Ledger */
.ledger-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 20px;
}

.stat-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.stat-card.large {
    grid-column: span 2;
}

.stat-card .stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 600;
}

.table-container {
    flex: 1;
    overflow: auto;
    padding: 0 20px 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.data-table .no-data {
    text-align: center;
    color: var(--text-muted);
    padding: 30px;
}

/* Reports */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    padding: 20px;
}

.reports-lists {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 0 20px 20px;
}

.list-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 20px;
}

.list-card h3 {
    margin: 0 0 15px 0;
    font-size: 1rem;
}

.list-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.list-card li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.list-card li:last-child {
    border-bottom: none;
}

/* Analytics */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
    flex: 1;
}

.analytics-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 20px;
}

.analytics-card h3 {
    margin: 0 0 15px 0;
    font-size: 1rem;
}

.metrics-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.metric-row span:first-child {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.metric-row span:last-child {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

/* Utility Classes */
.text-green {
    color: #10b981;
}

.text-red {
    color: #ef4444;
}

.pnl-positive {
    color: #10b981;
}

.pnl-negative {
    color: #ef4444;
}

.loading {
    color: var(--text-muted);
}

.error {
    color: var(--danger);
}

.no-data {
    color: var(--text-muted);
    font-style: italic;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 20px;
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.tagline {
    color: var(--text-muted);
    margin-top: 8px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.error-message {
    color: var(--danger);
    font-size: 0.85rem;
    margin-bottom: 15px;
    min-height: 20px;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent), #059669);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.login-footer {
    text-align: center;
    margin-top: 30px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.hidden {
    display: none !important;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.25rem;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}

.role-badge {
    font-size: 0.75rem;
    background: var(--accent);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
}

.delete-btn {
    background: var(--danger);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.add-user-form {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.add-user-form h3 {
    margin-bottom: 15px;
    font-size: 1rem;
}

.add-user-form input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent), #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.version {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
}

.sidebar-section {
    margin-bottom: 20px;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

.label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* Select */
.select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.select:hover {
    border-color: var(--border-light);
}

.select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Slider */
.slider {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    -webkit-appearance: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-value {
    display: block;
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-family: 'JetBrains Mono', monospace;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.stats-display {
    margin-top: 10px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--accent);
    display: none;
}

.stats-display.visible {
    display: block;
}

/* Status */
.sidebar-footer {
    margin-top: auto;
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: pulse 2s infinite;
}

.status.connected .status-dot {
    background: var(--accent);
}

.status-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

/* Messages */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.welcome-message h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

/* Message Bubbles */
.message {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: var(--radius);
    line-height: 1.6;
    animation: fadeIn 0.3s ease;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent), #059669);
    color: white;
}

.message.assistant {
    align-self: flex-start;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
}

/* Chat Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-style: italic;
    animation: pulse-soft 1.5s ease-in-out infinite;
}

.status-indicator.generating {
    color: var(--accent);
}

.status-indicator .dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes pulse-soft {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

@keyframes dots {
    0% {
        content: '';
    }

    25% {
        content: '.';
    }

    50% {
        content: '..';
    }

    75% {
        content: '...';
    }

    100% {
        content: '';
    }
}

.text-muted {
    color: var(--text-secondary);
    font-style: italic;
}

.message.assistant pre {
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 10px 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.message.assistant code {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Input Area */
.input-container {
    padding: 20px 30px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 14px 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    max-height: 200px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent), #059669);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.send-btn:active {
    transform: scale(0.95);
}

.send-btn svg {
    width: 20px;
    height: 20px;
    color: white;
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Predictions Tab */
.predictions-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.model-selector {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: var(--radius);
}

.model-selector .select {
    width: 100%;
    margin-top: 8px;
}

.asset-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.asset-row .control-group {
    flex: 1;
    min-width: 120px;
}

.explanation-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.explanation-card h3 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: var(--accent);
}

.explanation-content {
    font-size: 0.9rem;
    line-height: 1.6;
}

.explanation-content p {
    margin: 10px 0;
}

.explanation-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.explanation-content li {
    margin: 5px 0;
}

.accuracy-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.accuracy-badge.low {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.accuracy-badge.medium {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.accuracy-badge.high {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.prediction-results {
    background: var(--bg-tertiary);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 20px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.results-header h3 {
    margin: 0;
    color: var(--accent);
}

.results-header .timestamp {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.result-card {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.result-card.primary {
    background: linear-gradient(135deg, var(--accent) 0%, #059669 100%);
}

.result-card.primary .result-label,
.result-card.primary .result-value {
    color: white;
}

.result-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.result-value {
    font-size: 1.3rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.text-green {
    color: #10b981 !important;
}

.text-red {
    color: #ef4444 !important;
}

.confidence-bands {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.confidence-bands h4 {
    margin: 0 0 15px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.bands-grid {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.band {
    flex: 1;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    text-align: center;
}

.band.highlight {
    background: rgba(255, 152, 0, 0.2);
    border: 1px solid var(--accent);
}

.band-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.band-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.band.highlight .band-value {
    color: var(--accent);
    font-weight: 600;
}

.forecast-chart {
    width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        padding: 10px;
    }

    .sidebar-header,
    .sidebar-section,
    .sidebar-footer {
        display: none;
    }

    .messages {
        padding: 20px;
    }

    .input-container {
        padding: 15px;
    }

    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bands-grid {
        flex-wrap: wrap;
    }
}