/* Material Design Theme + Dark Mode */
:root {
    --link-hover: #8a6a2c;
    --mdc-theme-primary: #17274b;
    --mdc-theme-secondary: #b08944;
    --mdc-theme-background: #ffffff;
    --mdc-theme-surface: #ffffff;
    --mdc-theme-error: #b00020;
    --mdc-theme-text-primary: rgba(0, 0, 0, 0.87);
    --mdc-theme-text-secondary: rgba(0, 0, 0, 0.6);
    --mdc-theme-divider: rgba(0, 0, 0, 0.12);
    --mdc-theme-snackbar: #323232;
    --mdc-theme-on-primary: #ffffff;
    --mdc-theme-on-surface: rgba(0, 0, 0, 0.87);
    --mdc-elevation-transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    --mdc-elevation-umbra: 0px 2px 1px -1px rgba(0,0,0,0.2), 0px 1px 1px 0px rgba(0,0,0,0.14), 0px 1px 3px 0px rgba(0,0,0,0.12);
    --mdc-elevation-penumbra: 0px 3px 4px 0px rgba(0,0,0,0.2), 0px 1px 8px 0px rgba(0,0,0,0.12);
    --mdc-elevation-ambient: 0px 1px 5px 0px rgba(0,0,0,0.12);
    --mdc-elevation-overlay: 0px 4px 5px 0px rgba(0,0,0,0.14), 0px 1px 10px 0px rgba(0,0,0,0.12);
    --mdc-elevation: 0 2px 4px -1px rgba(0,0,0,0.2), 0 4px 5px 0 rgba(0,0,0,0.14), 0 1px 10px 0 rgba(0,0,0,0.12);
}

/* Dark Mode */
[data-theme="dark"] {
    --link-hover: #e3c47f;
    --mdc-theme-primary: #c9a25a;
    --mdc-theme-on-primary: #16271c;
    --mdc-theme-background: #121212;
    --mdc-theme-surface: #1e1e1e;
    --mdc-theme-text-primary: #ffffff;
    --mdc-theme-text-secondary: rgba(255, 255, 255, 0.7);
    --mdc-theme-divider: rgba(255, 255, 255, 0.12);
    --mdc-theme-snackbar: #323232;
    --mdc-elevation-umbra: 0px 2px 1px -1px rgba(0,0,0,0.4), 0px 1px 1px 0px rgba(0,0,0,0.24), 0px 1px 3px 0px rgba(0,0,0,0.22);
    --mdc-elevation-penumbra: 0px 3px 4px 0px rgba(0,0,0,0.4), 0px 1px 8px 0px rgba(0,0,0,0.22);
    --mdc-elevation-ambient: 0px 1px 5px 0px rgba(0,0,0,0.22);
    --mdc-elevation: 0 2px 4px -1px rgba(0,0,0,0.4), 0 4px 5px 0 rgba(0,0,0,0.24), 0 1px 10px 0 rgba(0,0,0,0.22);
}

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

html {
    /* Place de la barre de défilement toujours réservée : pages courtes et longues alignées au pixel près */
    scrollbar-gutter: stable;
    font-family: 'Roboto', 'Noto Sans', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color-scheme: light dark;
}

