/* Fichier: css/style_dashboard.css */

/* --- 1. Variables et Reset Global du Dashboard --- */
:root {
    --dash-bleu-nuit: #2c3e50;
    --dash-bleu-moyen: #34495e;
    --dash-vert: #27ae60;
    --dash-violet: #8e44ad;
    --dash-orange: #f39c12;
    --dash-rouge: #c0392b;
    --dash-fond: #ecf0f1;
    --dash-blanc: #ffffff;
    --dash-bordure: #bdc3c7;
    --dash-texte: #34495e;
    --dash-texte-clair: #7f8c8d;
    --dash-radius: 8px;
    --dash-ombre: 0 4px 15px rgba(0, 0, 0, 0.08);
}

/* Le container du dashboard est différent de celui du site public */
.dashboard-container {
    display: flex;
    gap: 25px;
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
}

.dashboard-main {
    flex: 3;
}

.dashboard-sidebar {
    flex: 1;
    position: sticky; /* La sidebar reste visible au scroll */
    top: 100px; /* Espace par rapport au header */
    align-self: flex-start; /* S'aligne en haut */
}

/* --- 2. Éléments Communs du Dashboard --- */
.dash-card {
    background: var(--dash-blanc);
    border-radius: var(--dash-radius);
    padding: 25px;
    box-shadow: var(--dash-ombre);
    margin-bottom: 25px;
}

.dash-header {
    margin-bottom: 25px;
}
.dash-header h1 {
    font-size: 26px;
    color: var(--dash-bleu-nuit);
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 5px 0;
}
.dash-header p {
    font-size: 16px;
    color: var(--dash-texte-clair);
}

.dash-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}
.dash-table th {
    background-color: var(--dash-fond);
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--dash-bleu-moyen);
}
.dash-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--dash-bordure);
}
.dash-table tbody tr:hover {
    background-color: #f8f9fa;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    background-color: var(--dash-fond);
    padding: 15px;
    border-radius: var(--dash-radius);
}
.filter-form label { font-weight: 600; }
.filter-form input, .filter-form select {
    padding: 8px 12px;
    border: 1px solid var(--dash-bordure);
    border-radius: 6px;
}
.filter-form button {
    padding: 8px 18px;
    background-color: var(--dash-bleu-nuit);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.filter-form button:hover { background-color: var(--dash-bleu-moyen); }

/* --- 3. Sidebar Utilisateur --- */
.sidebar-widget {
    background: var(--dash-blanc);
    border-radius: var(--dash-radius);
    padding: 20px;
    box-shadow: var(--dash-ombre);
    margin-bottom: 20px;
}
.sidebar-widget h2 {
    font-size: 18px;
    color: var(--dash-bleu-nuit);
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--dash-bordure);
}
.user-menu {
    list-style: none;
    padding: 0;
}
.user-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    text-decoration: none;
    color: var(--dash-texte);
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s;
}
.user-menu a:hover {
    background-color: var(--dash-fond);
    color: var(--dash-bleu-nuit);
}
.user-menu a.active {
    background-color: var(--dash-bleu-nuit);
    color: white;
}
.annonce-content p { margin: 0 0 5px 0; }
.annonce-content small { color: var(--dash-texte-clair); }

