/* ==========================================================================
   CSS DÉDIÉ : TABLES2.PHP - Les Sanctuaires d'Hyrule (Zelda Multiplications)
   Fichier : css/tables2.css
   École de l'Enfant-Jésus - Morlanwelz
   ========================================================================== */

/* Conteneur principal compact & centré pour tous les écrans */
  .dungeon-page-container {
    width: 100%;
    max-width: 1040px;
    box-sizing: border-box;
    margin: 0 auto 20px auto;
    background: #ffffff;
    border-radius: 20px;
    padding: 16px 18px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    font-family: 'Nunito', sans-serif;
  }

  /* En-tête Donjon Zelda compact */
  .dungeon-header {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 50%, #047857 100%);
    border-radius: 14px;
    padding: 10px 16px;
    color: white;
    text-align: center;
    margin-bottom: 14px;
    box-shadow: 0 4px 14px rgba(6, 78, 59, 0.35);
    border: 3px solid #eab308;
    position: relative;
    overflow: hidden;
  }

  .dungeon-header::before {
    content: "▲";
    position: absolute;
    top: -15px;
    right: 15px;
    font-size: 65px;
    color: rgba(250, 204, 21, 0.08);
    pointer-events: none;
    font-family: 'Cinzel', serif;
  }

  .dungeon-header h2 {
    color: #facc15 !important;
    font-family: 'Cinzel', serif;
    font-size: 19px;
    margin: 0 0 3px 0;
    letter-spacing: 1.2px;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.6);
  }

  .dungeon-header p {
    font-size: 13px;
    margin: 0;
    color: #dcfce7;
  }

  /* Espace de travail principal côte à côte (Configuration à gauche, Combat à droite) */
  .zelda-workspace {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: center;
  }

  /* Colonne Gauche : Configuration (Difficulté & Choix des Tables) */
  .config-side-left {
    flex: 0 0 215px;
    min-width: 195px;
    max-width: 230px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-sizing: border-box;
  }

  .side-config-box {
    background: #0f172a;
    border: 2px solid #0f766e;
    border-radius: 14px;
    padding: 10px 11px;
    box-sizing: border-box;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.5), 0 4px 10px rgba(15, 118, 110, 0.2);
    color: white;
  }

  .side-config-box.diff-box {
    border-color: #0f766e;
  }

  .side-config-box.tables-box {
    border-color: #b45309;
  }

  .side-config-title {
    font-family: 'Cinzel', serif;
    font-size: 12px;
    font-weight: 900;
    color: #facc15;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 4px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }

  .side-config-sub {
    font-size: 10.5px;
    color: #93c5fd;
    text-align: center;
    margin-bottom: 8px;
    line-height: 1.25;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .tables-box .side-config-sub {
    color: #fde047;
  }

  /* 4 Boutons de Difficulté verticaux */
  .diff-vertical-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .diff-choice-btn {
    width: 100%;
    background: #1e293b;
    border: 2px solid #334155;
    color: #cbd5e1;
    padding: 6px 8px;
    border-radius: 9px;
    font-family: 'Fredoka', sans-serif;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
  }

  .diff-choice-btn:hover {
    border-color: #facc15;
    color: white;
    transform: translateY(-1px);
  }

  .diff-choice-btn.active.diff-easy {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    border-color: #4ade80;
    color: white;
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.4);
  }

  .diff-choice-btn.active.diff-normal {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    border-color: #38bdf8;
    color: white;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
  }

  .diff-choice-btn.active.diff-hard {
    background: linear-gradient(135deg, #c2410c 0%, #9a3412 100%);
    border-color: #fb923c;
    color: white;
    box-shadow: 0 0 10px rgba(251, 146, 60, 0.4);
  }

  .diff-choice-btn.active.diff-expert {
    background: linear-gradient(135deg, #7e22ce 0%, #6b21a8 100%);
    border-color: #c084fc;
    color: white;
    box-shadow: 0 0 10px rgba(192, 132, 252, 0.4);
  }

  .diff-main-label {
    font-weight: 800;
  }

  .diff-subtext {
    font-size: 10px;
    opacity: 0.9;
    font-weight: normal;
    text-align: right;
  }

  /* Filtres rapides et grille 3x3 pour les tables */
  .quick-filters-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 8px;
  }

  .quick-filter-btn {
    flex: 1 1 auto;
    background: #1e293b;
    border: 1.5px solid #475569;
    color: #93c5fd;
    padding: 4px 2px;
    border-radius: 10px;
    font-size: 10.5px;
    font-weight: 800;
    cursor: pointer;
    font-family: 'Fredoka', sans-serif;
    transition: all 0.2s ease;
    text-align: center;
  }

  .quick-filter-btn:hover {
    background: #334155;
    border-color: #38bdf8;
    color: white;
  }

  .tables-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }

  .tbl-btn {
    background: #1e293b;
    border: 2px solid #334155;
    color: #cbd5e1;
    padding: 7px 2px;
    border-radius: 8px;
    font-family: 'Fredoka', sans-serif;
    font-size: 11.5px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
  }

  .tbl-btn:hover {
    border-color: #facc15;
    color: #facc15;
  }

  .tbl-btn.active {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    border-color: #facc15;
    color: white;
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.4);
  }

  /* Arène de Combat (Droite) */
  .zelda-battle-area {
    flex: 1 1 650px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  /* Barre des stats de Link (HUD) */
  .hero-status-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #0f172a;
    border: 2px solid #0f766e;
    border-radius: 12px;
    padding: 8px 14px;
    color: white;
    margin-bottom: 12px;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.5), 0 4px 10px rgba(15, 118, 110, 0.2);
  }

  .hud-stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Fredoka', sans-serif;
    font-size: 13px;
    font-weight: 700;
  }

  .hud-nes-icon {
    width: 18px;
    height: 18px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    object-fit: contain;
  }

  .energy-bar-wrap {
    width: 110px;
    height: 10px;
    background: #1e293b;
    border: 1.5px solid #475569;
    border-radius: 6px;
    overflow: hidden;
  }

  .energy-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #10b981 0%, #22c55e 100%);
    transition: width 0.3s ease, background 0.3s ease;
  }

  .energy-bar-fill.warning {
    background: linear-gradient(90deg, #f59e0b 0%, #eab308 100%);
  }

  .energy-bar-fill.danger {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
  }

  /* Bannière d'objectif dynamique */
  .target-banner {
    background: #020617;
    border: 2px solid #eab308;
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5), 0 0 12px rgba(234, 179, 8, 0.2);
  }

  .target-info-col {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .target-avatar-box {
    width: 48px;
    height: 48px;
    background: #0f172a;
    border: 2px solid #facc15;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 8px rgba(250, 204, 21, 0.3);
  }

  .target-nes-sprite {
    width: 38px;
    height: 38px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.7));
  }

  .target-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #94a3b8;
    font-family: 'Cinzel', serif;
  }

  .target-name {
    font-size: 15px;
    font-weight: 800;
    color: white;
    font-family: 'Fredoka', sans-serif;
  }

  .target-number-box {
    text-align: right;
  }

  .target-number-val {
    font-family: 'Cinzel', serif;
    font-size: 28px;
    font-weight: 900;
    color: #facc15;
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.6);
    line-height: 1;
  }

  .target-number-label {
    font-size: 10px;
    color: #cbd5e1;
    font-weight: 700;
  }

  /* Zone principale du Sanctuaire (Grille 5x5 rétrécie + Panneau d'action) */
  .dungeon-main-layout {
    display: grid;
    grid-template-columns: minmax(310px, 385px) minmax(240px, 310px);
    gap: 14px;
    align-items: start;
    justify-content: center;
  }

  /* Grille Sheikah 5x5 compacte */
  .dungeon-grid-container {
    width: 100%;
    max-width: 385px;
    box-sizing: border-box;
    margin: 0 auto;
    background: #090d16;
    border: 3px solid #0f766e;
    border-radius: 14px;
    padding: 9px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.5), inset 0 0 20px rgba(15, 118, 110, 0.35);
  }

  .dungeon-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
  }

  .dungeon-tile {
    aspect-ratio: 1;
    max-height: 66px;
    background: #1e293b;
    border: 2px solid #334155;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: all 0.15s ease;
    box-shadow: 0 3px 5px rgba(0,0,0,0.3);
  }

  .dungeon-tile:hover {
    transform: translateY(-2px);
    border-color: #facc15;
  }

  .dungeon-tile.selected {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
    border-color: #7dd3fc !important;
    transform: scale(1.05);
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.85) !important;
    z-index: 5;
  }

  .dungeon-tile.hero-tile {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    border-color: #4ade80;
    cursor: default;
  }

  .dungeon-tile.monster-tile {
    background: linear-gradient(135deg, #881337 0%, #4c0519 100%);
    border-color: #fb7185;
  }

  .dungeon-tile.monster-tile.active-monster {
    border-color: #facc15;
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.7);
  }

  .dungeon-tile.chest-tile {
    background: linear-gradient(135deg, #78350f 0%, #451a03 100%);
    border-color: #fde047;
  }

  .dungeon-tile.exit-tile {
    background: linear-gradient(135deg, #713f12 0%, #451a03 100%);
    border-color: #a16207;
    cursor: pointer;
  }

  .dungeon-tile.exit-tile.unlocked-triforce {
    background: linear-gradient(135deg, #facc15 0%, #ca8a04 100%) !important;
    border: 3px solid #ffffff !important;
    animation: triforcePulse 1s infinite alternate !important;
    box-shadow: 0 0 20px rgba(250, 204, 21, 0.95), 0 0 35px rgba(255, 255, 255, 0.8) !important;
    z-index: 6;
  }

  @keyframes triforcePulse {
    0% { transform: scale(1); box-shadow: 0 0 12px rgba(250, 204, 21, 0.7); }
    100% { transform: scale(1.08); box-shadow: 0 0 26px rgba(250, 204, 21, 1), 0 0 45px rgba(255, 255, 255, 0.9); }
  }

  .zelda-tile-sprite {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
  }

  .tile-label {
    font-size: 9px;
    color: #e2e8f0;
    font-family: 'Fredoka', sans-serif;
    margin-top: 1px;
  }

  .tile-hp-tag {
    position: absolute;
    bottom: 2px;
    font-size: 9px;
    font-weight: 800;
    background: rgba(0, 0, 0, 0.8);
    padding: 1px 4px;
    border-radius: 4px;
    color: #facc15;
    font-family: 'Fredoka', sans-serif;
  }

  .tile-num {
    font-size: 18px;
    font-family: 'Fredoka', sans-serif;
    color: #f8fafc;
    font-weight: 700;
  }

  /* Panneau d'action Sheikah (Droite) */
  .action-side-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .combo-box {
    background: #020617;
    border: 2px solid #0f766e;
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  }

  .formula-display {
    background: #0f172a;
    border: 2px solid #1e293b;
    border-radius: 8px;
    padding: 6px 8px;
    font-family: 'Fredoka', sans-serif;
    font-size: 15px;
    color: #38bdf8;
    min-height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
  }

  .formula-display strong {
    color: #facc15;
    font-size: 18px;
    margin-left: 4px;
  }

  .btn-attack {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: white;
    border: 2px solid #bbf7d0;
    border-radius: 10px;
    font-weight: 900;
    font-size: 14px;
    cursor: pointer;
    font-family: 'Fredoka', sans-serif;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(22, 163, 74, 0.35);
  }

  .btn-attack:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(22, 163, 74, 0.45);
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  }

  .btn-attack:disabled {
    background: #cbd5e1;
    border-color: #94a3b8;
    color: #64748b;
    cursor: not-allowed;
    box-shadow: none;
  }

  .btn-attack.ready-glow {
    background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%) !important;
    border-color: #fef08a !important;
    color: #1e1b4b !important;
    animation: attackPulse 0.9s infinite alternate;
    font-weight: 900;
  }

  @keyframes attackPulse {
    0% { transform: scale(1); box-shadow: 0 0 10px rgba(234, 179, 8, 0.5); }
    100% { transform: scale(1.04); box-shadow: 0 0 20px rgba(234, 179, 8, 0.9); }
  }

  /* Sacoche Sacrée */
  .spells-inventory {
    background: #f0fdf4;
    border: 2px solid #86efac;
    border-radius: 12px;
    padding: 10px;
  }

  .inventory-title {
    font-family: 'Cinzel', serif;
    font-size: 11px;
    color: #166534;
    text-transform: uppercase;
    font-weight: 900;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .inventory-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .spell-btn {
    background: white;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px 4px;
    font-size: 11px;
    font-weight: 800;
    font-family: 'Fredoka', sans-serif;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }

  .spell-btn:hover:not(:disabled) {
    border-color: #16a34a;
    background: #dcfce7;
    transform: translateY(-1px);
  }

  .spell-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }

  /* Journal d'Aventure Hyrule */
  .adventure-log-box {
    background: #0f172a;
    border: 2px solid #1e293b;
    border-radius: 12px;
    padding: 8px 10px;
    color: #e2e8f0;
    font-size: 11px;
    height: 90px;
    overflow-y: auto;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.5);
  }

  .log-entry {
    margin-bottom: 3px;
    line-height: 1.3;
  }

  .log-entry.success { color: #4ade80; }
  .log-entry.danger { color: #f87171; }
  .log-entry.gold { color: #facc15; }

  /* Boutons de bas de page */
  .footer-action-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
  }

  .util-btn {
    background: #f1f5f9;
    border: 2px solid #cbd5e1;
    color: #334155;
    padding: 6px 12px;
    border-radius: 8px;
    font-family: 'Fredoka', sans-serif;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .util-btn:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
  }

  /* Modales Zelda */
  .zelda-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
  }

  .zelda-modal-overlay.visible {
    display: flex;
  }

  .zelda-modal-card {
    background: #0f172a;
    border: 3px solid #facc15;
    border-radius: 18px;
    width: 90%;
    max-width: 460px;
    padding: 20px;
    text-align: center;
    color: white;
    box-shadow: 0 0 35px rgba(250, 204, 21, 0.4);
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  @keyframes modalPop {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
  }

  .modal-btn {
    background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
    border: 2px solid #fef08a;
    color: #1e1b4b;
    font-family: 'Fredoka', sans-serif;
    font-weight: 900;
    font-size: 14px;
    padding: 9px 20px;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 12px;
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.35);
  }

  .modal-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 16px rgba(234, 179, 8, 0.5);
  }

  @media screen and (max-width: 860px) {
    .zelda-workspace {
      flex-direction: column;
      align-items: stretch;
    }
    .config-side-left {
      flex: 1 1 100%;
      max-width: 100%;
      width: 100%;
      flex-direction: row;
      flex-wrap: wrap;
    }
    .side-config-box {
      flex: 1 1 260px;
    }
    .diff-vertical-list {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 5px;
    }
    .tables-grid {
      grid-template-columns: repeat(3, 1fr);
    }
    .zelda-battle-area {
      width: 100%;
    }
    .dungeon-main-layout {
      grid-template-columns: 1fr;
      justify-items: center;
    }
    .dungeon-grid-container {
      max-width: 380px;
      width: 100%;
    }
    .action-side-panel {
      max-width: 380px;
      width: 100%;
    }
  }

  @media screen and (max-width: 600px) {
    .dungeon-page-container {
      padding: 10px;
    }
    .config-side-left {
      flex-direction: column;
    }
    .side-config-box {
      flex: 1 1 auto;
      width: 100%;
    }
    .diff-vertical-list {
      grid-template-columns: 1fr;
    }
    .tables-grid {
      grid-template-columns: repeat(3, 1fr);
    }
    .hero-status-bar {
      padding: 6px 10px;
      gap: 6px;
    }
    .hud-stat-item {
      font-size: 11px;
    }
    .energy-bar-wrap {
      width: 70px;
    }
    .target-banner {
      padding: 8px 10px;
    }
    .target-avatar-box {
      width: 40px;
      height: 40px;
    }
    .target-nes-sprite {
      width: 30px;
      height: 30px;
    }
    .target-number-val {
      font-size: 24px;
    }
    .dungeon-grid-container {
      max-width: 100%;
      padding: 6px;
    }
    .dungeon-tile {
      max-height: 56px;
    }
    .zelda-tile-sprite {
      width: 26px;
      height: 26px;
    }
    .tile-num {
      font-size: 15px;
    }
  }
