:root {
    --primary: #0F172A;
    --secondary: #1E293B;
    --accent: #3B82F6;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --text: #E2E8F0;
    --muted: #94A3B8;
    --card-bg: rgba(30, 41, 59, 0.7);
    --border: rgba(148, 163, 184, 0.1);
}

html {
    -webkit-locale: "fr";
    color-scheme: dark;
}

*,
::before,
::after {
    box-sizing: border-box;
}

body {
    background: var(--primary);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.dashboard-card {
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dashboard-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

.status-badge {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-badge.running {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge.stopped {
    background: rgba(148, 163, 184, 0.1);
    color: var(--muted);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.chart-container {
    height: 400px;
    width: 100%;
}

.analytics-container {
    height: 300px;
}

.sentiment-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 3px;
}

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

.loading-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.table-row-hover:hover {
    background: rgba(59, 130, 246, 0.05);
}

.orders-table-wrap {
    overflow-x: hidden;
}

.orders-table {
    table-layout: fixed;
}

.orders-col-time {
    width: 4.25rem;
}

.orders-col-market {
    width: 6.5rem;
}

.orders-col-details {
    width: 7.25rem;
}

.orders-col-status {
    width: 5rem;
}

.orders-table th,
.orders-table td {
    vertical-align: top;
}

.orders-time span,
.orders-market span,
.orders-details span {
    display: block;
}

.orders-time {
    color: var(--muted);
    font-size: 0.6875rem;
    line-height: 1.2;
}

.orders-market strong {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: #E2E8F0;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.orders-market span,
.orders-details .orders-price {
    color: var(--muted);
    font-size: 0.6875rem;
}

.orders-details {
    overflow-wrap: anywhere;
}

.orders-side {
    margin-bottom: 0.15rem;
    font-size: 0.6875rem;
    font-weight: 800;
    text-transform: uppercase;
}

.orders-quantity {
    color: #E2E8F0;
    font-weight: 700;
    line-height: 1.25;
}

.orders-status .status-chip {
    max-width: 100%;
    overflow: hidden;
    justify-content: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.control-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(100, 116, 139, 0.65);
    border-radius: 0.5rem;
    color: var(--text);
    padding: 0.6rem 0.75rem;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input.control-input,
select.control-input {
    background-color: rgba(15, 23, 42, 0.9) !important;
    color: var(--text) !important;
    color-scheme: dark;
}

input.control-input::placeholder {
    color: rgba(148, 163, 184, 0.72);
}

.control-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.control-button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.35rem;
    padding: 0.55rem 0.8rem;
    border: 1px solid rgba(59, 130, 246, 0.28);
    border-radius: 0.5rem;
    background: rgba(59, 130, 246, 0.12);
    color: #BFDBFE;
    font-weight: 700;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.control-button:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.22);
    border-color: rgba(59, 130, 246, 0.55);
    color: #FFFFFF;
}

.control-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.empty-state {
    border: 1px solid rgba(100, 116, 139, 0.28);
    border-radius: 0.5rem;
    background: rgba(15, 23, 42, 0.35);
    color: var(--muted);
    font-size: 0.8125rem;
    padding: 0.85rem;
    text-align: center;
}

.metric-pill,
.status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.55);
    color: #CBD5E1;
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1;
    padding: 0.35rem 0.55rem;
    white-space: nowrap;
}

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

.status-chip.buy,
.status-chip.strong {
    border-color: rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.1);
    color: #6EE7B7;
}

.status-chip.sell {
    border-color: rgba(244, 63, 94, 0.2);
    background: rgba(244, 63, 94, 0.1);
    color: #FDA4AF;
}

.status-chip.neutral {
    border-color: rgba(148, 163, 184, 0.2);
    background: rgba(100, 116, 139, 0.1);
    color: #CBD5E1;
}

.status-chip.weak {
    border-color: rgba(245, 158, 11, 0.2);
    background: rgba(245, 158, 11, 0.1);
    color: #FCD34D;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.decision-explain {
    border: 1px solid rgba(100, 116, 139, 0.28);
    border-radius: 0.5rem;
    background: rgba(15, 23, 42, 0.42);
    padding: 0.85rem 0.95rem;
}

.decision-explain.positive {
    border-color: rgba(16, 185, 129, 0.28);
    background: rgba(16, 185, 129, 0.08);
}

.decision-explain.negative {
    border-color: rgba(244, 63, 94, 0.3);
    background: rgba(244, 63, 94, 0.08);
}

.decision-explain.warning {
    border-color: rgba(245, 158, 11, 0.34);
    background: rgba(245, 158, 11, 0.08);
}

.decision-explain strong {
    color: #F8FAFC;
    display: block;
    font-size: 0.875rem;
    font-weight: 800;
}

.decision-explain p {
    color: #CBD5E1;
    font-size: 0.8125rem;
    line-height: 1.45;
    margin-top: 0.35rem;
}

.metric-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border: 1px solid rgba(100, 116, 139, 0.22);
    border-radius: 0.5rem;
    background: rgba(15, 23, 42, 0.35);
    padding: 0.7rem 0.8rem;
    min-height: 2.65rem;
}

.metric-row span {
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
}

.metric-row strong {
    font-size: 0.8125rem;
    text-align: right;
    overflow-wrap: anywhere;
}

.insight-card,
.indicator-block,
.event-item {
    border: 1px solid rgba(100, 116, 139, 0.22);
    border-radius: 0.5rem;
    background: rgba(15, 23, 42, 0.36);
}

.insight-card {
    display: flex;
    min-height: 5rem;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.9rem;
}

.insight-card span {
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 800;
    text-transform: uppercase;
}

.insight-card strong {
    color: #F8FAFC;
    font-size: 1rem;
    font-weight: 800;
}

.indicator-block,
.event-item {
    padding: 0.85rem;
}

@media (max-width: 640px) {
    .metric-grid {
        grid-template-columns: 1fr;
    }

    .metric-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.3rem;
    }

    .metric-row strong {
        text-align: left;
    }
}