/* --- 4. Page: dashboard_user.php --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}
.stat-card {
    background: var(--dash-fond);
    padding: 20px;
    border-radius: var(--dash-radius);
    text-align: center;
}
.stat-card .stat-icon {
    font-size: 24px;
    color: var(--dash-bleu-moyen);
    margin-bottom: 10px;
}
.stat-card h2 {
    font-size: 14px;
    color: var(--dash-texte-clair);
    font-weight: 500;
    margin: 0 0 5px 0;
}
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--dash-bleu-nuit);
}
.stat-card .stat-link {
    font-size: 13px;
    color: var(--dash-bleu-moyen);
    text-decoration: none;
    font-weight: 600;
    margin-top: 10px;
    display: inline-block;
}
.prono-history-card {
    border-left: 4px solid var(--dash-bleu-moyen);
    padding: 15px;
    background: var(--dash-fond);
    border-radius: var(--dash-radius);
    margin-bottom: 15px;
}
.prono-history-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 10px;
}
.horse-numbers { display: flex; gap: 8px; }
.horse-num {
    width: 28px; height: 28px;
    line-height: 28px; text-align: center;
    background: var(--dash-blanc);
    border: 1px solid var(--dash-bordure);
    border-radius: 50%;
    font-size: 13px; font-weight: bold;
}
.horse-num.found {
    background: var(--dash-vert);
    color: white;
    border-color: var(--dash-vert);
}
.upcoming-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--dash-bordure);
}
.upcoming-list li:last-child { border-bottom: none; }
.upcoming-list .btn-prono {
    padding: 6px 12px;
    background: var(--dash-vert);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

/* --- 5. Page: mes_pronostics.php --- */
.detail-toggle {
    cursor: pointer;
    color: var(--dash-bleu-moyen);
    font-weight: 600;
    text-decoration: underline;
}
.detail-content { display: none; }
.detail-content td { background-color: var(--dash-fond); }
.detail-flex { display: flex; gap: 30px; padding: 10px; }
.horse-list span {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: bold;
    background-color: var(--dash-blanc);
    font-size: 15px;
    margin-right: 5px;
}
.horse-list span.match {
    background-color: var(--dash-vert);
    color: white;
}
.statut {
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}
.statut.avenir { background-color: var(--dash-orange); }
.statut.termine { background-color: var(--dash-texte-clair); }

/* --- 6. Page: scores_history.php --- */
.score-summary {
    font-size: 18px;
    font-weight: 700;
    padding: 15px;
    background: var(--dash-fond);
    border-radius: var(--dash-radius);
    margin-bottom: 20px;
}
.scores-list .score-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 15px;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--dash-bordure);
}
.scores-list .score-item:last-child { border-bottom: none; }
.scores-list .score-value { font-weight: 700; text-align: right; }
.scores-list .high-score .score-value { color: var(--dash-vert); }
.scores-list .medium-score .score-value { color: var(--dash-orange); }
.scores-list .low-score .score-value { color: var(--dash-texte-clair); }

/* --- 7. Page: classement.php & classement_annuel.php --- */
.ranking-table .highlight {
    background-color: #e8f5e9;
    font-weight: 600;
}
.ranking-table .badge-you {
    background: var(--dash-vert);
    color: white;
    padding: 3px 6px;
    font-size: 11px;
    border-radius: 4px;
    margin-left: 6px;
}
.ranking-table .pseudo-link {
    color: var(--dash-bleu-nuit);
    font-weight: 600;
    text-decoration: none;
}
.ranking-table .pseudo-link:hover { text-decoration: underline; }
.stats-row td { background-color: var(--dash-fond); }
.monthly-stats {
    font-size: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}
.monthly-stats .month { font-weight: 600; }
.monthly-stats .score { color: var(--dash-bleu-moyen); }

/* --- 8. Page: historique.php --- */
.history-card {
    border-left: 5px solid var(--dash-bleu-moyen);
    margin-bottom: 15px;
}
.history-card .quinte-combination {
    margin: 10px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.history-card .quinte-combination span {
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: bold;
    background-color: #eee;
    font-size: 15px;
}
.history-card .quinte-combination .top5 {
    background-color: var(--dash-vert);
    color: white;
}
.history-card .quinte-combination .notop {
    background-color: var(--dash-rouge);
    color: white;
}
.history-card .prono-result {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    font-weight: bold;
}
.history-card .gain { color: var(--dash-vert); }

/* ==========================================================================
   STYLE POUR LA PAGE PROFIL UTILISATEUR
   ========================================================================== */

.profile-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 25px;
}