body {
    background-color: var(--mdc-theme-background);
    color: var(--mdc-theme-text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    line-height: 1.5;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }

p {
    color: var(--mdc-theme-text-secondary);
    margin-bottom: 1rem;
}

a {
    color: var(--mdc-theme-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Cards */
.card {
    background-color: var(--mdc-theme-surface);
    border-radius: 8px;
    box-shadow: var(--mdc-elevation);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: none;
    transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Survol : ombre un peu plus marquée, la carte ne bouge pas */
.card:hover {
    box-shadow: var(--mdc-elevation-overlay);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--mdc-theme-text-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.4rem 1rem;
    border: none;
    border-radius: 4px;
    font-family: 'Roboto', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn .material-icons {
    font-size: 1.15rem;
}

.btn-sm {
    padding: 0.25rem 0.65rem;
    font-size: 0.8rem;
}

.btn-primary {
    background-color: var(--mdc-theme-primary);
    color: var(--mdc-theme-on-primary);
}

.btn-primary:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.btn-secondary {
    background-color: var(--mdc-theme-secondary);
    color: #16271c;
}

.btn-secondary:hover {
    background-color: #9a7738;
    color: #fff;
}

.btn-danger {
    background-color: var(--mdc-theme-error);
    color: white;
}

.btn-danger:hover {
    background-color: #8c001a;
}

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

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

/* Un bouton qui est un lien <a> ne se souligne pas au survol */
a.btn:hover {
    text-decoration: none;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--mdc-theme-text-secondary);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--mdc-theme-text-primary);
    background-color: var(--mdc-theme-surface);
    border: 1px solid var(--mdc-theme-divider);
    border-radius: 4px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--mdc-theme-primary);
    box-shadow: 0 0 0 2px rgba(23, 39, 75, 0.2);
}

.form-control::placeholder {
    color: var(--mdc-theme-text-secondary);
}

/* Alerts */
.alert {
    padding: 0.75rem 1.25rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: none;
}

.alert-success {
    background-color: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.alert-warning {
    background-color: rgba(251, 146, 60, 0.1);
    color: #f59e0b;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background-color: var(--mdc-theme-surface);
    border: 1px solid var(--mdc-theme-divider);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--mdc-elevation);
    transition: all 0.2s ease;
    z-index: 1000;
}

.theme-toggle:hover {
    box-shadow: var(--mdc-elevation-overlay);
    transform: scale(1.05);
}

.theme-toggle .material-icons {
    font-size: 1.5rem;
    color: var(--mdc-theme-text-primary);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--mdc-theme-surface);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.table th {
    background-color: var(--mdc-theme-background);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 500;
    color: var(--mdc-theme-text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03333em;
    border-bottom: 1px solid var(--mdc-theme-divider);
}

.table td {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-bottom: 1px solid var(--mdc-theme-divider);
    color: var(--mdc-theme-text-primary);
}


.table-actions {
    display: flex;
    gap: 0.5rem;
}

.table-actions .btn-icon {
    width: 32px;
    height: 32px;
}

/* Logo */
.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--mdc-theme-primary), var(--mdc-theme-secondary));
    color: white;
    font-weight: bold;
    font-size: 1.5rem;
    margin-right: 0.5rem;
    box-shadow: var(--mdc-elevation);
}

.logo-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

/* Header */
.header {
    margin-bottom: 2rem;
}

.header h1 {
    color: var(--mdc-theme-primary);
}

/* User Badge */
.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--mdc-theme-primary);
    color: var(--mdc-theme-on-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
}

.user-badge .material-icons {
    font-size: 1rem;
}

/* Divider */
.divider {
    height: 1px;
    background-color: var(--mdc-theme-divider);
    margin: 1.5rem 0;
}

/* Responsive */
@media (max-width: 768px) {
    .card {
        padding: 1rem;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    
    .theme-toggle {
        width: 40px;
        height: 40px;
    }
}

/* Animations */
/* Icône qui tourne pendant un calcul */
.spin {
    animation: spin 1s linear infinite;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card, .alert {
    animation: fadeIn 0.3s ease-out;
}

/* Fenêtres modales : ni animation de carte ni soulèvement au survol (sinon clignotement) */
.modal .card,
.modal .card:hover {
    animation: none;
    transform: none;
    margin-bottom: 0;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--mdc-theme-divider);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--mdc-theme-text-secondary);
}

/* Draw Balls (Loto, EuroMillions) */
.ball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: bold;
    font-size: 1rem;
    min-width: 40px;
    height: 40px;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

.ball:hover {
    transform: scale(1.1);
}

