/* === GLOBALE : Correction Box Sizing === */
*, *::before, *::after {
  box-sizing: border-box;
}

/* === Base et Reset === */
html {
  height: 100%;
  background-color: #0a0402;
  background-image: url('menu_bg.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

body {
  height: 100%;
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  color: #f5deb3;
  background: transparent;
  overflow: hidden;
  scrollbar-width: thin;
  scrollbar-color: #a67c33 #1a1007;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(6, 3, 1, 0.72);
  pointer-events: none;
  z-index: -1;
}

/* === FILIGRANE LOGO GUILDE === */
body::after {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 420px;
  height: 420px;
  background-image: url('images/logoguilde.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.05;
  pointer-events: none;
  z-index: -1;
}

/* === ANIMATION FADE IN === */
.fade-in {
  animation: fadeIn 1s ease-out forwards;
  opacity: 0;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; visibility: hidden; } }

/* === SCROLLBARS === */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #1a1007; border-left: 1px solid #5c4025; }
::-webkit-scrollbar-thumb { background: #a67c33; border-radius: 4px; border: 1px solid #1a1007; }
::-webkit-scrollbar-thumb:hover { background: #f3c44f; }

/* === BOUTONS ÉPIQUES === */
.epic-btn {
  background: linear-gradient(to bottom, #d4a23b, #8b6e3b);
  color: #1a1007;
  font-weight: bold;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid #f3c44f;
  text-transform: uppercase;
  box-shadow: 0 0 10px rgba(212, 162, 59, 0.3);
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}
.epic-btn:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
  box-shadow: 0 0 20px rgba(212, 162, 59, 0.6);
}

/* === TIMER TEMPÊTE === */
#storm-timer {
  position: absolute;
  top: 115px; /* Positionné SOUS le sélecteur */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 12, 4, 0.9);
  border: 1px solid #a67c33;
  border-radius: 20px;
  padding: 5px 20px;
  color: #f3c44f;
  font-size: 13px;
  font-weight: bold;
  z-index: 1500;
  display: none; 
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  white-space: nowrap;
}
#storm-timer.visible { display: flex; }
.timer-icon { font-size: 16px; }

/* === ACCUEIL === */
#intro-screen {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(26, 16, 7, 0.98);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  z-index: 9999;
}
#intro-screen > img { width: 100%; max-width: 1600px; border: none; border-radius: 0; box-shadow: 0 8px 60px rgba(0,0,0,0.9); margin-bottom: 50px; display: block; }
#intro-content { text-align: center; }

#enterButton {
  width: min(300px, 35vw);
  cursor: pointer;
  display: block;
  mix-blend-mode: screen;
  transition: transform 0.3s ease, filter 0.3s ease;
}
#enterButton:hover { transform: scale(1.06); filter: brightness(1.4); }

/* === CONNEXION === */
@keyframes floatIn {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 20px)); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

