/* ============================================================================
   CRYPTO STRATEGY BACKTESTING AGENT - STYLES
   Dark glassmorphism theme with cyan/purple accents
   ============================================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #0f0f1a;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --bg-input: rgba(255, 255, 255, 0.06);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(0, 212, 255, 0.2);
    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #00d4ff;
    --accent-dim: rgba(0, 212, 255, 0.15);
    --secondary: #7b2dff;
    --secondary-dim: rgba(123, 45, 255, 0.15);
    --success: #00ff88;
    --success-dim: rgba(0, 255, 136, 0.15);
    --danger: #ff4757;
    --danger-dim: rgba(255, 71, 87, 0.15);
    --warning: #ffa502;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.4);
    --transition: 0.2s ease;
    --sidebar-width: 280px;
    --chat-width: 360px;
    --topbar-height: 56px;
}

/* Light mode */
[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #e8eaed;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --bg-input: rgba(0, 0, 0, 0.04);
    --border-glass: rgba(0, 0, 0, 0.1);
    --border-glow: rgba(0, 150, 200, 0.3);
    --text-primary: #18181b;
    --text-secondary: #52525b;
    --text-muted: #a1a1aa;
    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.1);
}

html { font-size: 14px; scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

/* Grid background pattern */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}
[data-theme="light"] body::before {
    background-image:
        linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px);
}

/* ---------- Glass Card ---------- */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    box-shadow: var(--shadow-glass);
}

.glass:hover { background: var(--bg-card-hover); }

/* ---------- Layout ---------- */
.app-container {
    display: flex;
    height: 100vh;
    position: relative;
    z-index: 1;
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-glass);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    transition: transform var(--transition);
    flex-shrink: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.92rem;
    width: 100%;
    text-align: left;
}

.nav-item:hover { background: var(--accent-dim); color: var(--text-primary); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-divider { height: 1px; background: var(--border-glass); margin: 8px 12px; }

/* Strategy library section */
.strategy-library {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.strategy-library-header {
    padding: 4px 12px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.strategy-search {
    margin: 0 8px 8px;
}

.strategy-search input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition);
}

.strategy-search input:focus { border-color: var(--accent); }

.strategy-list { display: flex; flex-direction: column; gap: 2px; }

.strategy-item {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.strategy-item:hover { background: var(--bg-card-hover); }
.strategy-item.active { background: var(--accent-dim); border-left: 2px solid var(--accent); }

.strategy-item-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.strategy-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
}

.strategy-tag {
    display: inline-block;
    padding: 2px 6px;
    background: var(--secondary-dim);
    color: var(--secondary);
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 500;
}

/* ---------- Main Content ---------- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Top Bar */
.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-glass);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
}

.hamburger svg { width: 24px; height: 24px; }

.equity-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    background: var(--success-dim);
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--success);
}

.active-strategy-name {
    font-size: 0.92rem;
    color: var(--text-secondary);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    transition: all var(--transition);
}

.topbar-btn:hover { border-color: var(--accent); color: var(--accent); }
.topbar-btn svg { width: 16px; height: 16px; }

.theme-toggle {
    background: none;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 7px 10px;
    display: flex;
    align-items: center;
    transition: all var(--transition);
}

.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }

/* Tabs */
.tab-bar {
    display: flex;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-glass);
    background: var(--bg-card);
    flex-shrink: 0;
    overflow-x: auto;
}

.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

/* Tab Content */
.tab-content-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Strategy Editor Panel ---------- */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-section {
    padding: 20px;
    margin-bottom: 0;
}

.form-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a1a1aa' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

/* Indicator Checkboxes */
.indicator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.indicator-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-glass);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.82rem;
}

.indicator-chip:hover { border-color: var(--accent); }
.indicator-chip.selected {
    border-color: var(--accent);
    background: var(--accent-dim);
    color: var(--accent);
}

.indicator-chip input { display: none; }

/* Indicator config panels */
.indicator-config {
    display: none;
    margin-top: 12px;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
}