.profile-card {
    background-color: #fff;
    border-radius: var(--card-border-radius);
    box-shadow: var(--card-shadow);
    padding: 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 20px;
    border: 4px solid var(--primary-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-card h2 {
    margin: 0 0 10px 0;
    color: var(--text-dark);
}

.profile-badges {
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--text-light);
    margin-bottom: 25px;
    font-size: 0.9em;
}

.profile-badges span i {
    margin-right: 8px;
    color: var(--primary-color);
}

.btn-profile-edit {
    display: inline-block;
    background-color: var(--primary-color);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.btn-profile-edit:hover {
    background-color: var(--primary-hover);
}

.profile-stats-area {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.stats-key-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.stat-card {
    text-align: center;
}

.stat-card h4 {
    margin: 0 0 10px 0;
    color: var(--text-light);
    font-size: 1em;
}

.stat-card p {
    margin: 0;
    font-size: 2em;
    font-weight: 700;
    color: var(--primary-color);
}

#scoresChart {
    max-height: 250px;
}

.trophy-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.trophy-list li {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    color: var(--text-dark);
}
.trophy-list li:last-child {
    border-bottom: none;
}

.trophy-list li strong {
    color: var(--success-color);
}

.trophy-list li small {
    display: block;
    color: var(--text-light);
    font-size: 0.85em;
    margin-top: 4px;
}

/* Responsive pour les petits écrans */
@media (max-width: 992px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 576px) {
    .stats-key-cards {
        grid-template-columns: 1fr;
    }
}
/* ==========================================================================
   CORRECTION HAUTEUR GRAPHIQUE PROFIL
   ========================================================================== */

.chart-container {
    position: relative;
    height: 280px; /* On fixe une hauteur raisonnable pour le graphique */
    width: 100%;
}
/* ==========================================================================
   STYLE POUR LA PAGE MODIFIER PROFIL
   ========================================================================== */

.profile-edit-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
}

/* On peut utiliser un grid pour les écrans plus larges */
@media (min-width: 992px) {
    .profile-edit-grid {
        grid-template-columns: 1fr 1fr;
    }
    /* La carte de l'avatar peut prendre toute la largeur en bas */
    .profile-edit-grid .dash-card:last-child {
        grid-column: 1 / -1;
    }
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
}

.form-group input:disabled {
    background-color: #f2f2f2;
    cursor: not-allowed;
}

.form-group small {
    font-size: 0.85em;
    color: var(--text-light);
}

.btn-submit {
    width: 100%;
    padding: 15px;
    border: none;
    background-color: var(--primary-color);
    color: white;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-submit:hover {
    background-color: var(--primary-hover);
}

.current-avatar {
    text-align: center;
    margin-bottom: 20px;
}

.current-avatar img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #eee;
}

/* Styles pour les messages d'alerte */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid transparent;
}
.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}
.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}


/* ==========================================================================
   NOUVEAUX STYLES POUR LE POSITIONNEMENT
   ========================================================================== */

.profile-header-container {
    display: flex;
    align-items: center; /* Aligner les éléments verticalement */
    justify-content: center; /* Centrer le contenu horizontalement */
    gap: 15px; /* Ajouter de l'espace entre le pseudo et le bouton */
    margin-bottom: 25px; /* Marge en bas pour ne pas coller au texte */
}

.profile-card h2 {
    margin: 0;
}

