/* ============================================================
   CHARTE GRAPHIQUE MALAGA GOLF — HERITAGE ERC CRM
   ============================================================ */
:root {
    --primary: #312e81;      /* Indigo */
    --accent:  #22d3ee;      /* Cyan */
    --text-main: #172b4d;
    --text-sec: #6b778c;
    --bg-page: #f4f5f7;
    --border: #dfe1e6;
    --action: #06b6d4;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    font-family: 'DM Sans', -apple-system, sans-serif; 
    background: var(--bg-page); 
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.4;
}

/* TOPBAR */
.topbar {
    background: var(--primary);
    color: white;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.topbar-left { display: flex; align-items: center; gap: 30px; }
.topbar h1 { font-size: 18px; font-weight: 700; letter-spacing: 1px; margin: 0; }

.topbar-nav { display: flex; gap: 10px; }
.topbar-nav a { 
    color: rgba(255,255,255,0.8); 
    text-decoration: none; 
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 13px;
}
.topbar-nav a:hover, .topbar-nav a.active { background: rgba(255,255,255,0.1); color: white; }

/* BOUTONS & ACTIONS */
.btn-primary { 
    background: white; color: var(--primary); 
    border: none; padding: 8px 16px; border-radius: 4px; 
    font-weight: 600; cursor: pointer; 
}
.btn-save { background: var(--primary); color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; font-weight: 600; }
.btn-close { background: #ebecf0; color: var(--text-main); border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; }

/* TOOLBAR & RECHERCHE */
.toolbar {
    background: white;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    gap: 15px;
    flex-wrap: wrap;
}
.search-input {
    border: 2px solid var(--border);
    border-radius: 4px;
    padding: 6px 12px;
    width: 250px;
}

/* TABLES & CONTENEURS */
.table-wrap { 
    padding: 10px; 
    overflow-x: auto; /* Défilement horizontal pour les grands tableaux */
    -webkit-overflow-scrolling: touch;
}
table { 
    width: 100%; border-collapse: collapse; background: white; 
    border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
th { background: #fafbfc; text-align: left; padding: 12px; color: var(--text-sec); font-size: 11px; text-transform: uppercase; border-bottom: 2px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.nom-wrap { font-weight: 600; color: var(--primary); }

/* DRAWER (AJOUT JOUEUR) */
.overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(9, 30, 66, 0.5); display: none; z-index: 900; 
}
.overlay.open { display: block; }
.drawer { 
    position: fixed; top: 0; right: -500px; width: 450px; height: 100%; 
    background: white; z-index: 1000; transition: right 0.3s ease;
    display: flex; flex-direction: column; padding: 30px;
}
.drawer.open { right: 0; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; color: var(--text-sec); font-size: 12px; }
.form-group input { width: 100%; padding: 10px; border: 2px solid var(--border); border-radius: 4px; }

/* ============================================================
   RESPONSIVE & MOBILE OPTIMIZATIONS
   ============================================================ */

/* Pour Tablettes et Mobiles */
@media (max-width: 768px) {
    .topbar {
        flex-direction: column;
        padding: 15px 10px;
        text-align: center;
    }
    
    .topbar-left {
        flex-direction: column;
        gap: 15px;
    }

    .topbar h1 {
        font-size: 16px;
    }

    .topbar-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
    }

    .topbar-nav a {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Optimisation des colonnes de données */
    .col-joueur {
        position: sticky;
        left: 0;
        z-index: 10;
        background: white !important; /* Pour ne pas voir les scores passer dessous */
        box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    }

    /* Réduction des marges sur mobile */
    .table-wrap {
        padding: 5px;
        margin: 5px;
    }

    td, th {
        padding: 10px 8px;
        font-size: 12px;
    }
}

/* Pour très petits écrans (Smartphones) */
@media (max-width: 480px) {
    .toolbar {
        padding: 10px;
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        width: 100%;
    }

    .drawer {
        width: 100%;
        right: -100%;
    }

    /* Amélioration de la lisibilité dans les tableaux denses */
    .trous-badge {
        display: block;
        margin-top: 4px;
        width: fit-content;
    }
}