#loginBox {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 320px; padding: 40px;
  background: rgba(12, 7, 2, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(166, 124, 51, 0.6);
  border-radius: 8px;
  box-shadow: 0 8px 60px rgba(0,0,0,0.8), 0 0 0 1px rgba(166,124,51,0.1);
  text-align: center; z-index: 100;
  animation: floatIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
#loginBox h2 { color: #f3c44f; margin: 0 0 30px; text-transform: uppercase; letter-spacing: 2px; border-bottom: 1px solid #5c4025; padding-bottom: 15px; }
#loginBox input {
  width: 100%; padding: 12px; margin-bottom: 20px;
  background: #2b1d0e; border: 1px solid #5c4025; color: #f3c44f; border-radius: 4px;
}
#loginBox button {
  width: 100%; padding: 12px; margin-top: 10px;
  background: linear-gradient(to bottom, #d4a23b, #a67c33); border: none; border-radius: 4px;
  color: #1a1007; font-weight: bold; text-transform: uppercase; cursor: pointer;
  box-shadow: 0 0 10px rgba(212, 162, 59, 0.3); transition: all 0.2s;
}
#loginBox button:hover { transform: scale(1.05); box-shadow: 0 0 20px rgba(212, 162, 59, 0.5); filter: brightness(1.15); }
.login-error { margin-top: 20px; color: #ff6b6b; min-height: 20px; font-size: 14px; }
#loginBox a { color: #a67c33; text-decoration: none; font-size: 13px; }
#loginBox a:hover { color: #f3c44f; text-decoration: underline; }

/* === HEADER === */
header {
  position: absolute; top: 0; width: 100%; height: 50px;
  display: flex; justify-content: center; align-items: center;
  background: rgba(0, 0, 0, 0.85); color: #e8c97a;
  box-shadow: 0 2px 15px rgba(0,0,0,0.7); z-index: 2000; border-bottom: 1px solid #5c4025;
}
.title { font-weight: bold; font-size: 18px; letter-spacing: 2px; text-transform: uppercase; }
#user-info { position: absolute; left: 20px; font-size: 14px; color: #d4a23b; }

/* Conteneur pour aligner les boutons à droite */
.header-controls {
    position: absolute;
    right: 20px;
    display: flex; 
    gap: 10px; 
    align-items: center;
}

/* Style des boutons du header (Menu & Déco) */
.disconnect {
  background: linear-gradient(to bottom, #a67c33, #6b4a25);
  border: 1px solid #d4a23b; border-radius: 4px; padding: 6px 15px;
  cursor: pointer; font-weight: bold; color: #1a1007; font-size: 12px; text-transform: uppercase;
  box-shadow: 0 0 8px rgba(212, 162, 59, 0.3); transition: all 0.2s;
  text-decoration: none; /* Important pour les liens */
  display: flex; align-items: center; justify-content: center;
}
.disconnect:hover { transform: scale(1.05); filter: brightness(1.2); box-shadow: 0 0 15px rgba(212, 162, 59, 0.5); }

/* === WIDGET COMPTE JOUEUR === */
.user-account-widget {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: #cda434;
  padding: 4px 10px 4px 4px;
  border: 1px solid transparent; border-radius: 20px;
  transition: border-color 0.2s, background 0.2s;
}
.user-account-widget:hover { border-color: #cda434; background: rgba(205,164,52,0.08); }
.ua-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1em; font-weight: bold; color: #fff;
  flex-shrink: 0; text-transform: uppercase; overflow: hidden;
}
.ua-pseudo { font-size: 0.85em; font-weight: bold; letter-spacing: 0.5px; white-space: nowrap; }
@media(max-width: 480px) { .ua-pseudo { display: none; } }

/* === CARTE & NAVIGATION === */

/* Sélecteur de carte (Hagga / Deep Desert) */
#map-switcher {
  position: absolute; 
  top: 65px; 
  left: 50%; 
  transform: translateX(-50%);
  z-index: 1500; 
  display: flex; 
  gap: 10px;
  background: rgba(20, 12, 4, 0.95); 
  padding: 8px 15px;
  border-radius: 25px; 
  border: 1px solid #5c4025; 
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.map-switch-btn {
  background: transparent; 
  border: 1px solid transparent; 
  color: #a67c33;
  padding: 6px 15px; 
  border-radius: 20px; 
  cursor: pointer; 
  font-weight: bold;
  transition: all 0.3s; 
  text-transform: uppercase; 
  font-size: 12px;
  text-decoration: none;
  display: flex; 
  align-items: center; 
  justify-content: center; 
  line-height: 1;
}

.map-switch-btn:hover { 
  color: #f3c44f; 
  background: rgba(243, 196, 79, 0.1); 
}

.map-switch-btn.active { 
  background: linear-gradient(to bottom, #f3c44f, #a67c33); 
  color: #1a1007; 
  box-shadow: 0 0 10px rgba(243, 196, 79, 0.4); 
}

/* Conteneur de la carte */
#map-container {
  display: flex; 
  justify-content: center; 
  align-items: center;
  width: 100%; 
  height: 100vh; 
  padding-top: 50px; 
  box-sizing: border-box;
  background: transparent; 
}

#map {
  width: 98%; 
  height: 92%; 
  border: 2px solid #a67c33; 
  border-radius: 8px;
  box-shadow: 0 0 50px rgba(0,0,0,0.8); 
  background: rgba(26, 16, 7, 0.6);
}

/* === ADMIN PANEL === */
.admin-panel {
  position: absolute; top: 130px; right: 20px; width: 320px;
  max-height: calc(100vh - 150px); overflow-y: auto;
  background: rgba(20, 12, 4, 0.95); border: 2px solid #a67c33; border-radius: 10px;
  padding: 15px; box-shadow: 0 0 20px rgba(0,0,0,0.8); z-index: 1000; color: #f5deb3;
}
.admin-panel h3 { margin: 0 0 15px 0; text-align: center; color: #f3c44f; font-size: 16px; border-bottom: 1px solid #5c4025; padding-bottom: 8px; text-transform: uppercase; }
.admin-row { margin-bottom: 12px; }

.admin-panel input, .admin-panel select {
  width: 100%; padding: 8px; background: #3a2615; border: 1px solid #5c4025;
  color: #f5deb3; border-radius: 4px;
}
.admin-panel button {
  width: 100%; padding: 10px; margin-top: 5px;
  background: linear-gradient(to bottom, #d4a23b, #a67c33); border: none; border-radius: 4px;
  cursor: pointer; font-weight: bold; color: #1a1007; text-transform: uppercase; font-size: 12px;
  box-shadow: 0 0 8px rgba(212, 162, 59, 0.3); transition: all 0.2s;
}
.admin-panel button:hover { transform: scale(1.05); filter: brightness(1.1); box-shadow: 0 0 15px rgba(212, 162, 59, 0.5); }

/* === USER LIST === */
.user-row { background: rgba(255,255,255,0.05); margin-bottom: 5px; border-radius: 4px; padding: 8px; border: 1px solid rgba(166, 124, 51, 0.2); }
.small-btn { font-size: 10px !important; padding: 5px !important; margin-top: 2px !important; height: auto; text-transform: none !important; }

/* === PLAYER LIST (PANNEAU GAUCHE) === */
#player-panel {
  position: absolute; top: 130px; left: 20px; width: 220px;
  max-height: calc(100vh - 150px); overflow-y: auto;
  background: rgba(20, 12, 4, 0.9); border: 2px solid #a67c33; border-radius: 10px;
  padding: 10px; display: none; z-index: 1000;
}
#player-panel.visible { display: block; }
#player-panel h3 { font-size: 14px; color: #d4a23b; text-align: center; margin-top: 0; text-transform: uppercase; border-bottom: 1px solid #5c4025; padding-bottom: 5px; }

/* Catégories */
.category-header {
  color: #d4a23b;
  font-weight: bold;
  font-size: 12px;
  text-transform: uppercase;
  margin-top: 15px;
  margin-bottom: 5px;
  border-bottom: 1px solid #5c4025;
  padding-bottom: 2px;
}
.category-header:first-child { margin-top: 0; }

.player-item { padding: 6px; cursor: pointer; border-radius: 4px; border-bottom: 1px solid #3b2a16; font-size: 13px; }
.player-item:hover { background: rgba(243, 196, 79, 0.2); color: #fff; }

/* === TOGGLE BTN === */
.toggle-players {
  position: absolute; bottom: 30px; left: 30px; width: 50px; height: 50px;
  border-radius: 50%; background: linear-gradient(to bottom, #f3c44f, #a67c33);
  border: 2px solid #d4a23b; cursor: pointer; box-shadow: 0 0 20px rgba(243, 196, 79, 0.4);
  z-index: 1200; display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s;
}
.toggle-players:hover { transform: scale(1.1); }

/* === LEAFLET CUSTOM (POPUP) === */
.leaflet-popup-content-wrapper {
  background: rgba(20, 12, 4, 0.95) !important;
  border: 1px solid #a67c33 !important;
  color: #f5deb3 !important;
  border-radius: 6px !important;
  box-shadow: 0 0 15px rgba(0,0,0,0.8) !important;
  min-width: 280px; 
}
.leaflet-popup-tip {
  background: rgba(20, 12, 4, 0.95) !important;
  border: none !important; 
}
.leaflet-popup-close-button {
  color: #f3c44f !important;
  font-size: 18px !important;
}
.leaflet-popup-close-button:hover { color: #fff !important; }

/* Bouton Supprimer Rouge */
.delete-btn {
  width: 100%; padding: 6px 10px; margin-top: 8px;
  background: linear-gradient(to bottom, #a83b3b, #6b1d1d);
  color: #fff; border: 1px solid #ff6b6b; border-radius: 4px;
  cursor: pointer; font-weight: bold; text-transform: uppercase; font-size: 11px;
  box-shadow: 0 0 5px rgba(168, 59, 59, 0.4); transition: all 0.2s;
}
.delete-btn:hover { background: linear-gradient(to bottom, #c94545, #8f2828); transform: scale(1.05); box-shadow: 0 0 10px rgba(168, 59, 59, 0.6); }

/* === TOOLTIP CARTE (Style Amélioré - Option 1) === */

.base-tooltip {
  background-color: rgba(18, 12, 8, 0.98) !important; /* Fond très sombre, presque noir */
  border: 1px solid #d4a23b !important; /* Bordure dorée */
  border-radius: 6px !important;
  box-shadow: 0 5px 15px rgba(0,0,0,0.9) !important; /* Grosse ombre pour le relief */
  font-family: 'Segoe UI', sans-serif;
  text-align: center;
  padding: 8px 12px !important; /* Un peu plus d'espace */
  min-width: 150px;
}

/* Les flèches du tooltip (toutes directions) */
.leaflet-tooltip-top.base-tooltip::before { border-top-color: #d4a23b !important; }
.leaflet-tooltip-bottom.base-tooltip::before { border-bottom-color: #d4a23b !important; }
.leaflet-tooltip-left.base-tooltip::before { border-left-color: #d4a23b !important; }
.leaflet-tooltip-right.base-tooltip::before { border-right-color: #d4a23b !important; }

/* CIBLAGE DU TITRE (Le premier div généré par le JS) */
.base-tooltip div:first-child {
    color: #f3c44f;         /* Or Vif et lumineux */
    font-weight: 800;       /* Très gras */
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 1px;    
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(243, 196, 79, 0.3); /* Petite ligne de séparation */
    text-shadow: 0 0 10px rgba(243, 196, 79, 0.4); 
}

/* CIBLAGE DE LA NOTE (Le texte en dessous) */
.tooltip-subtext {
  font-size: 12px;
  color: #e6e0d0;           /* BEIGE CLAIR (Os/Sable) pour la lisibilité */
  display: block;
  font-weight: normal;
  font-style: italic;
  line-height: 1.4;         
  max-width: 220px;
  white-space: normal;
  text-shadow: none;        
}

/* NOTE POPUP (Celui de la boîte de dialogue, on ne change pas trop) */
.base-note {
  font-size: 0.9em;
  color: #e8c97a; 
  display: block;
  margin-top: 3px;
  font-style: italic;
  width: 100%;
  white-space: normal; 
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.editable-note {
  cursor: pointer;
  text-decoration: none; 
  transition: all 0.2s;
}

.editable-note:hover {
  color: #f3c44f;
  text-shadow: 0 0 5px rgba(243, 196, 79, 0.5);
}

.base-note-add {
  font-size: 0.8em;
  color: #888;
  cursor: pointer;
  display: block;
  margin-top: 3px;
}
.base-note-add:hover { color: #f3c44f; }

/* === FIX AUTOFILL === */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #2b1d0e inset !important;
    -webkit-text-fill-color: #f3c44f !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* === RESPONSIVE — Tablette (≤ 768px) === */
@media (max-width: 768px) {
  #loginBox { width: min(320px, 90vw); padding: 30px 20px; }
  .header-controls { gap: 6px; }
  .disconnect { padding: 5px 10px; font-size: 11px; }
  .admin-panel { width: min(300px, calc(100vw - 40px)); }
  .menu-card { width: min(400px, calc(50vw - 30px)); }
  .cards-wrapper { gap: 20px; }
}

/* === RESPONSIVE — Mobile (≤ 600px) === */
@media (max-width: 600px) {
  #user-info { display: none; }
  header { height: 45px; }
  .title { font-size: 13px; letter-spacing: 1px; }
  .header-controls { right: 10px; gap: 5px; }
  .disconnect { padding: 4px 8px; font-size: 10px; letter-spacing: 0; }
  #loginBox { width: 90vw; padding: 25px 15px; }
  #map-switcher { top: 52px; width: 90%; justify-content: center; }
  .map-switch-btn { font-size: 10px; padding: 4px 8px; }
  .admin-panel { top: 105px; width: calc(100vw - 30px); right: 10px; max-width: 300px; }
  #player-panel { top: 105px; left: 10px; width: min(200px, calc(50vw - 20px)); }
  #storm-timer { top: 95px; right: 10px; font-size: 11px; padding: 5px 10px; }
  #intro-screen > img { width: 100%; }
  .toggle-players { bottom: 15px; left: 15px; width: 44px; height: 44px; }
  .menu-card { width: min(380px, 90vw); }
  .cards-wrapper { gap: 15px; padding: 0 15px; }
  .card-image { height: 160px; }
  .card-title { font-size: 15px; }
}

/* === PAGE MENU PRINCIPAL === */
.menu-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
}

.menu-container {
    text-align: center;
    width: 90%;
    max-width: 1000px;
}

.menu-title {
    color: #f3c44f;
    font-size: 24px;
    letter-spacing: 4px;
    margin-bottom: 40px;
    text-shadow: 0 0 20px rgba(243, 196, 79, 0.3);
    border-bottom: 2px solid #5c4025;
    padding-bottom: 10px;
    display: inline-block;
}

.cards-wrapper {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap; 
}

/* La Carte (Lien) */
.menu-card {
    display: block;
    width: 400px; 
    background: rgba(20, 12, 4, 0.85);
    border: 2px solid #5c4025;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    position: relative;
}

.menu-card:hover {
    transform: translateY(-5px);
    border-color: #f3c44f;
    box-shadow: 0 15px 40px rgba(212, 162, 59, 0.2);
}

/* Image dans la carte - FIXE LES PROPORTIONS */
.card-image {
    width: 100%;
    height: 220px; 
    overflow: hidden; 
    border-bottom: 1px solid #5c4025;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    object-position: center; 
    display: block;
    filter: sepia(0.3) brightness(0.8); 
    transition: transform 0.5s, filter 0.3s; 
}

/* Zoom léger au survol */
.menu-card:hover .card-image img {
    filter: sepia(0) brightness(1.1); 
    transform: scale(1.1); 
}

/* Textes */
.card-title {
    color: #d4a23b;
    font-size: 18px;
    font-weight: bold;
    padding: 15px 0 5px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.card-desc {
    color: #aaa;
    font-size: 12px;
    padding: 0 20px 20px 20px;
    font-style: italic;
}

/* Bouton Déco Menu (Style Épique comme le Login) */
.disconnect-btn-menu {
    margin-top: 50px;
    padding: 12px 35px; /* Un peu plus large pour l'impact */
    
    /* État de base : Sombre avec bordure dorée */
    background: rgba(20, 12, 4, 0.9); 
    border: 2px solid #d4a23b;       
    color: #d4a23b;                  
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
    
    /* Transition fluide pour tous les effets */
    transition: all 0.2s ease-in-out;
    box-shadow: 0 0 10px rgba(212, 162, 59, 0.1);
}

/* État au survol : Il s'allume et zoome */
.disconnect-btn-menu:hover {
    /* Passe en fond plein doré dégradé */
    background: linear-gradient(to bottom, #d4a23b, #a67c33);
    color: #1a1007; /* Texte sombre pour le contraste */
    border-color: #f3c44f; /* Bordure plus brillante */
    
    /* Les effets demandés : Zoom + Glow + Surbrillance */
    transform: scale(1.05); 
    box-shadow: 0 0 25px rgba(212, 162, 59, 0.6);
    filter: brightness(1.1);
}

/* === ICÔNES DU MENU (Version Brillante) === */

.menu-icon {
    /* Pas de taille fixe, on utilise le 48x48 natif du PNG */
    vertical-align: middle;
    
    /* ÉTAT DE BASE : Ombre sombre pour le volume */
    /* drop-shadow(décalageX décalageY flou couleur) */
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.9));
    
    /* IMPORTANT : On anime le filtre et la transformation pour que la transition soit fluide */
    transition: filter 0.4s ease-out, transform 0.4s ease-out;
}

/* Ajustement du conteneur titre */
.card-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    /* On s'assure que le halo lumineux ne soit pas coupé s'il dépasse un peu */
    overflow: visible; 
}

/* ÉTAT AU SURVOL : L'activation ! */
.menu-card:hover .menu-icon {
    /* 1. L'EFFET BRILLANT (Glow) */
    /* On remplace l'ombre noire par une ombre dorée intense et centrée (0 0) */
    /* On ajoute brightness(1.2) pour éclairer l'image elle-même */
    filter: drop-shadow(0 0 15px rgba(243, 196, 79, 0.9)) drop-shadow(0 0 30px rgba(243, 196, 79, 0.4)) brightness(1.2);
    
    /* 2. LE MOUVEMENT (Rotation et léger agrandissement) */
    transform: rotate(-8deg) scale(1.15);
}