﻿html, body {

    padding: 0;
    max-width: 100%;
    overflow-x: hidden; /* empêche tout scroll horizontal */
}

body {
    margin: 0;
    display: flex;
    flex-direction: row;
    height: 100vh;
    width: 100%;
    font-family: Arial, sans-serif;
    background: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.3)), url('/resources/background.jpg') no-repeat center center;
    background-size: cover;
    background-attachment: scroll; /* Plutôt que fixed */
}

/* Sidebar */
.sidebar {
    width: 15rem;
    background: rgba(0,0,0,0.8);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* espace haut / bas */
    box-shadow: 2px 0 10px rgba(0,0,0,0.6);
    z-index: 10;
}

    .sidebar h2 {
        margin-bottom: 20px;
        font-size: 20px;
        text-align: center;
    }

    .sidebar ul {
        list-style: none;
        padding: 0;
        width: 100%;
    }

    .sidebar li {
        margin: 0;
    }

    .sidebar button {
        text-align: left;
        background-color: transparent;
        background-repeat: no-repeat;
        padding: 20px;
        width: 100%; 
        font-size: 15px;
        font-weight: bold;
        color: lightgrey;
        border: none;
        cursor: pointer;
        transition: background 0.3s ease;
    }

        .sidebar button:hover {
            color: white;
            background-color: rgba(0,0,0,0.4);
        }
.sidebar-footer {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    text-align: center;
    margin: 20px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px; /* Ajout d'un padding pour éviter les débordements */
    min-height: 0; /* Important pour le flex */
}

/* Container principal du jeu */
.game-container {
    background: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
/* Plateau d'échecs */
.chessboard {
    width: min(90vw, 90vh, 480px); /* Changement des valeurs */
    height: min(90vw, 90vh, 480px); /* Changement des valeurs */
    max-width: 100%;
    border: 5px solid white;
    border-radius: 5px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 50px rgba(0,0,0,0.5);
}
    .chessboard::before,
    .chessboard::after{
        content: "";
        position: absolute;
        pointer-events: none; /* pour ne pas bloquer les clics */
        z-index: 5; /* au-dessus des cases */
    }
    /* Lignes de terrain */
    .chessboard::before {
        top: 50%;
        left: 0;
        width: 100%;
        height: 2px;
        background: white; /* ligne médiane */
        transform: translateY(-50%);
    }

    .chessboard::after {
        top: 50%;
        left: 50%;
        width: 24%;
        height: 24%;
        border: 3px solid white; /* cercle central */
        border-radius: 50%;
        transform: translate(-50%, -50%);
    }
.center-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}
/* Cases du plateau */
.square {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

    .square.light {
        background-color: #CCEC9D;
    }

    .square.dark {
        background-color: #77AF23;
    }

    .square:hover {
        box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
    }

/* But du haut (ligne 0) - case de gauche d8 */
.goal-area-top-left {
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid white;
    border-top: 3px solid black;
    border-right: none;
    position: relative;
    z-index: 8;
}
.marquage-top::before {
    content: "";
    position: absolute;
    pointer-events: none; /* pour ne pas bloquer les clics */
    z-index: 5; /* au-dessus des cases */
    top: 100%;
    left: 100%;
    width: 50%;
    height: 50%;
    border: 3px solid white; /* cercle central */
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 7;
}

/* But du haut (ligne 0) - case de droite e8 */
.goal-area-top-right {
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid white;
    border-top: 3px solid black;
    border-left: none;
    position: relative;
    z-index: 8;
}


/* But du bas (ligne 7) - case de gauche d1 */
.goal-area-bottom-left {
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid white;
    border-bottom: 3px solid black;
    border-right: none;
    position: relative;
    z-index:8;
}
    .marquage-bot::before {
        content: "";
        position: absolute;
        pointer-events: none; /* pour ne pas bloquer les clics */
        z-index: 5; /* au-dessus des cases */
        top: 0%;
        left: 100%;
        width: 50%;
        height: 50%;
        border: 3px solid white; /* cercle central */
        border-radius: 50%;
        transform: translate(-50%, -50%);
        z-index: 7;
    }

/* But du bas (ligne 7) - case de droite e1 */
.goal-area-bottom-right {
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid white;
    border-bottom: 3px solid black;
    border-left: none;
    position: relative;
    z-index: 8;
}

.dot-centre::before {
    content: "";
    position: absolute;
    pointer-events: none; /* pour ne pas bloquer les clics */
    z-index: 5; /* au-dessus des cases */
    top: 0%;
    left: 0%;
    width: 1%;
    height: 1%;
    border: 5px solid white; /* cercle central */
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 9;
}

.winning-path {
    background-color: #FFD700 !important;
    animation: pulse 1s infinite;
}

.indicator {
    color: #FFD700;
    font-size: 1.5em;
    font-weight: bold;
}

@keyframes pulse {
    0% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.7;
    }
}
/* États des cases */
.square.selected {
    background-color: #FFD700 !important;
    box-shadow: inset 0 0 10px rgba(255,235,59,0.8);
}

