:root {
    --primary-color: #33475b;    /* Bleu foncé - Titres, Entêtes */
    --accent-color: #ff7a59;     /* Orange - Actions principales, Logo */
    --secondary-color: #0091ae;  /* Bleu clair - Hover, Highlight, Actions secondaires */
    --bg-color: #f0f2f5;
    --white: #ffffff;
    --border-color: #eaf0f6;
    --text-color: #33475b;
    --success-color: #2e7d32;
    --error-color: #ff4e50;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
}
header {
    background-color: var(--white);
    color: var(--text-color);
    padding: 0.5rem 2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1001;
}
.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
}
.logo span {
    color: var(--accent-color);
}
nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
}
.admin-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}
.admin-btn:hover {
    filter: brightness(110%);
}
nav a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
}
nav a:hover {
    color: var(--secondary-color);
    text-decoration: none;
}

/* Dropdown menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--white);
    min-width: 180px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.1);
    z-index: 1000;
    border-radius: 4px;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid var(--border-color);
}

.dropdown-content::after {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    height: 15px; /* Comble l'espace entre le bouton et le menu */
}

.dropdown-content::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    margin-left: -10px;
    border-width: 10px;
    border-style: solid;
    border-color: transparent transparent var(--white) transparent;
}

.dropdown-content a {
    color: var(--text-color);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
    font-size: 0.9rem;
    white-space: nowrap;
    border-bottom: 1px solid var(--bg-color);
}

.dropdown-content a:last-child {
    border-bottom: none;
}

.dropdown-content a:hover {
    background-color: var(--bg-color);
    color: var(--accent-color);
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown:hover .dropbtn {
    color: var(--secondary-color);
}

/* Burger Menu */
.burger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1002;
}

.burger-menu span {
    width: 30px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 10px;
    transition: all 0.3s ease-in-out;
    position: relative;
}

.burger-menu.active span:first-child {
    transform: translateY(8px) rotate(45deg);
}

.burger-menu.active span:nth-child(2) {
    opacity: 0;
}

