/* =================================================================== */
/* =================== FICHIER DE STYLE COMPLET ====================== */
/* =================================================================== */

/* --- Style Général & Global --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    color: #1c1e21;
    margin: 0;
    padding: 20px;
}
.container {
    max-width: 1200px;
    margin: auto;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
h1, h2, h3 {
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-top: 0;
}
hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 20px 0;
}
button, input[type="submit"] {
    background-color: #1877f2;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin: 2px;
    transition: background-color 0.2s, opacity 0.2s;
}
button:hover, input[type="submit"]:hover {
    opacity: 0.9;
}
input[type="text"], input[type="number"], input[type="password"], select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}
a {
    color: #1877f2;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* --- Page de Connexion / Inscription --- */
.login-container {
    max-width: 450px;
    margin-top: 50px;
    padding: 40px;
}
.tab-buttons {
    display: flex;
    margin-bottom: 20px;
}
.tab-btn {
    flex: 1;
    padding: 15px;
    background-color: #e9ecef;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #495057;
    border-bottom: 3px solid transparent;
}
.tab-btn.active {
    background-color: #fff;
    border-bottom: 3px solid #1877f2;
    color: #1877f2;
}
form.hidden {
    display: none;
}
.form-section label, .login-container label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}
.form-section input, .login-container input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    box-sizing: border-box;
}
.error-message {
    color: #dc3545;
    font-size: 14px;
    margin-bottom: 10px;
    min-height: 1em;
}
form input[type="submit"]:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* --- Page Principale (index.php) --- */
.scoreboard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    font-size: 28px;
    font-weight: bold;
    padding: 10px;
    background-color: #333;
    color: white;
    border-radius: 8px;
}
.score-team {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.score-points {
    flex: 0 1 auto;
    padding: 0 20px;
}
#chronometre {
    font-size: 48px;
    font-weight: bold;
    text-align: center;
}
.chrono-controles {
    text-align: center;
    margin: 10px 0;
}
#mi-temps-afficheur, #sens-attaque-actuel {
    text-align: center;
    font-weight: bold;
    color: #666;
    margin-bottom: 10px;
}
.match-info {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.compositions {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}
.equipe-container {
    flex: 1;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
}
.equipe-container ul {
    list-style-type: none;
    padding: 0;
}
.equipe-container li {
    display: flex;
    align-items: center;
    padding: 6px 4px;
    border-bottom: 1px solid #f0f0f0;
}
.equipe-container li.reserviste a {
    color: #888;
    font-style: italic;
}
.player-name {
    flex-grow: 1;
    margin: 0 8px;
}
.player-events {
    margin-left: auto;
    display: flex;
    gap: 5px;
}
.player-events span {
    display: inline-block;
    padding: 2px 5px;
    border-radius: 4px;
    color: white;
    font-size: 14px;
}
.player-events .event-but { background-color: #28a745; }
.player-events .event-passe { background-color: #fd7e14; }
.player-events .event-csc { background-color: #dc3545; }
.player-events .event-sub { background-color: #007bff; }

/* -- Boutons d'action -- */
.actions-container {
    display: flex;
    gap: 20px;
}
.actions-colonne {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    align-content: start;
}
.actions-colonne .action-btn {
    width: 100%;
    box-sizing: border-box;
}
#stats-btn { background-color: #555; }
#sync-btn { background-color: #28a745; }

/* -- Couleurs des boutons d'action -- */
.actions-colonne .action-btn[data-action="But marqué"], .actions-colonne .action-btn[data-action="Passe décisive"] { background-color: #28a745; }
.actions-colonne .action-btn[data-action="Tir cadré"], .actions-colonne .action-btn[data-action="Tir non cadré"] { background-color: #fd7e14; }
.actions-colonne .action-btn[data-action="Carton jaune"] { background-color: #ffc107; color: #1c1e21; }
.actions-colonne .action-btn[data-action="Carton rouge"] { background-color: #dc3545; }
.actions-colonne .action-btn[data-action="Corner"], .actions-colonne .action-btn[data-action="Hors-jeu"], .actions-colonne .action-btn[data-action="Remplacement"] { background-color: #007bff; }
.actions-colonne .action-btn[data-action="Balle gagnée"], .actions-colonne .action-btn[data-action="Balle perdue"] { background-color: #6c757d; }
.actions-colonne .action-btn[data-action="Faute subie"], .actions-colonne .action-btn[data-action="Faute provoquée"], .actions-colonne .action-btn[data-action="Coup franc"] { background-color: #6f42c1; }
.actions-colonne .action-btn[data-action="Penalty Obtenu"], .actions-colonne .action-btn[data-action="Penalty Concédé"] { background-color: #e83e8c; }

/* --- Modales --- */
.modal {
    display: none; 
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
}
.modal-content {
    background-color: #fefefe;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
}
.terrain-interactive {
    width: 100%;
    aspect-ratio: 105 / 68;
    background: url('https://upload.wikimedia.org/wikipedia/commons/thumb/b/b9/Soccer_field_-_empty.svg/1024px-Soccer_field_-_empty.svg.png') no-repeat center center;
    background-size: contain;
    position: relative;
    border: 1px solid #ccc;
    cursor: crosshair;
}
.click-marker {
    position: absolute;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background-color: red;
    border: 2px solid white;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* --- Pages d'Analyse --- */
.btn-ajout {
    display: block;
    width: fit-content;
    margin: -10px 0 20px auto;
    background: #28a745;
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
}
.match-list .match-item {
    display: block;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 10px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s;
}
.match-list .match-item:hover {
    background-color: #f8f9fa;
}
.match-item .match-details {
    display: flex;
    align-items: center;
    font-size: 20px;
    font-weight: bold;
}
.match-details .team { flex: 1; }
.match-details .home { text-align: right; }
.match-details .away { text-align: left; }
.match-details .score { padding: 0 20px; }
.match-item .match-type, .match-item .match-date {
    font-size: 14px;
    color: #6c757d;
    text-align: center;
    display: block;
}
.player-rating {
    display: inline-block;
    padding: 5px 15px;
    font-size: 24px;
    background-color: #1877f2;
    color: white;
    border-radius: 8px;
    vertical-align: middle;
}
#football-field {
    width: 100%;
    max-width: 800px;
    aspect-ratio: 105 / 68;
    margin: 20px auto;
    background: url('https://upload.wikimedia.org/wikipedia/commons/thumb/b/b9/Soccer_field_-_empty.svg/1024px-Soccer_field_-_empty.svg.png') no-repeat center center;
    background-size: contain;
    position: relative;
    border: 2px solid #333;
}
.event-point {
    position: absolute;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0,0,0,0.7);
    cursor: help;
}
.event-point.point-hidden { display: none; }
/* Couleurs des points */
.point-but { background-color: #28a745; }
.point-passe { background-color: #17a2b8; }
.point-tir-cadre { background-color: #ffc107; }
.point-tir-non-cadre { background-color: #adb5bd; }
.point-faute-subie { background-color: #007bff; }
.point-faute-provoquee { background-color: #fd7e14; }
.point-penalty-obtenu { background-color: #20c997; }
.point-penalty-concede { background-color: #dc3545; }
.point-balle-gagnee { background-color: #90ee90; }
.point-balle-perdue { background-color: #e83e8c; }
.point-coup-de-pied-arrete { background-color: #6f42c1; }
.point-hors-jeu { background-color: #663300; }
.point-autre { background-color: #343a40; }

#field-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px 20px;
    margin: 15px 0;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
}
.legend-item {
    display: flex;
    align-items: center;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.legend-item-inactive {
    opacity: 0.4;
    text-decoration: line-through;
}
.legend-color {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    margin-right: 8px;
    border: 1px solid #ccc;
}
#stats-summary-table, #stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}
#stats-summary-table td, #stats-table td, #stats-table th {
    padding: 10px;
    border: 1px solid #eee;
    text-align: center;
}
#stats-summary-table td:first-child, #stats-table th {
    font-weight: bold;
}
#stats-table td:nth-child(2) {
    text-align: left;
}
#stats-list .stat-item {
    padding: 8px;
    border-bottom: 1px solid #f0f0f0;
}

/* --- Timeline --- */
#timeline-container ul {
    list-style-type: none;
    padding: 0;
    position: relative;
    display: flow-root;
}
#timeline-container ul::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    background-color: #ddd;
    transform: translateX(-50%);
}
#timeline-container li {
    position: relative;
    padding: 5px 0;
    width: 100%;
    display: flow-root;
}
#timeline-container li::after {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background-color: white;
    border: 3px solid #1877f2;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}
.timeline-content {
    width: calc(50% - 40px);
    box-sizing: border-box;
    padding: 10px;
    border-radius: 6px;
    background-color: #f0f2f5;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#timeline-container li.domicile .timeline-content {
    float: left;
    text-align: right;
    justify-content: flex-end;
}
#timeline-container li.exterieur .timeline-content {
    float: right;
    text-align: left;
    justify-content: flex-start;
}
.timeline-time { font-weight: bold; }
.timeline-icon { font-size: 20px; margin: 0 8px; }
.timeline-desc { font-size: 14px; }
.btn-logout {
    display: block; /* Permet de définir une marge */
    width: fit-content; /* S'adapte à la taille du texte */
    margin: 0 0 15px auto; /* Aligne le bouton en haut à droite */
    
    background-color: #6c757d; /* Couleur grise pour une action secondaire */
    color: white;
    padding: 8px 15px;
    border-radius: 6px;
    text-decoration: none;
}

.btn-logout:hover {
    background-color: #5a6268;
    text-decoration: none;
}
/* Dans analyse.css */
.algo-link {
    font-size: 14px;
    font-weight: normal;
    margin-left: 15px;
}

.player-rating-small {
    display: inline-block;
    width: 32px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    background-color: #6c757d;
    color: white;
    font-weight: bold;
    border-radius: 4px;
    margin-right: 8px;
    font-size: 14px;
}
/* --- Responsive --- */
@media (max-width: 768px) {
    .login-container { flex-direction: column; }
    .compositions, .actions-container { flex-direction: column; }
    #timeline-container ul::before { left: 10px; }
    #timeline-container li { width: 100%; }
    .timeline-content { width: calc(100% - 40px); float: right !important; text-align: left !important; justify-content: flex-start !important; }
    #timeline-container li::after { left: 10px; }
}