/* ═══════════════════════════════════════════════════════════
   RIRO Assets — Trading Dashboard Styles
   Light mode, clean & professional, pink accent #F849C1
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg-primary: #f8f9fb;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f3f4f6;
    --border: #e5e7eb;
    --border-light: #d1d5db;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --accent: #F849C1;
    --accent-hover: #e03aad;
    --accent-light: rgba(248, 73, 193, 0.08);
    --accent-medium: rgba(248, 73, 193, 0.15);
    --positive: #10b981;
    --positive-bg: rgba(16, 185, 129, 0.08);
    --negative: #ef4444;
    --negative-bg: rgba(239, 68, 68, 0.06);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.08);
    --sidebar-width: 220px;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
}

* {
    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);
    min-height: 100vh;
    display: flex;
}

/* ─── Sidebar ─────────────────────────────────────────── */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.logo-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 6px;
}

.login-logo-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 12px;
}

.logo {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--accent);
    line-height: 1;
}

.logo-sub {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.nav-links {
    list-style: none;
    padding: 12px 0;
    flex: 1;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.nav-links a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

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

.nav-links a.active {
    color: var(--accent);
    background: var(--accent-light);
    border-left-color: var(--accent);
}

.nav-links a.kill {
    color: var(--negative);
}

.nav-links a.kill:hover,
.nav-links a.kill.active {
    color: var(--negative);
    background: var(--negative-bg);
    border-left-color: var(--negative);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.logout-btn {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.logout-btn:hover {
    color: var(--text-primary);
}

/* ─── Main Content ────────────────────────────────────── */

.content {
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
    flex: 1;
    min-height: 100vh;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.header-stats {
    display: flex;
    gap: 12px;
    margin-left: auto;
    align-items: center;
}

.header-stat {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 5px 14px;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
}

/* ─── Date Range Picker ───────────────────────────────── */

.date-range-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.date-range-picker label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.date-range-picker input[type="date"] {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: var(--bg-card);
    cursor: pointer;
    transition: border-color 0.15s;
}

.date-range-picker input[type="date"]:focus {
    outline: none;
    border-color: var(--accent);
}

.date-range-picker .date-sep {
    color: var(--text-muted);
    font-size: 13px;
}

.month-picker select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: var(--bg-card);
    cursor: pointer;
}

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

/* ─── Badges ──────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-live {
    background: var(--accent-medium);
    color: var(--accent);
    animation: pulse-live 2s ease-in-out infinite;
}

.badge-long {
    background: var(--positive-bg);
    color: var(--positive);
}

.badge-short {
    background: var(--negative-bg);
    color: var(--negative);
}

.badge-flat {
    background: #f3f4f6;
    color: var(--text-secondary);
}

.badge-disabled {
    background: #f3f4f6;
    color: var(--text-muted);
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ─── Stat Cards ──────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    transition: box-shadow 0.15s;
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

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

.stat-value {
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.positive { color: var(--positive) !important; }
.negative { color: var(--negative) !important; }
.mono { font-variant-numeric: tabular-nums; }

/* ─── Sections ────────────────────────────────────────── */

.section {
    margin-bottom: 28px;
}

.section h2 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-primary);
}

/* ─── Charts Grid (two side-by-side) ──────────────────── */

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

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.chart-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.chart-card .chart-value {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    font-variant-numeric: tabular-nums;
}

.chart-wrapper {
    height: 200px;
    position: relative;
}

.chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ─── Tables ──────────────────────────────────────────── */

.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead {
    background: var(--bg-primary);
}

.data-table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    color: var(--text-primary);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ─── Empty State ─────────────────────────────────────── */

.empty-state {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* ─── Buttons ─────────────────────────────────────────── */

.btn {
    display: inline-block;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

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

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

.btn-warning {
    background: var(--warning-bg);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    background: rgba(245, 158, 11, 0.15);
}

.btn-sm {
    padding: 5px 14px;
    font-size: 12px;
}

.btn-full {
    width: 100%;
}

/* ─── Alerts ──────────────────────────────────────────── */

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.alert-time {
    color: var(--text-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    min-width: 100px;
}

.alert-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 60px;
    text-align: center;
}

.alert-info .alert-badge { background: var(--accent-light); color: var(--accent); }
.alert-warning .alert-badge { background: var(--warning-bg); color: #b45309; }
.alert-error .alert-badge { background: var(--negative-bg); color: var(--negative); }
.alert-critical .alert-badge { background: var(--negative-bg); color: var(--negative); }

.alert-msg {
    color: var(--text-secondary);
    flex: 1;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

.alert-error {
    background: var(--negative-bg);
    color: var(--negative);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: var(--positive-bg);
    color: var(--positive);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* ─── Filters ─────────────────────────────────────────── */

.filters-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-select,
.filter-input {
    padding: 7px 14px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
}

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

/* ─── Calendar — TradeZella-style ─────────────────────── */

.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

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

.cal-nav-left h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 200px;
}

.cal-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

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

.cal-nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cal-monthly-stat {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.cal-monthly-val {
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.cal-monthly-detail {
    font-size: 13px;
    color: var(--text-muted);
}

/* Calendar layout: grid + weekly sidebar */
.cal-layout {
    display: grid;
    grid-template-columns: 1fr 140px;
    gap: 16px;
    margin-bottom: 28px;
}

.cal-main {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.cal-grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
}

.cal-col-label {
    padding: 10px 0;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-primary);
}

.cal-grid-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.cal-day {
    min-height: 100px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cal-day:nth-child(7n) { border-right: none; }

.cal-day-empty {
    background: var(--bg-primary);
    opacity: 0.5;
}

.cal-day-positive {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.2) !important;
}

.cal-day-negative {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.18) !important;
}

.cal-day-neutral { background: var(--bg-card); }

.cal-day-num {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.cal-today {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff !important;
}

.cal-day-pnl {
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.cal-day-positive .cal-day-pnl { color: var(--positive); }
.cal-day-negative .cal-day-pnl { color: var(--negative); }

.cal-day-meta {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Weekly sidebar cards */
.cal-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-top: 37px; /* offset for the calendar column header height */
}

.cal-week-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    box-sizing: border-box;
}

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

.cal-week-pnl {
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-bottom: 2px;
}

.cal-week-days {
    font-size: 11px;
    color: var(--text-muted);
}

/* ─── Section Headings (pink accent) ─────────────────── */

.section-heading,
.section h2.section-heading {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--accent) !important;
    letter-spacing: -0.2px;
}

/* Calendar summary tables — fixed column widths for alignment */
.cal-summary-table {
    table-layout: fixed;
}

.cal-summary-table th:nth-child(1) { width: 28%; }
.cal-summary-table th:nth-child(2) { width: 16%; }
.cal-summary-table th:nth-child(3) { width: 14%; }
.cal-summary-table th:nth-child(4) { width: 14%; }
.cal-summary-table th:nth-child(5) { width: 14%; }
.cal-summary-table th:nth-child(6) { width: 14%; }

/* ─── Strategy Cards ──────────────────────────────────── */

.strategy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
}

.strategy-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s;
}

.strategy-card:hover {
    box-shadow: var(--shadow-md);
}

.strategy-card.disabled {
    opacity: 0.6;
}

.strategy-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.strategy-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.strategy-symbol {
    font-size: 13px;
    color: var(--text-muted);
}

.strategy-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}

.ss-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ss-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ss-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.strategy-params {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.8;
}

.param-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.strategy-actions {
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

/* ─── Kill Switch ─────────────────────────────────────── */

.killswitch-container {
    max-width: 700px;
}

.killswitch-warning {
    text-align: center;
    padding: 40px;
    margin-bottom: 32px;
    background: var(--negative-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius);
}

.killswitch-warning svg {
    color: var(--negative);
    margin-bottom: 16px;
}

.killswitch-warning h2 {
    color: var(--negative);
    margin-bottom: 12px;
}

.killswitch-warning p {
    color: var(--text-secondary);
    font-size: 14px;
}

.warning-detail {
    margin-top: 8px;
    color: var(--text-muted) !important;
    font-size: 13px !important;
}

.kill-button {
    width: 100%;
    padding: 18px;
    background: var(--negative);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
}

.kill-button:hover {
    background: #dc2626;
    transform: scale(1.01);
}

.kill-button:active {
    transform: scale(0.99);
}

.kill-button.activating {
    background: #b91c1c;
    cursor: wait;
}

.kill-button.completed {
    background: var(--positive);
    cursor: default;
}

.kill-button:disabled {
    opacity: 0.7;
}

.kill-result {
    margin-top: 20px;
}

/* ─── Login ───────────────────────────────────────────── */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-md);
}

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

.logo-large {
    font-size: 42px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -2px;
    line-height: 1;
}

.logo-sub-large {
    font-size: 16px;
    color: var(--text-secondary);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.login-subtitle {
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-group input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.15s;
}

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

/* ─── Responsive ──────────────────────────────────────── */

@media (max-width: 1100px) {
    .cal-layout {
        grid-template-columns: 1fr;
    }
    .cal-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .cal-week-card {
        flex: 1;
        min-width: 100px;
    }
}

@media (max-width: 900px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .sidebar-header, .logo-sub, .nav-links a span, .sidebar-footer {
        display: none;
    }

    .logo {
        font-size: 16px;
        text-align: center;
    }

    .sidebar-header {
        display: block;
        padding: 16px 8px;
    }

    .nav-links a {
        padding: 12px;
        justify-content: center;
    }

    .content {
        margin-left: 60px;
        padding: 20px;
    }

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

    .strategy-grid {
        grid-template-columns: 1fr;
    }

    .date-range-picker {
        flex-wrap: wrap;
    }
}