.burger-menu.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.container {
    padding: 2rem;
    max-width: 1000px;
    margin: 20px auto;
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Media Queries */
@media screen and (max-width: 768px) {
    header {
        padding: 0.5rem 1rem;
    }

    .burger-menu {
        display: flex;
    }

    nav {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 100%;
        box-sizing: border-box;
        height: calc(100vh - 60px);
        background-color: var(--white);
        transition: 0.3s;
        z-index: 1000;
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
    }

    nav.active {
        left: 0;
    }

    nav ul {
        flex-direction: column;
        padding-top: 2rem;
        gap: 0;
    }

    nav ul li {
        width: 100%;
        text-align: center;
    }

    nav a {
        display: block;
        padding: 1.2rem;
        font-size: 1.1rem;
        border-bottom: 1px solid var(--bg-color);
    }

    .dropdown-content {
        position: static;
        transform: none;
        box-shadow: none;
        display: none;
        background-color: #f8f9fa;
        width: 100%;
        border: none;
    }

    .dropdown.active .dropdown-content,
    .dropdown:hover .dropdown-content {
        display: block;
    }

    .dropdown-content::before,
    .dropdown-content::after {
        display: none;
    }

    .header-actions {
        position: fixed;
        bottom: 0;
        left: -100%;
        width: 100%;
        box-sizing: border-box;
        background-color: var(--white);
        padding: 1.5rem;
        transition: 0.3s;
        display: flex;
        flex-direction: column;
        align-items: center;
        border-top: 1px solid var(--border-color);
        z-index: 1000;
    }

    .header-actions.active {
        left: 0;
    }

    .container {
        padding: 1.5rem;
        margin-top: 20px;
        border-radius: 0;
    }

    .container-full {
        max-width: 100%;
        width: 100%;
        padding: 1.5rem 1rem;
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
    }

    .table-responsive {
        margin: 0;
        border-radius: 0;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive table {
        margin-top: 10px;
        border-collapse: separate;
        border-spacing: 0;
    }

    table {
        font-size: 0.9rem;
    }

    th, td {
        padding: 12px 8px;
    }

    /* Classement général mobile */
    .col-joueur {
        width: 45%;
    }

    .player-name {
        display: flex;
        flex-direction: column;
    }

    .player-name .lastname {
        font-weight: bold;
        font-size: 0.85rem;
        margin-bottom: 2px;
    }

    .player-name .firstname {
        font-size: 0.75rem;
        color: #666;
        line-height: 1.2;
    }

    .col-pos {
        width: 30px;
        text-align: center;
    }

    .col-victoires, .col-ratio {
        text-align: center;
    }

    h2 {
        font-size: 1.4rem;
        margin-top: 25px;
        margin-bottom: 20px;
        line-height: 1.2;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .form-group label {
        display: block;
        margin-bottom: 5px;
    }

    .actions-admin {
        display: flex;
        flex-direction: column;
        gap: 15px;
        margin-top: 10px;
    }

    .actions-admin .btn, .actions-admin .btn-secondary {
        width: 100%;
        box-sizing: border-box;
    }

    /* Amélioration visuelle de la table mobile */
    .table-responsive table {
        border: none;
    }

    .table-responsive tr {
        border-bottom: 1px solid var(--border-color);
    }

    .table-responsive th {
        background-color: var(--primary-color);
        color: white;
        padding: 14px 10px;
        font-size: 0.8rem;
        text-transform: uppercase;
        border: none;
    }

    .table-responsive td {
        padding: 14px 10px;
        vertical-align: middle;
    }

    .col-pos {
        font-weight: bold;
        color: var(--secondary-color);
    }

    /* Ratio plus visible */
    .col-ratio {
        font-weight: bold;
        color: var(--success-color);
    }

    .btn-print {
        width: 100%;
        justify-content: center;
    }

    .matchs-actions {
        padding: 5px;
    }
}
h1 { margin: 0; font-size: 1.2rem; }
.table-responsive table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse; /* Par défaut pour les tables non responsives */
    margin-top: 10px;
}
th, td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
}
th {
    background-color: var(--primary-color);
    color: white;
}
.logout-link {
    font-size: 0.8rem;
    color: var(--text-color);
    text-decoration: none;
    margin-right: 15px;
}
.logout-link:hover {
    text-decoration: underline;
}
.btn-delete {
    color: var(--error-color);
    text-decoration: none;
}
.btn-delete:hover {
    text-decoration: underline;
}
.card {
    margin-top: 20px;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--white);
}
.form-group {
    margin-bottom: 15px;
}
.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd6e2;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1rem;
}
.btn-primary, .btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
    display: inline-block;
    text-decoration: none;
    text-align: center;
}
.btn-primary:hover, .btn:hover {
    filter: brightness(110%);
}
.btn-secondary {
    background-color: var(--white);
    color: var(--text-color);
    border: 1px solid #cbd6e2;
    padding: 10px 20px;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
    display: inline-block;
    text-decoration: none;
    text-align: center;
}
.btn-secondary:hover {
    background-color: var(--bg-color);
    border-color: var(--primary-color);
}
.alert-success {
    color: var(--success-color);
    background-color: #edf7ed;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-weight: bold;
}
.alert-error {
    color: #721c24;
    background-color: #f8d7da;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-weight: bold;
    border: 1px solid #f5c6cb;
}

/* Style standard pour les titres de section */
h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

/* Table croisée Matchs */
.cross-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    background-color: var(--white);
    border: 1px solid #ccc;
}

.subtitle {
    text-align: center;
    color: var(--secondary-color);
    margin-top: -10px;
    margin-bottom: 20px;
    font-style: italic;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(100vh - 100px);
    width: 100%;
    padding-top: 2px; /* Petit espace pour éviter le collage parfait au header */
}
.table-responsive.no-max-height {
    max-height: none;
    overflow-x: auto;
}
.table-responsive thead th {
    z-index: 100;
    background-color: var(--primary-color);
    background-clip: padding-box;
}

.table-responsive.no-max-height thead th {
}