.indicator-config.active { display: block; }

.indicator-config-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 10px;
}

/* ---------- Strategy Presets ---------- */
.presets-section {
    margin-bottom: 16px;
}

.presets-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
    margin-bottom: 12px;
}

.presets-header .form-section-title {
    margin-bottom: 0;
}

.preset-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.preset-card {
    padding: 16px;
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid var(--border-glass);
    position: relative;
    overflow: hidden;
}

.preset-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--secondary));
    opacity: 0;
    transition: opacity var(--transition);
}

.preset-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.15);
}

.preset-card:hover::before {
    opacity: 1;
}

.preset-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}

.preset-card-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
}

.preset-card-wr {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--success);
    background: var(--success-dim);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.preset-card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.preset-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.preset-card-tf {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 2px 8px;
    border-radius: 4px;
}

.preset-tag {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--secondary);
    background: var(--secondary-dim);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Natural language input */
.nl-input-area {
    padding: 20px;
    margin-bottom: 16px;
}

.nl-textarea {
    width: 100%;
    min-height: 60px;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    resize: vertical;
    transition: border-color var(--transition);
}

.nl-textarea:focus { border-color: var(--accent); }

.nl-textarea::placeholder { color: var(--text-muted); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #0099cc);
    color: #000;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.btn-primary:hover { box-shadow: 0 0 30px rgba(0, 212, 255, 0.5); transform: translateY(-1px); }

.btn-secondary {
    background: var(--secondary-dim);
    color: var(--secondary);
    border: 1px solid rgba(123, 45, 255, 0.3);
}

.btn-secondary:hover { background: rgba(123, 45, 255, 0.25); }

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
}

.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
    background: var(--danger-dim);
    color: var(--danger);
    border: 1px solid rgba(255, 71, 87, 0.3);
}

.btn-danger:hover { background: rgba(255, 71, 87, 0.25); }

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

.btn-full { width: 100%; }

.btn-group { display: flex; gap: 8px; margin-top: 16px; }

/* ---------- Pine Script Panel ---------- */
.pine-editor-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--topbar-height) - 44px - 40px);
}

.pine-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    gap: 8px;
    flex-shrink: 0;
}

.pine-toolbar-left { display: flex; gap: 8px; }
.pine-toolbar-right { display: flex; gap: 8px; }

.pine-editor-wrapper {
    flex: 1;
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-glass);
    background: #0d1117;
}

.pine-editor {
    width: 100%;
    height: 100%;
    padding: 16px;
    padding-left: 60px;
    background: #0d1117;
    color: #c9d1d9;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    border: none;
    outline: none;
    resize: none;
    tab-size: 4;
    white-space: pre;
    overflow: auto;
}

.line-numbers {
    position: absolute;
    top: 0;
    left: 0;
    width: 50px;
    height: 100%;
    padding: 16px 8px;
    background: #0a0e14;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    text-align: right;
    pointer-events: none;
    overflow: hidden;
    border-right: 1px solid var(--border-glass);
    user-select: none;
}