.square.valid-move {
    background-color: #FFD700 !important;
}
/* Pièces d'échecs */

.piece-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    display: block;
}

.piece {
    width: 80%;
    height: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
}

    .piece.dragging {
        cursor: grabbing;
        opacity: 0.8;
    }

/* Interface de jeu */
.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 10px;
}
.game-info2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 10px;
}

.turn-indicator {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

/* Coordonnées du plateau - style football */
.coordinates {
    position: absolute;
    font-size: 12px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

.coord-file {
    bottom: 2px;
    right: 2px;
}

.coord-rank {
    top: 2px;
    left: 2px;
}

/* Page connexion */

.auth-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    width: min(90vmin, 480px);
    height: auto;
}

.logo {
    text-align: center;
    font-size: 3em;
    margin-bottom: 20px;
}

.title {
    text-align: center;
    font-size: 24px;
    color: #333;
    margin-bottom: 30px;
}

.form-tabs {
    display: flex;
    margin-bottom: 30px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 5px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

    .tab-btn.active {
        background: #77AF23;
        color: white;
    }

.form-group {
    margin-bottom: 20px;
}

    .form-group label {
        display: block;
        margin-bottom: 5px;
        color: #555;
        font-size: 16px;
    }

    .form-group input {
        width: 100%;
        padding: 15px;
        border: 2px solid #e1e5e9;
        border-radius: 10px;
        font-size: 16px;
        transition: border-color 0.3s;
    }

        .form-group input:focus {
            outline: none;
            border-color: #667eea;
        }

.submit-btn {
    width: 100%;
    padding: 15px;
    background: #77AF23;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

    .submit-btn:hover {
        transform: translateY(-2px);
    }

.message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.error-message {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.success-message {
    background: #efe;
    color: #363;
    border: 1px solid #cfc;
}

.form-content {
    display: none;
}

    .form-content.active {
        display: block;
    }

@media (max-width: 768px) {
    body {
        flex-direction: column;
        height: auto;
        margin: 0;
        padding: 0;
    }

    .main-content {
        order: 1;
        flex: none;
        display: flex;
        justify-content: flex-start; /* colle en haut */
        align-items: center;
        margin: 0 0 10 0;
        padding: 0;
        width: 100%;
    }

    .game-container {
        margin: 0;
        padding: 10 0;
        width: 100%;
    }

    .chessboard {
        width: 100%; /* prend toute la largeur */
        max-width: 480px;
        height: auto; /* adapte la hauteur */
        aspect-ratio: 1 / 1; /* carré */
        border: 2px solid white;
        border-radius: 3px;
        margin: 0 auto; /* bien centré horizontalement */
    }

    .sidebar {
        order: 2;
        width: 100%;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.6);
        padding: 10px;
        margin: 0;
    }

        .sidebar ul {
            display: block;
            margin: 0;
            padding: 0;
        }

        .sidebar button {
            width: 100%;
            padding: 10px;
            text-align: left;
            font-size: 14px;
        }

    piece {
        font-size: 28px;
    }

    .game-container {
        margin-bottom: 10px;
        padding: 10px 0px 10px 0px;
    }

    .auth-container {
        padding: 15px;
        margin-bottom: 10px;
    }

    h1 {
        font-size: 24px;
        text-align: center;
    }

    .game-info, .game-info2 {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

.game-status {
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
}

.turn-indicator {
    font-size: 14px;
}

.game-status.check {
    background-color: #ffeb3b;
    color: #333;
}

.game-status.checkmate {
    background-color: #f44336;
    color: white;
}

.game-status.stalemate {
    background-color: #9e9e9e;
    color: white;
}
    }