.container-full {
    max-width: 98%;
    margin-left: auto;
    margin-right: auto;
}

.name-short, .header-short {
    display: none;
}

@media screen and (max-width: 768px) {
    .name-full, .header-full {
        display: none;
    }
    .name-short, .header-short {
        display: inline;
    }
    .table-responsive thead th {
    }

    .corner-header, .col-header {
    }
    
    .row-header {
        font-size: 0.75rem;
        padding-left: 5px !important;
        max-width: 105px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .corner-header {
        width: 105px;
        max-width: 105px;
        font-size: 0.7rem;
    }

    .col-joueur, .col-match, .col-gagnant {
        max-width: 105px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .cross-table, .table-responsive table {
        width: max-content;
        min-width: 100%;
    }

    .col-header {
        height: 120px;
    }

    .name-vertical {
        height: 110px;
        font-size: 0.75rem;
    }
}

.cross-table th:first-child, .cross-table td:first-child {
}

.cross-table th:last-child, .cross-table td:last-child {
}

.full-width-table {
    table-layout: fixed;
}

.cross-table th, .cross-table td {
    border: 1px solid #ccc;
    padding: 5px;
    text-align: center;
    font-size: 0.85rem;
}

.corner-header {
    background-color: var(--primary-color);
    color: white;
    width: 200px;
    text-align: left !important;
}

.col-header {
    background-color: var(--primary-color);
    color: white;
    height: 160px;
    white-space: nowrap;
    padding: 0 !important;
    vertical-align: bottom;
}

.name-vertical-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 100%;
    width: 35px;
}

.name-vertical {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-align: left;
    height: 150px;
    padding: 5px 0;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.row-header {
    background-color: var(--bg-color);
    font-weight: bold;
    text-align: left !important;
    white-space: nowrap;
    padding-left: 10px !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

.diagonal {
    background-color: #ddd;
    width: 35px;
}

.result-cell {
    width: 35px;
    transition: background-color 0.2s;
}

.result-cell.win {
    background-color: #d4edda;
    color: #155724;
    font-weight: bold;
}

.result-cell.loss {
    background-color: #f8d7da;
    color: #721c24;
}

.cross-table tr:hover {
    background-color: #f1f4f6;
}

.cross-table td:hover {
    background-color: var(--border-color) !important;
}

.total-header {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}

.total-cell {
    background-color: var(--bg-color);
    font-weight: bold;
}

.highlight-header {
    background-color: var(--secondary-color) !important;
    color: white !important;
}

/* Actions et Impression */
.matchs-actions {
    display: flex;
    justify-content: center;
    padding: 10px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
}

.btn-print {
    background-color: var(--white);
    color: var(--text-color);
    border: 1px solid #cbd6e2;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-print:hover {
    background-color: var(--bg-color);
    border-color: var(--primary-color);
}

.btn-print svg {
    opacity: 0.7;
}

@media print {
    .no-print, header, nav, .admin-btn, .logout-link, .matchs-actions {
        display: none !important;
    }
    
    body {
        background-color: white !important;
        margin: 0;
        padding: 0;
    }
    
    .matchs-container-full {
        box-shadow: none !important;
        margin: 0 !important;
        width: 100% !important;
    }

    .matchs-actions {
        display: none !important;
    }

    h2 {
        color: black !important;
        background: transparent !important;
        border-bottom: 2px solid #333;
        padding-bottom: 10px;
        text-align: left;
    }

    .subtitle {
        text-align: left;
        margin-bottom: 30px;
    }

    .cross-table {
        border: 1px solid black !important;
    }

    .cross-table th, .cross-table td {
        border: 1px solid black !important;
        color: black !important;
    }

    .corner-header, .col-header, .total-header {
        background-color: #f0f0f0 !important;
        color: black !important;
    }

    .result-cell.win {
        background-color: #e8f5e9 !important; /* Vert très clair pour l'impression */
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .result-cell.loss {
        background-color: #ffebee !important; /* Rouge très clair pour l'impression */
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .diagonal {
        background-color: #eee !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .name-vertical {
        color: black !important;
    }
}
