/* ============================================================
   Analyzer Page Styles — OPR Trading Dashboard
   ============================================================ */

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: #1a2235;
    --bg-card-hover: #1e293b;
    --border: rgba(99, 102, 241, 0.2);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #f59e0b;
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Nav */
.nav {
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.875rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav .container {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: var(--accent-light);
    background: rgba(99, 102, 241, 0.12);
}

/* Sections */
.section {
    margin: 2rem 0;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.section-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

/* Import Card */
.import-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-group label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group input,
.form-group select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 0.625rem 0.875rem;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
    width: 100%;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s;
    background: rgba(99, 102, 241, 0.02);
}

.drop-zone:hover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.06);
}

.drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.005);
}

.drop-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.drop-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.drop-sub {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* File Preview */
.file-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
}

.file-icon {
    font-size: 1.125rem;
}

.file-name {
    flex: 1;
    font-weight: 500;
    font-size: 0.9rem;
}

.file-rows {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.btn-clear-file {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 0.25rem;
    transition: color 0.2s;
}

.btn-clear-file:hover {
    color: var(--red);
}

/* Import Actions */
.import-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.import-status {
    font-size: 0.875rem;
}

.import-status.success {
    color: var(--green);
}

.import-status.error {
    color: var(--red);
}

/* Buttons */
.btn {
    border: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: white;
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-light);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-large {
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Sessions List */
.sessions-list {
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.loading-state {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
    font-size: 0.9rem;
}

.session-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

.session-card:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.session-card.active-session {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.08);
}

.session-info {
    flex: 1;
    min-width: 0;
}

.session-name {
    font-weight: 600;
    font-size: 0.9375rem;
}

.session-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.session-stats {
    display: flex;
    gap: 1.5rem;
}

.session-stat {
    text-align: center;
}

.session-stat-val {
    font-size: 1.1rem;
    font-weight: 700;
}

.session-stat-val.green {
    color: var(--green);
}

.session-stat-val.red {
    color: var(--red);
}

.session-stat-lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.session-actions {
    display: flex;
    gap: 0.5rem;
}

/* Analysis Section */
.analysis-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1) 0%, transparent 100%);
}

.analysis-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.analysis-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    min-height: 500px;
}

/* Filters Panel */
.filters-panel {
    border-right: 1px solid var(--border-subtle);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background: rgba(0, 0, 0, 0.15);
}

.filters-panel h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.filter-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.days-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.day-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 0.375rem 0.25rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    gap: 0.25rem;
    min-width: 52px;
    flex: 1 1 52px;
}

.day-chip:hover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.day-chip input {
    accent-color: var(--accent);
}

.weekend-chip {
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.06);
}

.weekend-chip:hover {
    border-color: var(--yellow);
    background: rgba(245, 158, 11, 0.12);
}

.weekend-chip input {
    accent-color: var(--yellow);
}

.form-row-compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* Results Panel */
.results-panel {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow: hidden;
}

/* Stats comparison */
.stats-comparison {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: start;
}

.stats-col {}

.stats-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.stat-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.75rem;
}

.stat-item-val {
    font-size: 1.25rem;
    font-weight: 700;
}

.stat-item-val.green {
    color: var(--green);
}

.stat-item-val.red {
    color: var(--red);
}

.stat-item-val.neutral {
    color: var(--text-primary);
}

.stat-item-lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.stats-divider {
    font-size: 1.5rem;
    color: var(--accent);
    align-self: center;
    padding: 0 0.5rem;
    margin-top: 2rem;
}

/* Excluded Badge */
.excluded-badge {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--yellow);
    text-align: center;
}

/* Trades Table */
.trades-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.trades-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.trades-header h4 {
    font-size: 0.9375rem;
    font-weight: 600;
}

.trades-table-container {
    overflow-x: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    max-height: 400px;
    overflow-y: auto;
}

.trades-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.trades-table th {
    padding: 0.625rem 0.875rem;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.75rem;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 1px solid var(--border-subtle);
}

.trades-table td {
    padding: 0.5rem 0.875rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.trades-table tr:last-child td {
    border-bottom: none;
}

.trades-table tr:hover td {
    background: rgba(255, 255, 255, 0.025);
}

.trades-table tr.win td {
    border-left: 3px solid var(--green);
}

.trades-table tr.loss td {
    border-left: 3px solid var(--red);
}

.profit-pos {
    color: var(--green);
    font-weight: 600;
}

.profit-neg {
    color: var(--red);
    font-weight: 600;
}

.badge-long {
    background: rgba(34, 197, 94, 0.12);
    color: var(--green);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-short {
    background: rgba(239, 68, 68, 0.12);
    color: var(--red);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ============================================================
   News Filter UI
   ============================================================ */

.news-impact-grid {
    display: flex;
    gap: 0.375rem;
}

.impact-chip {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    border: 1px solid;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    flex: 1;
    justify-content: center;
}

.impact-high {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.07);
    color: var(--red);
}

.impact-medium {
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.07);
    color: var(--yellow);
}

.impact-low {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.07);
    color: var(--accent-light);
}

.impact-chip input {
    accent-color: currentColor;
}

.news-window-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.news-window-row input {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 0.3rem 0.5rem;
    font-family: 'Inter', sans-serif;
    text-align: center;
}

.news-status {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.2rem 0;
}

.news-status.loaded {
    color: var(--green);
}

.news-status.error {
    color: var(--red);
}

/* News marker on trade rows */
.news-marker {
    display: inline-block;
    font-size: 0.7rem;
    margin-left: 0.3rem;
    cursor: help;
    vertical-align: middle;
}