/* V2.7 Premium Design System */
:root {
    --bg-dark: #0e1117;
    --card-bg-start: #1e293b;
    --card-bg-end: #0f172a;
    --border-light: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    /* Couleurs Sémantiques */
    --color-win: #22c55e;
    --color-loss: #ef4444;
    --color-wait: #64748b;
    --color-safe: #8b5cf6;
    --color-big: #ef4444;
    /* Le même que loss, correspond au style original */
    --color-crash: #00BFFF;
    --color-brand-1: #ec4899;
    --color-brand-2: #8b5cf6;
    --color-onnx-1: #00f2fe;
    --color-onnx-2: #4facfe;

    --font-sans: 'Inter', sans-serif;
    --font-mono: 'Courier Prime', monospace;

    /* Nouvelles Variables et Correctifs */
    --primary: #ea288e;
    --secondary: #ce28ea;
    --text: #ffffff;
    --text-dim: #737373;
    --border: rgba(255, 255, 255, 0.08);
    --card-bg: rgba(30, 41, 59, 0.45);
}

/* Modèles de Cartes Premium (Glassmorphism) */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
}

/* Dialog/Modal modern styling */
dialog.modal {
    border: none;
    background: transparent;
    padding: 0;
    margin: auto;
    overflow: visible;
    outline: none;
}

dialog.modal::backdrop {
    background: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
}

/* MAIN HEADER */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 10px;
    margin-bottom: 10px;
}

/* VUES MANAGEMENT */
main.dashboard {
    display: none;
}

main.dashboard.active {
    display: block;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.icon-wrap {
    font-size: 2rem;
    filter: drop-shadow(0 0 10px var(--primary));
}

.logo-text h1 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
}

.logo-text h1 .version {
    color: var(--text-dim);
    font-weight: 400;
    font-size: 0.9rem;
    margin-left: 5px;
}

.engine-badge {
    background: linear-gradient(90deg, #00BFFF, #00ffd0);
    color: #000;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
    text-transform: uppercase;
}

.engine-badge.elite {
    background: linear-gradient(90deg, #ea288e, #ce28ea);
    color: white;
    box-shadow: 0 0 10px rgba(234, 40, 142, 0.4);
}

.hud-card.protection {
    border: 3px solid #64748b !important;
    background: linear-gradient(135deg, #0f172a, #1e293b) !important;
    box-shadow: 0 0 20px rgba(100, 116, 139, 0.3) !important;
}

.protection .hud-recommendation {
    color: #94a3b8 !important;
    text-shadow: none !important;
}

/* --- ELITE COMPONENTS --- */
.hud-card.elite {
    border: 2px solid rgba(234, 40, 142, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 20px rgba(234, 40, 142, 0.1);
}

/* Heatmap Confidence */
.heatmap-container {
    width: 100%;
    margin: 15px 0;
    text-align: left;
}

.heatmap-label {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 1px;
    /* --- ULTIMATE HUD EXTENSIONS --- */
}

.probability-track {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin: 15px 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.heatmap-spectral {
    height: 100%;
    width: 0%;
    transition: width 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.5s ease;
    background: linear-gradient(90deg, #ff4b2b, #ff416c, #f9d423, #00f260, #05ffa1);
    background-size: 200% 100%;
}

.bankroll-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    gap: 15px;
}

.kelly-suggestion {
    text-align: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.kelly-suggestion .label {
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.kelly-suggestion h2 {
    color: #05ffa1;
    text-shadow: 0 0 10px rgba(5, 255, 161, 0.4);
    margin-top: 5px;
}

.session-goals {
    display: flex;
    justify-content: space-around;
    font-size: 0.8rem;
}

.goal {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.alert-banner {
    background: #ff4b2b;
    color: white;
    text-align: center;
    font-weight: 900;
    padding: 8px;
    border-radius: 4px;
    animation: blink 0.5s infinite alternate;
}

@keyframes blink {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0.7;
        transform: scale(0.98);
    }
}

.hidden {
    display: none;
}

.heatmap-glow {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 40px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: flow 2s linear infinite;
}

@keyframes flow {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(400%);
    }
}

/* Radar Pressure */
.radar-container {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px auto;
    position: relative;
}

.radar-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.radar-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 8;
}

.radar-progress {
    fill: none;
    stroke: var(--color-win);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 1s ease, stroke 1s ease;
}

.radar-text {
    fill: #ffffff;
    font-size: 20px;
    font-weight: 800;
    text-anchor: middle;
    dominant-baseline: central;
}

.radar-subtext {
    fill: var(--text-muted);
    font-size: 8.5px;
    font-weight: 800;
    text-anchor: middle;
    dominant-baseline: central;
    letter-spacing: 1.5px;
}

/* Animations StatBoxes */
.stat-box {
    transition: transform 0.2s ease;
}

.stat-box:hover {
    transform: translateY(-3px);
}

/* Pulse for Critical Signals */
.elite-pulse {
    animation: elitePulse 1.5s infinite;
}

@keyframes elitePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(234, 40, 142, 0.4);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(234, 40, 142, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(234, 40, 142, 0);
    }
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #00ffd0;
    background: rgba(0, 255, 208, 0.05);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(0, 255, 208, 0.1);
}

.status-indicator.stale {
    color: #ff4d4d;
    background: rgba(255, 77, 77, 0.05);
    border: 1px solid rgba(255, 77, 77, 0.2);
}

.pulse {
    width: 6px;
    height: 6px;
    background: #00ffd0;
    border-radius: 50%;
    box-shadow: 0 0 10px #00ffd0;
    animation: pulse 1.5s infinite;
}

.pulse.stale {
    background: #ff4d4d;
    box-shadow: 0 0 10px #ff4d4d;
}

/* SUB-NAV */
.sub-nav {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
    padding: 0 10px;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px 24px;
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text);
    transform: translateY(-1px);
}

.nav-btn.active {
    background: linear-gradient(135deg, rgba(234, 40, 142, 0.15), rgba(206, 40, 234, 0.15));
    border-color: var(--primary);
    color: white;
    box-shadow: 0 8px 20px rgba(234, 40, 142, 0.15);
}

.btn-icon {
    font-size: 1.1rem;
}

@keyframes pulse {
    0% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.4;
    }
}

/* GESTION DES VUES */
main.dashboard {
    display: none;
    flex-direction: column;
}

main.dashboard.active {
    display: flex;
}

/* HEADER */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 15px;
}

.header h1 {
    font-size: 24px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.version {
    font-size: 14px;
    color: var(--text-muted);
}

.engine-badge {
    background: linear-gradient(90deg, var(--color-onnx-1), var(--color-onnx-2));
    color: #000;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.status-live {
    color: var(--color-win);
    font-weight: 800;
    animation: pulse 2s infinite;
    font-size: 14px;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

/* --- SIMULATION SPECIFIC --- */
.sim-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.input-group input,
.input-group select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--primary);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: 8px;
    padding: 15px;
    color: white;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(234, 40, 142, 0.4);
}

.sim-results .stat-item {
    background: var(--card-bg);
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}

/* --- RESPONSIVE --- */
/* STATS BAR */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--card-bg-end);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 15px;
    gap: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