/* Loto Balls */
.loto-ball {
    background: linear-gradient(135deg, var(--mdc-theme-primary), #0f1a33);
    border: 2px solid var(--mdc-theme-primary);
}

/* Lucky Number Ball */
.lucky-ball {
    background: linear-gradient(135deg, #ff9800, #e68a00);
    border: 2px solid #ff9800;
}

/* EuroMillions Balls */
.euro-ball {
    background: linear-gradient(135deg, var(--mdc-theme-secondary), #8f6f33);
    border: 2px solid var(--mdc-theme-secondary);
}

/* EuroMillions Stars : étoile jaune, numéro marine au centre (comme sur fdj.fr) */
.euro-star-ball {
    width: 46px;
    min-width: 46px;
    height: 46px;
    padding-top: 4px; /* le centre visuel d'une étoile est un peu plus bas */
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: linear-gradient(160deg, #ffe066, #f5b400);
    color: #17274b;
    font-size: 0.95rem;
    clip-path: polygon(50% 0%, 66.2% 27.8%, 97.6% 34.5%, 76.2% 58.5%, 79.4% 90.5%,
                       50% 77.5%, 20.6% 90.5%, 23.8% 58.5%, 2.4% 34.5%, 33.8% 27.8%);
}

/* Prediction Balls (slightly larger) */
.prediction-ball {
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
}

/* Stat Box */
.stat-box {
    padding: 1rem;
    background: var(--mdc-theme-surface);
    border-radius: 8px;
    box-shadow: var(--mdc-elevation);
    transition: all 0.2s ease;
}

.stat-box:hover {
    box-shadow: var(--mdc-elevation-overlay);
}

/* ---- Statistiques : présentation compacte ---- */
.card-compact {
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.card-compact .card-title {
    font-size: 1.15rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Petites boules et étoiles (listes, tableaux) */
.ball.ball-sm {
    width: 30px;
    min-width: 30px;
    height: 30px;
    font-size: 0.8rem;
    box-shadow: none;
}

.ball.euro-star-ball.ball-sm {
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding-top: 3px;
    font-size: 0.75rem;
}

.last-draw {
    display: flex;
    flex-direction: row; /* .card de Bootstrap est en colonne */
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
}

/* Titre de colonne cliquable : ouvre la liste complète */
.stat-col-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--mdc-theme-primary);
}

.stat-col-title:hover {
    text-decoration: none;
}

.stat-col-more {
    margin-left: auto;
    color: var(--mdc-theme-text-secondary);
}

.stat-col-title:hover .stat-col-more {
    color: var(--link-hover);
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.15rem 0;
}

/* Barre proportionnelle au nombre de sorties */
.stat-bar {
    flex: 1;
    display: block;
    height: 6px;
    min-width: 60px;
    border-radius: 3px;
    background: var(--mdc-theme-divider);
    overflow: hidden;
}

.stat-bar > span {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--mdc-theme-secondary);
}

.stat-count {
    min-width: 2.5rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 0.9rem;
}

.table-compact td,
.table-compact th {
    padding: 0.3rem 0.75rem;
    vertical-align: middle;
}

.table-compact .ball-sm {
    margin-right: 2px;
}

/* Sous-onglets de la page Statistiques */
.subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    border-bottom: 1px solid var(--mdc-theme-divider);
    padding-bottom: 0.5rem;
}

.subnav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.8rem;
    border-radius: 4px;
    color: var(--mdc-theme-text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.subnav-link .material-icons {
    font-size: 1.1rem;
}

.subnav-link:hover {
    color: var(--link-hover);
    text-decoration: none;
}

.subnav-link.active {
    color: var(--mdc-theme-primary);
    background-color: rgba(176, 137, 68, 0.15);
}

/* Petit choix dans un pavé (ex. 1 / 3 / 5 / 10 tirages) */
.subnav-sm {
    border-bottom: none;
    padding-bottom: 0;
}

.subnav-sm .subnav-link {
    padding: 0.15rem 0.6rem;
    font-size: 0.8rem;
}

/* Barre de filtres au-dessus d'un tableau */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    margin-bottom: 0.75rem;
}

.toolbar label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.9rem;
}

.toolbar .form-select {
    width: auto;
}

/* Pagination */
.pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.75rem;
}

.pager a,
.pager .page-current,
.pager .page-gap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.4rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.pager a:hover {
    text-decoration: none;
    color: var(--link-hover);
}

.pager .page-current {
    background-color: var(--mdc-theme-primary);
    color: var(--mdc-theme-on-primary);
    font-weight: 500;
}

.pager .page-gap {
    color: var(--mdc-theme-text-secondary);
}

/* Grille des numéros colorée selon un indicateur (--heat : 0 à 1) */
.grid-title {
    font-size: 0.95rem;
    font-weight: 500;
    margin: 0.75rem 0 0.4rem;
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
}

.number-grid-bonus {
    grid-template-columns: repeat(12, 1fr);
}

.number-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    min-width: 0;
    border-radius: 6px;
    border: 2px solid transparent;
    background-color: rgba(176, 137, 68, var(--heat));
    color: var(--mdc-theme-text-primary);
    line-height: 1.1;
}

.number-cell:hover {
    text-decoration: none;
    border-color: var(--link-hover);
    color: var(--mdc-theme-text-primary);
}

.number-cell.dark,
.number-cell.dark:hover {
    color: #fff;
}

.number-cell.selected {
    border-color: var(--mdc-theme-primary);
    box-shadow: 0 0 0 1px var(--mdc-theme-primary);
}

.number-cell-num {
    font-weight: 700;
    font-size: 1rem;
}

.number-cell-value {
    font-size: 0.7rem;
    opacity: 0.85;
}

/* Fiche d'un numéro */
.sheet-table th {
    font-weight: 500;
    color: var(--mdc-theme-text-secondary);
    white-space: nowrap;
    width: 1%;
}