.btn-profile-edit {
    display: inline-flex; /* Utilisez inline-flex pour aligner l'icône et le texte */
    align-items: center;
    gap: 8px; /* Espace entre l'icône et le texte */
    background-color: var(--dash-bleu-nuit); /* Utiliser une variable pour une couleur de fond contrastée */
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.btn-profile-edit:hover {
    background-color: var(--dash-bleu-moyen);
}
.profile-bio {
    font-style: italic;
    color: var(--text-light);
    margin: 10px 0 20px;
    font-size: 0.95em;
    line-height: 1.5;
}

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    padding: 15px 20px;
    border-radius: 8px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateX(100%);
    animation: slideIn 0.5s forwards, fadeOut 0.5s 3s forwards;
}
.toast-success { background-color: #27ae60; }
.toast-error { background-color: #c0392b; }
@keyframes slideIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes fadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

.btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 25px;
    background: var(--dash-bleu-nuit);
    color: white;
    font-size: 1em;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}
.btn-submit:hover {
    background: var(--dash-bleu-moyen);
    transform: translateY(-2px);
}
.btn-submit i { font-size: 1.1em; }

/* Toast */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    padding: 15px 20px;
    border-radius: 8px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateX(100%);
    animation: slideIn 0.5s forwards, fadeOut 0.5s 3s forwards;
}
.toast-success { background-color: #27ae60; }
.toast-error { background-color: #c0392b; }
@keyframes slideIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes fadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}
/* Bio utilisateur */
.profile-bio {
    font-style: italic;
    color: var(--text-light);
    margin: 12px 0 20px;
    font-size: 0.95em;
    line-height: 1.4;
    padding: 10px 12px;
    background: #f9f9f9;
    border-left: 3px solid var(--dash-bleu-nuit);
    border-radius: 6px;
}

/* Bloc pronostics récents dans la carte identité */
.profile-recent {
    margin-top: 20px;
}

.profile-recent h4 {
    font-size: 1.05em;
    margin-bottom: 10px;
    color: var(--dash-bleu-nuit);
    font-weight: 600;
}

.profile-recent ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.profile-recent li {
    font-size: 0.9em;
    margin-bottom: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    background: #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.profile-recent li strong {
    color: #27ae60;
    margin-left: 8px;
}

.profile-recent li small {
    color: #777;
    font-size: 0.8em;
    margin-left: 6px;
}

.profile-header-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
    align-items: start;
}
.profile-stats-cards {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.fullwidth {
    grid-column: 1 / -1;
}
.last-pronos-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.95em;
}
.last-pronos-table th, 
.last-pronos-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: center;
}
.last-pronos-table th {
    background: var(--dash-bleu-nuit);
    color: #fff;
    font-weight: 600;
}
.last-pronos-table tr:nth-child(even) {
    background: #f9f9f9;
}




/* ===========================
   TABLEAU DERNIERS PRONOS (Optimisé largeur)
   =========================== */
.table-pronos {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 1.05em;
    table-layout: fixed; /* Colonnes à largeur fixe */
}

.table-pronos th, 
.table-pronos td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-pronos th {
    background-color: var(--dash-bleu-nuit);
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 1em;
}

/* Largeur personnalisée par colonne */
.table-pronos th:nth-child(1),
.table-pronos td:nth-child(1) {
    width: 35%; /* Date & Course (la plus large) */
    text-align: left;
    word-wrap: break-word; /* permet retour à la ligne pour les libellés longs */
}

.table-pronos th:nth-child(2),
.table-pronos td:nth-child(2) {
    width: 25%; /* Pronostic (8 chiffres max) */
    white-space: nowrap;
    font-family: monospace;
}

.table-pronos th:nth-child(3),
.table-pronos td:nth-child(3) {
    width: 20%; /* Arrivée (5 chiffres max) */
    white-space: nowrap;
    font-family: monospace;
}

.table-pronos th:nth-child(4),
.table-pronos td:nth-child(4) {
    width: 10%; /* Score (max 5 chiffres) */
    white-space: nowrap;
}

.table-pronos th:nth-child(5),
.table-pronos td:nth-child(5) {
    width: 10%; /* Classement (max 3 chiffres) */
    white-space: nowrap;
}

.table-pronos tr:nth-child(even) {
    background-color: #f9f9f9;
}

.table-pronos tr:hover {
    background-color: #f1f7ff;
    transition: background-color 0.2s ease-in-out;
}

/* Mettre en valeur Pronostic et Arrivée */
.table-pronos td:nth-child(2),
.table-pronos td:nth-child(3) {
    font-size: 1.15em;   /* un peu plus grand que le reste */
    font-weight: 600;    /* plus gras */
    letter-spacing: 1px; /* espacement pour aérer les chiffres */
    color: #2c3e50;      /* couleur légèrement plus foncée */
}

