/* Styles de l'accueil — repris de page_gratuit_belote_coinchee_contree.html */
/* ============================================================
   THEME "CLUB" — vert / cartes — clone du style fourni
   ============================================================ */
* { box-sizing: border-box; }

body {
    font-family: Arial, sans-serif;
    background-color: #f0fdf4;
    color: #064e3b;
    margin: 0;
    padding-bottom: 90px;
}

a { text-decoration: none; color: inherit; }

[hidden] { display: none !important; }

.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- HEADER --- */
header {
    background-color: #ffffff;
    width: 100%;
    border-bottom: 2px solid #bbf7d0;
    padding: 15px 0;
}
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.logo { display: flex; align-items: center; font-weight: bold; font-size: 1.2rem; }
.logo img { height: 42px; vertical-align: middle; }

.menu ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 14px; flex-wrap: wrap; }
.menu li { position: relative; }
.menu > ul > li > a { font-size: 0.9rem; font-weight: bold; padding: 4px 2px; display: inline-block; }
.menu > ul > li > a:hover { color: #10b981; }
.menu li ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #ffffff;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 8px;
    min-width: 220px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
    z-index: 50;
    flex-direction: column;
    gap: 2px;
}
.menu li:hover > ul { display: flex; }
.menu li ul li a { font-weight: normal; font-size: 0.85rem; padding: 4px 6px; display: block; border-radius: 4px; }
.menu li ul li a:hover { background: #f0fdf4; color: #10b981; }

.actions-btn {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: bold;
    color: #064e3b;
}
.actions-btn:hover { background-color: #bbf7d0; }

/* --- MOTD --- */
.motd {
    background-color: #ffffff;
    border: 1px solid #000000;
    color: #78350f;
    padding: 6px 10px;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 0.7rem;
    line-height: 1.25;
}
.motd p { margin: 0 0 2px 0; }
.motd p:last-child { margin-bottom: 0; }

/* --- PUB --- */
.pub-zone {
    margin-top: 14px;
    text-align: center;
}
.pub-label { font-size: 0.7rem; font-style: italic; color: #166534; margin-bottom: 4px; }
.pub-clip { overflow: hidden; }
/* Pas de max-height : elle servait à contrer l'ancienne "auto ad size" non-responsive
   de Google (92px demandé -> jusqu'à 280px imposé en inline !important). Avec
   data-ad-format="auto" + data-full-width-responsive déclarés, la hauteur retournée
   est légitimement variable selon la largeur réelle du conteneur — la rogner risquerait
   de couper une pub par ailleurs correctement servie (contraire aux règles Adsense).
   Placée en bas de page, après les boutons "Jouer" (cf. plus bas, en dehors de
   #layout-pc et #layout-smartphone pour n'exister qu'une seule fois) : une pub plus
   haute que prévu ne repousse plus que le pied de page (PC) ou rien du tout
   (smartphone, pas de pied de page) — jamais le contenu principal.
   Volontairement pas de largeur/masquage manuel ici (contrairement à l'ancien
   skyscraper vertical, supprimé) : l'annonce étant "data-full-width-responsive", elle
   suit d'elle-même la largeur de .container à toutes les tailles d'écran, y compris
   mobile — jamais masquée par nos propres breakpoints, juste plus petite. */

/* --- JAUGE D'OCCUPATION --- */
.occupancy-section {
    background-color: #ffffff;
    border: 1px solid #bbf7d0;
    padding: 8px 10px;
    border-radius: 8px;
    margin-top: 10px;
}
.occupancy-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 0.7rem;
    font-weight: bold;
}
progress#jauge-charge {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    border: none;
}
progress#jauge-charge::-webkit-progress-bar { background-color: #e2e8f0; border-radius: 3px; }
progress#jauge-charge::-webkit-progress-value { background-color: #10b981; border-radius: 3px; }
progress#jauge-charge::-moz-progress-bar { background-color: #10b981; border-radius: 3px; }

/* --- MAIN & FORMULAIRE --- */
main { padding: 40px 0; text-align: center; }

.pseudo-section {
    background-color: #ffffff;
    border: 1px solid #bbf7d0;
    padding: 24px;
    border-radius: 12px;
    max-width: 400px;
    margin: 0 auto 35px auto;
}
.pseudo-section label { display: block; font-size: 0.8rem; font-weight: bold; margin-bottom: 10px; text-transform: uppercase; }
.pseudo-section input {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #bbf7d0;
    font-size: 1rem;
    text-align: center;
}

/* --- GRILLE DES CARTES --- */
.section-title { font-size: 0.8rem; text-transform: uppercase; margin-bottom: 20px; color: #166534; }
.mode-desc { font-size: 0.85rem; color: #166534; margin: 0 0 16px 0; }
.grid-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
    margin-bottom: 30px;
}

.card {
    background-color: #ffffff;
    border: 1px solid #bbf7d0;
    padding: 20px;
    border-radius: 12px;
    text-align: left;
    width: 48%;
    min-height: 150px;
    position: relative;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 20px rgba(6, 78, 59, 0.15);
    border-color: #10b981;
}
.card-tag { font-size: 0.7rem; font-weight: bold; color: #10b981; text-transform: uppercase; }
.card-tag.compete { color: #d97706; }
.card h3 { font-size: 1.1rem; margin: 5px 0; }
.card p { font-size: 0.8rem; color: #166534; line-height: 1.4; margin: 0 0 12px 0; }
.card-symbol { position: absolute; top: 16px; right: 18px; font-size: 1.5rem; opacity: 0.4; }

.card-btn {
    background-color: #10b981;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
}
.card-btn:hover { background-color: #059669; }
.card-btn:disabled { background-color: #a7f3d0; cursor: not-allowed; }

/* --- Sous-page (règles/scores/messages) chargée en AJAX --- */
.panel-sous-page {
    background-color: #ffffff;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 20px;
    text-align: left;
    margin-bottom: 30px;
}
.panel-sous-page a { color: #10b981; font-weight: bold; }
.panel-sous-page a:hover { color: #059669; }

/* --- Modale "Info" : remplace l'alert() natif bloquant (voir afficheModaleInfo()
     plus bas), même technologie que la modale "Fin de donne" de la page de jeu
     (page_jeu_gratuit_belote_coinchee_contree.html). Réutilise .panel-sous-page pour
     le fond/la bordure (mode sombre déjà couvert) et .card-btn pour le bouton. --- */
.modale-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    z-index: 10000;
}
.modale-panel {
    max-width: 420px;
    width: 100%;
    text-align: center;
    margin-bottom: 0;
}
.modale-texte {
    font-size: 105%;
    line-height: 1.4;
    margin-bottom: 14px;
    white-space: pre-line;
}
.modale-bouton { margin-top: 4px; width: 160px; }
.souspage-corps { color: #064e3b; line-height: 1.5; overflow-wrap: break-word; }
.souspage-corps table { border-collapse: collapse; margin: 10px 0; }
.souspage-corps td { padding: 4px 8px; }

/* --- Tableau d'Honneur (scores) : classes générées par toolsSousPages.php,
     jusqu'ici stylées uniquement dans l'ancien style.css (thème gris, non chargé
     ici) — sans ces règles le tableau s'affichait sans bordures ni couleurs et
     sa largeur fixe héritée (870px) débordait du panneau. */
.souspage-corps .stefyTexteCentralPageAccueil { width: 100%; }
.souspage-corps .tableau-honneur-layout { width: 100%; table-layout: fixed; }
.souspage-corps .tableau-honneur-colonne { vertical-align: top; padding: 0 8px; width: 50%; }
/* En dessous de ~820px, les deux colonnes (Simple / Coinchée) ne tiennent plus
   côte à côte sans déborder : on les empile, chacune restant scrollable en X si
   un jour un tableau individuel reste malgré tout trop large (petit phone). */
@media (max-width: 820px) {
    .souspage-corps .tableau-honneur-layout,
    .souspage-corps .tableau-honneur-layout tbody,
    .souspage-corps .tableau-honneur-layout > tbody > tr,
    .souspage-corps .tableau-honneur-colonne {
        display: block;
        width: 100%;
    }
    .souspage-corps .tableau-honneur-colonne { padding: 0; margin-bottom: 20px; }
}
/* display:block + overflow-x:auto sur la table elle-même : technique standard pour
   un tableau scrollable en X en secours sur très petit écran (le navigateur génère
   une table anonyme autour des tr/td pour préserver la grille interne). */
.souspage-corps .stefyTableAvecBord {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    border: 1px solid #bbf7d0;
    margin: 6px 0 16px 0;
    overflow-x: auto;
    display: block;
}
/* Largeurs fixes par colonne (N. / Nom / Dn / Pts / Durée / Heure / Sol., toujours
   dans cet ordre, cf. afficheUnTableauDhonneur() dans toolsSousPages.php) : sans ça,
   la colonne "Nom" s'élargissait selon son contenu (auto-layout) et repoussait
   "Heure"/"Sol." hors du cadre visible à droite. */
.souspage-corps .stefyTableAvecBord td {
    border: 1px solid #bbf7d0;
    padding: 3px 4px;
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.souspage-corps .stefyTableAvecBord td:nth-child(1) { width: 8%; }
.souspage-corps .stefyTableAvecBord td:nth-child(2) { width: 26%; white-space: normal; }
.souspage-corps .stefyTableAvecBord td:nth-child(3) { width: 9%; }
.souspage-corps .stefyTableAvecBord td:nth-child(4) { width: 13%; }
.souspage-corps .stefyTableAvecBord td:nth-child(5) { width: 17%; }
.souspage-corps .stefyTableAvecBord td:nth-child(6) { width: 15%; }
.souspage-corps .stefyTableAvecBord td:nth-child(7) { width: 12%; }
/* Tableaux d'honneur : en display:block, la table anonyme interne prenait la largeur
   de son contenu (les % ci-dessus ne s'appliquaient pas) et la colonne "Sol." était
   coupée à droite. En vraie table à 100 % + table-layout:fixed, les 7 colonnes
   (total 100 %) tiennent exactement dans la largeur disponible. */
.souspage-corps .tableau-honneur-colonne .stefyTableAvecBord {
    display: table;
    overflow: visible;
}
.souspage-corps .stefyTDtableauHonneurLigneEntetes {
    background: #10b981;
    color: #ffffff;
    font-weight: bold;
    text-align: center;
}
.souspage-corps .stefyTDtableauHonneurSimple,
.souspage-corps .stefyTDtableauHonneurCoinchee {
    background: #064e3b;
    color: #ffffff;
    font-weight: bold;
    font-size: 1.05rem;
    text-align: center;
    padding: 8px 0;
    border-radius: 8px;
}
.souspage-corps .stefyTRTableauHonneurLignePaire td { background: #f0fdf4; }
.souspage-corps .stefyTRTableauHonneurLigneImpaire td { background: #ffffff; }
.souspage-corps .stefyTRTableauHonneurLigneVictoire td {
    background: #fde68a;
    color: #78350f;
    font-weight: bold;
}
.souspage-corps .stefyLienAfficheJeuRecord { color: #10b981; font-weight: bold; text-decoration: underline; }
.souspage-corps .stefyLienAfficheJeuRecord:hover { color: #059669; }
.souspage-corps .stefyTexteSymbolePetiteCarteRouge { color: #dc2626; font-size: 1.2rem; }
.souspage-corps .stefyTexteSymbolePetiteCarteNoire { color: #022c22; font-size: 1.2rem; }

body.dark-theme .souspage-corps .stefyTableAvecBord,
body.dark-theme .souspage-corps .stefyTableAvecBord td { border-color: #065f46; }
body.dark-theme .souspage-corps .stefyTRTableauHonneurLignePaire td { background: #032f27; }
body.dark-theme .souspage-corps .stefyTRTableauHonneurLigneImpaire td { background: #111827; }
body.dark-theme .souspage-corps .stefyTDtableauHonneurSimple,
body.dark-theme .souspage-corps .stefyTDtableauHonneurCoinchee { background: #022c22; border: 1px solid #065f46; }
body.dark-theme .souspage-corps .stefyTRTableauHonneurLigneVictoire td { background: #92400e; color: #fde68a; }
body.dark-theme .souspage-corps .stefyTexteSymbolePetiteCarteNoire { color: #f0fdf4; }


/* --- SATURATION / MAINTENANCE --- */
.info-card {
    background-color: #ffffff;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    color: #78350f;
    font-size: 0.9rem;
}
.maintenance-card {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 24px;
    color: #7f1d1d;
}
.maintenance-card h3 { margin-top: 0; }
.maintenance-card a { color: #b91c1c; font-weight: bold; text-decoration: underline; }

footer { text-align: center; margin-top: 40px; font-size: 0.75rem; opacity: 0.7; }

/* --- BOUTON FLOTTANT BASCULE TERMINAL --- */
.controls-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    background: #111827;
    padding: 8px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.btn-panel {
    background: #ffffff;
    color: #111827;
    border: none;
    padding: 8px 14px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.75rem;
    cursor: pointer;
}

/* --- LAYOUT SMARTPHONE : colonne unique --- */
#layout-smartphone .card { width: 100%; }
#layout-smartphone main { padding: 24px 0; }

@media (max-width: 650px) {
    .header-content { flex-direction: column; gap: 10px; text-align: center; }
    .card { width: 100%; }
}

/* --- ACTIONS HEADER --- */
/* flex-wrap : 3 boutons (Mode Sombre / Scores / Version PC) sur le layout smartphone,
   ne tiennent pas forcément sur une seule ligne sur un écran étroit — repli sur 2 lignes
   plutôt que de déborder/tronquer (cf. débordement de la ligne de 8 cartes déjà corrigé
   ailleurs sur cette même page de jeu). */
.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* ============================================================
   MODE SOMBRE
   ============================================================ */
body.dark-theme {
    background-color: #022c22;
    color: #f0fdf4;
}
body.dark-theme header {
    background-color: #111827;
    border-bottom-color: #065f46;
}
body.dark-theme .menu li ul {
    background: #111827;
    border-color: #065f46;
}
body.dark-theme .menu li ul li a:hover {
    background: #022c22;
}
body.dark-theme .actions-btn {
    background-color: #032f27;
    border-color: #065f46;
    color: #ffffff;
}
body.dark-theme .actions-btn:hover {
    background-color: #065f46;
}
body.dark-theme .motd {
    background-color: #3b2314;
    border-color: #78350f;
    color: #fde68a;
}
body.dark-theme .occupancy-section,
body.dark-theme .pseudo-section,
body.dark-theme .card,
body.dark-theme .info-card,
body.dark-theme .panel-sous-page {
    background-color: #111827;
    border-color: #065f46;
}
body.dark-theme .card:hover {
    border-color: #10b981;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}
body.dark-theme .occupancy-header,
body.dark-theme .card p,
body.dark-theme .mode-desc,
body.dark-theme .section-title,
body.dark-theme .pub-label,
body.dark-theme .souspage-corps {
    color: #a7f3d0;
}
body.dark-theme .pseudo-section input {
    background-color: #032f27;
    border-color: #065f46;
    color: #ffffff;
}
body.dark-theme progress#jauge-charge::-webkit-progress-bar { background-color: #032f27; }
body.dark-theme progress#jauge-charge::-moz-progress-bar   { background-color: #032f27; }
body.dark-theme .maintenance-card {
    background-color: #3b1414;
    border-color: #7f1d1d;
    color: #fecaca;
}
body.dark-theme footer { color: #a7f3d0; }