.mini-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 120px;
    margin-bottom: 0.25rem;
}

.mini-chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

.mini-chart-bar {
    width: 100%;
    min-height: 2px;
    border-radius: 3px 3px 0 0;
    background: var(--mdc-theme-divider);
}

.mini-chart-col.current .mini-chart-bar {
    background: var(--mdc-theme-secondary);
}

.mini-chart-value,
.mini-chart-label {
    font-size: 0.7rem;
    color: var(--mdc-theme-text-secondary);
}

.mini-chart-label {
    white-space: nowrap;
}

.partners {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.9rem;
}

.partner {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--mdc-theme-text-secondary);
}

.partner:hover {
    text-decoration: none;
}

/* Analyser une grille : choix des numéros (cases à cocher affichées comme des boules) */
.pick-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
    justify-items: center;
}

.pick-grid-bonus {
    grid-template-columns: repeat(12, 1fr);
}

.pick {
    margin: 0;
    cursor: pointer;
}

.pick input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Numéro non choisi : pâle ; choisi : couleur pleine */
.pick .ball {
    opacity: 0.25;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.pick:hover .ball {
    opacity: 0.55;
}

.pick input:checked + .ball {
    opacity: 1;
    transform: scale(1.1);
}

.pick input:disabled + .ball {
    cursor: not-allowed;
}

.pick input:focus-visible + .ball {
    outline: 2px solid var(--link-hover);
    outline-offset: 2px;
}

.ball.ball-miss {
    opacity: 0.25;
}

/* Pied de page : version et date de mise en ligne */
.site-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.8rem;
    color: var(--mdc-theme-text-secondary);
    opacity: 0.8;
}

/* Accueil : période de l'historique sous le dernier tirage */
.history-line {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 1rem 0 0;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(127, 127, 127, 0.2);
    font-size: 0.85rem;
    color: var(--mdc-theme-text-secondary);
}

.history-line .material-icons {
    font-size: 1.1rem;
}

/* Gains par combinaison : lignes cliquables (détail sous la grille) ; survol = couleur du texte seulement */
.match-table tbody tr[data-match] {
    cursor: pointer;
}

.match-table tbody tr[data-match]:hover td {
    color: var(--link-hover);
}

.match-table tbody tr.match-selected td {
    color: var(--mdc-theme-primary);
    font-weight: 600;
}

.match-detail-list {
    max-height: 32rem;
    overflow-y: auto;
}

.check-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 2rem;
}

.check-totals > div {
    display: flex;
    flex-direction: column;
}

.check-total-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--mdc-theme-primary);
}

.profile-rare td {
    color: var(--mdc-theme-secondary);
}

/* Détail d'un tirage : séparation avant les rangs du second tirage du Loto */
.prize-second-start td {
    border-top: 2px solid var(--mdc-theme-divider);
}

/* Prédictions : règles du filtre (seuil modifiable dans la phrase) et grilles proposées */
.rule-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    cursor: pointer;
}

.rule-label span {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.rule-help {
    margin: 0.1rem 0 0 1.6rem;
    font-size: 0.78rem;
    line-height: 1.3;
    color: var(--mdc-theme-text-secondary);
}

.rule-value {
    display: inline-block;
    width: 4.2rem;
    padding: 0.1rem 0.35rem;
}

.rules-total td {
    border-top: 2px solid var(--mdc-theme-divider);
}

.prediction {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--mdc-theme-divider);
}

.prediction:last-of-type {
    border-bottom: none;
}

/* Simulation sur le passé */
.sim-table .sim-reference td {
    background-color: rgba(176, 137, 68, 0.12);
}

.sim-table .sim-nofilter td {
    color: var(--mdc-theme-text-secondary);
}

.sim-chart {
    position: relative;
    height: 340px;
}

/* Mes grilles */
.grid-paused {
    opacity: 0.65;
}

.grid-last {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.75rem;
}

.grid-rename > summary {
    list-style: none;
}

.grid-rename > summary::-webkit-details-marker {
    display: none;
}

.save-grid .form-control {
    width: auto;
}

/* Profils : barre théorique (grise) au-dessus de la barre réelle */
.profile-table .stat-bar {
    margin: 2px 0;
}

.stat-bar-theory > span {
    background: var(--mdc-theme-text-secondary);
    opacity: 0.45;
}

/* Strategy Info */
.strategy-info {
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--mdc-theme-surface);
    border-left: 3px solid var(--mdc-theme-primary);
    border-radius: 4px;
}