@media (max-width: 800px) {
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    font-family: var(--font-mono);
}

.stat-label-small {
    font-size: 11px;
    color: var(--text-muted);
}

.recent-series {
    font-size: 20px;
    letter-spacing: 2px;
}

/* HISTORY BAR */
.history-bar {
    width: 100%;
    overflow: hidden;
    padding: 5px 0;
}

.history-scroll {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 110px;
    overflow-y: auto;
    padding-bottom: 5px;
}

.history-scroll::-webkit-scrollbar {
    height: 6px;
}

.history-scroll::-webkit-scrollbar-thumb {
    background-color: var(--text-muted);
    border-radius: 10px;
}

.pill {
    padding: 4px 12px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 14px;
    min-width: 50px;
    text-align: center;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

/* MAIN DASHBOARD GRID */
.dashboard,
.hud-grid-wrap {
    display: grid;
    grid-template-columns: 1.2fr 1.5fr 1.2fr;
    gap: 20px;
}

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

.hud-card {
    background: linear-gradient(145deg, var(--card-bg-start), var(--card-bg-end));
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 25px 20px;
    text-align: center;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.monospace {
    font-family: var(--font-mono);
}

/* Left Card (Dernier Vol) */
.card-label {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 10px;
}

.card-value {
    font-size: 48px;
    font-weight: 900;
    margin: 10px 0;
}

.card-delta {
    font-size: 18px;
    font-family: var(--font-mono);
}

.time-ago {
    margin-top: 15px;
    font-size: 14px;
    font-weight: 600;
}

/* Center Card (HUD) */
.hud-hybrid {
    font-size: 12px;
    color: var(--text-light);
    letter-spacing: 1.5px;
    margin-bottom: 10px;
    font-weight: 700;
}

.hud-recommendation {
    font-size: 42px;
    font-weight: 900;
    line-height: 1.1;
    margin: 15px 0;
    text-transform: uppercase;
}

.hud-confidence {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--text-main);
}

.hud-confidence b {
    font-size: 22px;
}

.hud-mood {
    font-size: 13px;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 8px;
    display: inline-block;
    background: rgba(255, 255, 255, 0.03);
}

/* Right Card (Actions) */
.prob-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 14px;
    margin-bottom: 10px;
}

.prob-header b {
    font-size: 18px;
}

.progress-bar {
    width: 100%;
    background: #0f172a;
    height: 12px;
    border-radius: 6px;
    margin: 10px 0 25px 0;
    border: 1px solid #334155;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    transition: width 0.5s ease-in-out, background-color 0.5s ease;
}

.bet-btn {
    display: block;
    width: 100%;
    background: linear-gradient(90deg, var(--color-brand-1), var(--color-brand-2));
    color: white !important;
    font-weight: 800;
    font-size: 20px;
    text-align: center;
    padding: 16px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
    letter-spacing: 1px;
}

.bet-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(236, 72, 153, 0.6);
}

/* GRAPHIQUE CHART.JS */
.chart-container {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 15px;
    margin-top: 10px;
    height: 250px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* ADMIN FOOTER */
.admin-panel {
    margin-top: 40px;
    border-top: 1px solid var(--border-light);
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.admin-header h2 {
    font-size: 18px;
    margin: 0 0 10px 0;
}

.admin-stats {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: var(--text-light);
}

.btn {
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: background 0.2s;
}

.btn-reload {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-reload:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* TOAST */
.toast {
    position: fixed;
    bottom: -100px;
    right: 30px;
    background: #10b981;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
}

.toast.show {
    bottom: 30px;
    opacity: 1;
    pointer-events: auto;
}
