/* Titan Trader UI — Light surfaces, blue accents, green/amber/red per spec */

:root {
    /* Surface colors — light theme */
    --surface-bg: #fafafa;
    --surface-elevated: #ffffff;
    --surface-border: #e5e5e5;

    /* Text colors */
    --text-primary: #1a1a1a;
    --text-secondary: #737373;
    --text-muted: #a3a3a3;

    /* Accent: Blue for instrument names and active nav */
    --accent-blue: #2563eb;
    --accent-blue-hover: #1d4ed8;
    --accent-blue-light: #dbeafe;

    /* Verdict colors */
    --verdict-buy: #16a34a;      /* Green */
    --verdict-buy-light: #dcfce7;
    --verdict-sell: #dc2626;     /* Red - stop-loss/risk only */
    --verdict-sell-light: #fee2e2;

    /* Metric colors */
    --metric-confidence: #d97706; /* Amber for confidence */
    --metric-confidence-light: #fef3c7;
    --metric-target: #16a34a;     /* Green for targets */
    --metric-target-light: #dcfce7;
    --metric-stoploss: #dc2626;   /* Red for stop-loss/risk */
    --metric-stoploss-light: #fee2e2;

    /* Layout */
    --header-height: 60px;
    --sidebar-width: 20%;
    --report-panel-width: 30%;
    --chat-width: 50%;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica', 'Arial', sans-serif;
    background: var(--surface-bg);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header: 10% height */
.header {
    height: var(--header-height);
    background: var(--surface-elevated);
    border-bottom: 1px solid var(--surface-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.brand-mark {
    width: 40px;
    height: 40px;
    background: var(--text-primary);
    color: var(--surface-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    border-radius: 4px;
    /* PLACEHOLDER: Replace with real logo */
}

.brand-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.user-name {
    font-size: 14px;
    color: var(--text-secondary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-blue-light);
    border: 2px solid var(--accent-blue);
}

/* Main container: remaining 90% */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Sidebar: 20% */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface-elevated);
    border-right: 1px solid var(--surface-border);
    overflow-y: auto;
    padding: var(--space-lg) 0;
}

.sidebar-section {
    margin-bottom: var(--space-xl);
}

.section-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 var(--space-lg);
    margin-bottom: var(--space-sm);
}

.nav-section {
    margin-bottom: var(--space-xl);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
    background: var(--surface-bg);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-blue-light);
    color: var(--accent-blue);
    font-weight: 500;
}

.nav-icon {
    font-size: 18px;
}

.item-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: 0 var(--space-lg);
}

.decision-item {
    padding: var(--space-sm);
    background: var(--surface-bg);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.decision-item:hover {
    background: var(--accent-blue-light);
}

.decision-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xs);
}

.decision-number {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.decision-date {
    font-size: 11px;
    color: var(--text-muted);
}

.decision-instrument {
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-blue);
}

.signal-item {
    padding: var(--space-sm);
    background: var(--surface-bg);
    border-radius: 4px;
    font-size: 13px;
}

.signal-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.signal-text {
    color: var(--text-primary);
}

.announcement-item {
    padding: var(--space-sm) var(--space-lg);
    font-size: 13px;
}

.announcement-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.announcement-text {
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Center Chat: 50% */
.chat-container {
    width: var(--chat-width);
    display: flex;
    flex-direction: column;
    background: var(--surface-bg);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.message-user {
    align-self: flex-end;
}

.message-user .message-content {
    background: #f3f4f6;
    border-radius: 12px 12px 0 12px;
    padding: var(--space-md);
}

.message-brain {
    align-self: flex-start;
}

.message-brain .message-content {
    background: var(--surface-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 12px 12px 12px 0;
    padding: var(--space-md);
    font-family: Georgia, 'Times New Roman', serif;
    line-height: 1.6;
}

.instrument-name {
    font-weight: 600;
    color: var(--accent-blue);
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: var(--space-xs);
    padding: 0 var(--space-xs);
}

.chat-input-container {
    padding: var(--space-lg);
    background: var(--surface-elevated);
    border-top: 1px solid var(--surface-border);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.file-upload-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-sm);
    background: var(--surface-bg);
    border: 1px dashed var(--surface-border);
    border-radius: 6px;
}

.uploaded-files {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.uploaded-file-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 4px var(--space-sm);
    background: var(--accent-blue-light);
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-primary);
}

.remove-files-button {
    align-self: flex-end;
    padding: 4px var(--space-sm);
    font-size: 11px;
    background: var(--surface-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-muted);
}

.remove-files-button:hover {
    background: var(--error-red);
    color: white;
    border-color: var(--error-red);
}

.input-actions {
    display: flex;
    gap: var(--space-md);
    align-items: flex-end;
}

.file-upload-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.15s;
}

.file-upload-button:hover {
    background: var(--accent-blue-light);
    border-color: var(--accent-blue);
}

.chat-input {
    flex: 1;
    min-height: 50px;
    padding: var(--space-md);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
}

.chat-input:focus {
    border-color: var(--accent-blue);
}

.send-button {
    padding: 0 var(--space-lg);
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.send-button:hover {
    background: var(--accent-blue-hover);
}

/* Right Report Panel: 30% */
.report-panel {
    width: var(--report-panel-width);
    background: var(--surface-elevated);
    border-left: 1px solid var(--surface-border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

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

.panel-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.decision-selector {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--surface-border);
    border-radius: 4px;
    font-size: 13px;
    background: var(--surface-bg);
    cursor: pointer;
}

.decision-report {
    padding: var(--space-lg);
}

.report-card {
    background: var(--surface-bg);
    border-radius: 8px;
    overflow: hidden;
}

.verdict-bar {
    height: 4px;
}

.verdict-bar.buy {
    background: var(--verdict-buy);
}

.verdict-bar.sell {
    background: var(--verdict-sell);
}

.verdict-bar.hold {
    background: var(--text-muted);
}

.report-header {
    padding: var(--space-lg);
}

.report-instrument {
    font-size: 24px;
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: var(--space-xs);
}

.report-verdict {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
}

.report-verdict.buy {
    background: var(--verdict-buy-light);
    color: var(--verdict-buy);
}

.report-verdict.sell {
    background: var(--verdict-sell-light);
    color: var(--verdict-sell);
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    padding: var(--space-lg);
}

.metric-tile {
    padding: var(--space-md);
    border-radius: 6px;
    border: 1px solid var(--surface-border);
}

.metric-tile.confidence {
    background: var(--metric-confidence-light);
    border-color: var(--metric-confidence);
}

.metric-tile.target {
    background: var(--metric-target-light);
    border-color: var(--metric-target);
}

.metric-tile.stoploss {
    background: var(--metric-stoploss-light);
    border-color: var(--metric-stoploss);
}

.metric-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

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

.evidence-section {
    padding: var(--space-lg);
    border-top: 1px solid var(--surface-border);
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.evidence-item {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.evidence-icon {
    width: 32px;
    height: 32px;
    background: var(--surface-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.evidence-content {
    flex: 1;
}

.evidence-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.evidence-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.compliance-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--surface-border);
    background: var(--surface-bg);
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}