.strategy-info h4 {
    margin-bottom: 0.5rem;
    color: var(--mdc-theme-text-primary);
}

.strategy-info p {
    margin-bottom: 0;
    color: var(--mdc-theme-text-secondary);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .ball {
        min-width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .prediction-ball {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* ---------- Mise en page commune ---------- */
.text-secondary {
    color: var(--mdc-theme-text-secondary) !important;
}

.topbar {
    background-color: var(--mdc-theme-surface);
    border-bottom: 1px solid var(--mdc-theme-divider);
    margin-bottom: 1.5rem;
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-height: 64px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--mdc-theme-primary);
    text-decoration: none;
}

.brand:hover {
    color: var(--mdc-theme-primary);
    text-decoration: none;
}

.brand-logo {
    width: 36px;
    height: 36px;
    display: block;
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.topnav {
    display: flex;
    gap: 0.25rem;
    flex: 1;
}

.topnav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border-radius: 4px;
    color: var(--mdc-theme-text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
}

.topnav-link .material-icons {
    font-size: 1.15rem;
}

/* Jeu actif, au bout du menu (clic : l'autre jeu) */
.topnav-game {
    display: inline-flex;
    align-items: center;
    margin-left: 0.5rem;
    padding-left: 0.9rem;
    border-left: 1px solid var(--mdc-theme-border, rgba(127, 127, 127, 0.3));
}

.topnav-game .game-logo {
    height: 22px;
}

.topnav-link:hover {
    color: var(--link-hover);
    text-decoration: none;
}

.topnav-link.active {
    color: var(--mdc-theme-primary);
    background-color: rgba(176, 137, 68, 0.15);
}

/* Lien réservé à l'admin, vu par un utilisateur : grisé, inactif (voir adminLink()) */
.topnav-link.disabled,
.link-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.topnav-link.disabled:hover,
.link-disabled {
    color: var(--mdc-theme-text-secondary);
    text-decoration: none;
}

/* Bootstrap coupe la souris sur .disabled (pointer-events: none) : on la rétablit pour que
   l'infobulle « Réservé aux administrateurs » s'affiche aussi dans le menu déroulant et sur les boutons */
span.disabled[aria-disabled="true"] {
    pointer-events: auto;
    cursor: not-allowed;
}

.dropdown-item.disabled:hover {
    color: var(--bs-dropdown-link-disabled-color);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--mdc-theme-divider);
    background-color: var(--mdc-theme-surface);
    color: var(--mdc-theme-text-primary);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-clip: padding-box;
    transform: translateZ(0);
}

.icon-btn:hover {
    border-color: var(--link-hover);
    box-shadow: 0 0 0 0.5px var(--link-hover);
}

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 40px;
    padding: 0 0.75rem 0 0.6rem;
    border: none;
    border-radius: 20px;
    background-color: var(--mdc-theme-primary);
    color: var(--mdc-theme-on-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}

.user-pill .material-icons {
    font-size: 1.2rem;
}

.dropdown-menu {
    background-color: var(--mdc-theme-surface);
    border: 1px solid var(--mdc-theme-divider);
    box-shadow: var(--mdc-elevation-overlay);
    font-size: 1rem;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--mdc-theme-text-primary);
}

.dropdown-item .material-icons {
    font-size: 1.2rem;
    color: var(--mdc-theme-text-secondary);
}

.dropdown-item:hover {
    background-color: transparent;
    color: var(--link-hover);
    text-decoration: none;
}

.page-head {
    margin-bottom: 1.5rem;
}

/* Lien de retour au-dessus du titre de page */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.back-link:hover {
    text-decoration: none;
}

.back-link .material-icons {
    font-size: 1.1rem;
}

.page-title {
    font-size: 1.75rem;
    color: var(--mdc-theme-primary);
    margin-bottom: 0.25rem;
}

.page-head p {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .topbar-inner {
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    .topnav {
        order: 3;
        flex-basis: 100%;
        overflow-x: auto;
    }
}

/* Logo : version disque (intérieur blanc, bords lissés) sur fond sombre */
.brand-logo-dark { display: none; }
[data-theme="dark"] .brand-logo-light { display: none; }
[data-theme="dark"] .brand-logo-dark { display: block; }

/* Logos des jeux */
.game-logo {
    height: 28px;
    width: auto;
    vertical-align: middle;
}

.game-logo-lg {
    height: 44px;
}

.game-logo-dark { display: none; }
[data-theme="dark"] .game-logo-light { display: none; }
[data-theme="dark"] .game-logo-dark { display: inline-block; }

.nav-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