/* ---------- Statistics Panel ---------- */
.stats-input-section {
    padding: 20px;
    margin-bottom: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    padding: 16px;
    text-align: center;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-card-value.positive { color: var(--success); }
.stat-card-value.negative { color: var(--danger); }
.stat-card-value.neutral { color: var(--accent); }

.stat-card-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.chart-card {
    padding: 16px;
}

.chart-card.full-width { grid-column: 1 / -1; }

.chart-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.chart-container {
    position: relative;
    height: 250px;
}

/* Monthly breakdown table */
.stats-table-wrapper { overflow-x: auto; }

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.stats-table th,
.stats-table td {
    padding: 10px 14px;
    text-align: right;
    border-bottom: 1px solid var(--border-glass);
}

.stats-table th {
    text-align: right;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.stats-table th:first-child,
.stats-table td:first-child { text-align: left; }

/* Heatmap */
.heatmap-container { overflow-x: auto; }

.heatmap-table {
    border-collapse: collapse;
    font-size: 0.72rem;
}

.heatmap-table td {
    width: 36px;
    height: 28px;
    text-align: center;
    border: 1px solid var(--bg-primary);
    border-radius: 2px;
    color: var(--text-primary);
    font-weight: 500;
}

.heatmap-table th {
    padding: 4px 6px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.7rem;
}

/* ---------- Risk Calculator Panel ---------- */
.risk-calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.risk-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.risk-result-card {
    padding: 14px;
    text-align: center;
}

.risk-result-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 2px;
}

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

/* ---------- Chat Panel ---------- */
.chat-panel {
    width: var(--chat-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-glass);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    transition: transform var(--transition), width var(--transition);
    flex-shrink: 0;
}

.chat-panel.collapsed {
    width: 0;
    overflow: hidden;
    border-left: none;
}

.chat-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-header-title {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header-title .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.chat-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg {
    max-width: 90%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    line-height: 1.5;
}

.chat-msg.user {
    align-self: flex-end;
    background: var(--accent-dim);
    color: var(--accent);
    border-bottom-right-radius: 4px;
}

.chat-msg.assistant {
    align-self: flex-start;
    background: var(--bg-input);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-msg pre {
    margin-top: 8px;
    padding: 10px;
    background: #0d1117;
    border-radius: var(--radius-xs);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.5;
}

.chat-msg code {
    font-family: var(--font-mono);
    font-size: 0.82em;
    background: rgba(0,0,0,0.2);
    padding: 2px 4px;
    border-radius: 3px;
}

.chat-msg .apply-code-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 10px;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 0.75rem;
    font-family: inherit;
}

.chat-msg .apply-code-btn:hover { background: rgba(0, 212, 255, 0.25); }

.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border-glass);
    flex-shrink: 0;
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: border-color var(--transition);
}

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

.chat-send-btn {
    padding: 10px 14px;
    background: linear-gradient(135deg, var(--accent), #0099cc);
    border: none;
    border-radius: var(--radius-sm);
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all var(--transition);
}

.chat-send-btn:hover { box-shadow: 0 0 15px rgba(0, 212, 255, 0.4); }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-send-btn svg { width: 18px; height: 18px; }

.chat-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 10px 14px;
}

.chat-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* ---------- Toast Notifications ---------- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    max-width: 400px;
}

.toast.success { background: var(--success-dim); color: var(--success); border: 1px solid rgba(0, 255, 136, 0.3); }
.toast.error { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(255, 71, 87, 0.3); }
.toast.info { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(0, 212, 255, 0.3); }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ---------- Skeleton Loading ---------- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-card-hover) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-xs);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }
.skeleton-block { height: 200px; }

/* ---------- Tooltips ---------- */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: #1a1a2e;
    color: var(--text-primary);
    font-size: 0.75rem;
    border-radius: var(--radius-xs);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
    z-index: 1000;
    border: 1px solid var(--border-glass);
}

[data-tooltip]:hover::after { opacity: 1; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-glass); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---------- Mobile Overlay ---------- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .chat-panel { width: 300px; }
    .editor-grid { grid-template-columns: 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    .risk-calc-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        z-index: 200;
    }

    .sidebar.open { transform: translateX(0); }

    .sidebar-overlay.active { display: block; }

    .hamburger { display: flex; }

    .chat-panel {
        position: fixed;
        right: 0;
        top: 0;
        width: 100%;
        max-width: 360px;
        z-index: 200;
        transform: translateX(100%);
    }

    .chat-panel.open { transform: translateX(0); }
    .chat-panel.collapsed { transform: translateX(100%); }

    .topbar-right .active-strategy-name { display: none; }
    .equity-display { font-size: 0.82rem; padding: 4px 10px; }
    .editor-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .risk-calc-grid { grid-template-columns: 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    .preset-cards { grid-template-columns: 1fr; }
    .tab-content-area { padding: 12px; }
}

/* ---------- Misc Utilities ---------- */
.hidden { display: none !important; }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.font-mono { font-family: var(--font-mono); }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
