/* ==========================================================================
   CSS DÉDIÉ : TABLES3.PHP - Space Invaders des Multiplications
   Fichier : css/tables3.css
   École de l'Enfant-Jésus - Morlanwelz
   ========================================================================== */

/* Conteneur principal */
  .space-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;
  }

  /* Espace de travail principal côte à côte (Configuration à gauche, Jeu Arcade à droite) */
  .space-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 #1e293b;
    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(0,0,0,0.2);
    color: white;
  }

  .side-config-box.diff-box {
    border-color: #0284c7;
  }

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

  .side-config-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 11.5px;
    font-weight: 900;
    color: #38bdf8;
    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;
    font-family: 'Fredoka', sans-serif;
  }

  .tables-box .side-config-sub {
    color: #bae6fd;
    font-weight: 700;
  }

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

  .speed-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;
  }

  .speed-btn:hover {
    border-color: #38bdf8;
    color: white;
    transform: translateY(-1px);
  }

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

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

  .diff-subtext {
    font-size: 10px;
    opacity: 0.85;
    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-choice-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-choice-btn:hover {
    border-color: #38bdf8;
    color: #38bdf8;
  }

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

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

  /* Barre de Statut Arcade */
  .space-status-bar {
    width: 100%;
    max-width: 600px;
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #0b0f19;
    border: 2px solid #1e293b;
    border-radius: 14px;
    padding: 8px 14px;
    color: white;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.6);
  }

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

  .shields-row {
    display: inline-flex;
    gap: 4px;
    font-size: 16px;
  }

  /* Zone de Jeu Canvas + Contrôles */
  .game-arena-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100%;
  }

  #space-canvas {
    background: #030712;
    border: 4px solid #1e293b;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3), inset 0 0 30px rgba(0,0,0,0.8);
    display: block;
    max-width: 100%;
    width: 600px;
    height: 440px;
    cursor: crosshair;
  }

  /* Panneau de saisie des réponses (Clavier Tactile & Numérique) */
  .laser-control-panel {
    width: 100%;
    max-width: 600px;
    background: #0f172a;
    border: 3px solid #38bdf8;
    border-radius: 16px;
    padding: 10px 12px;
    margin-top: 10px;
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.2);
    box-sizing: border-box;
    text-align: center;
  }

  .laser-formula-display {
    background: #020617;
    border: 2px solid #1e293b;
    border-radius: 12px;
    padding: 6px 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 900;
    color: #38bdf8;
    min-height: 30px;
    text-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
  }

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

  .digit-btn {
    background: #1e293b;
    border: 2px solid #475569;
    border-radius: 10px;
    color: white;
    font-size: 19px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 800;
    padding: 8px 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 3px 0 #0f172a;
    user-select: none;
  }

  .digit-btn:hover {
    background: #334155;
    border-color: #38bdf8;
    transform: translateY(-2px);
  }

  .digit-btn:active, .digit-btn.pressed {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #0f172a;
    background: #0284c7;
  }

  .action-btn-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 8px;
    margin-top: 8px;
  }

  .btn-fire {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: 2px solid #34d399;
    color: white;
    font-weight: 900;
    font-family: 'Fredoka', sans-serif;
    font-size: 15px;
    padding: 9px;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
    transition: all 0.2s ease;
  }

  .btn-fire:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(16, 185, 129, 0.4);
  }

  .btn-clear {
    background: #334155;
    border: 2px solid #475569;
    color: white;
    font-weight: 800;
    font-family: 'Fredoka', sans-serif;
    font-size: 13px;
    padding: 9px;
    border-radius: 10px;
    cursor: pointer;
  }

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

  .footer-btn {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    border: none;
    font-family: 'Fredoka', sans-serif;
    color: white;
    transition: all 0.2s ease;
  }

  .footer-btn:hover {
    transform: translateY(-2px);
  }

  /* Modales */
  .space-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 15px;
    box-sizing: border-box;
  }

  .space-modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .space-modal-card {
    background: #0f172a;
    border-radius: 20px;
    padding: 24px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 3px solid #38bdf8;
    color: white;
    animation: modalPop 0.3s ease;
  }

  @keyframes modalPop {
    from { transform: scale(0.85); }
    to { transform: scale(1); }
  }

  .space-modal-card h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 22px;
    margin: 0 0 10px 0;
    color: #38bdf8;
  }

  .modal-btn {
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    border: none;
    font-family: 'Fredoka', sans-serif;
    color: white;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
    transition: all 0.2s ease;
    margin-top: 15px;
  }

  .modal-btn:hover {
    transform: translateY(-2px);
  }

  /* Responsive Media Queries */
  @media screen and (max-width: 880px) {
    .space-workspace {
      flex-direction: column;
      align-items: center;
    }
    .config-side-left {
      flex: 1 1 100%;
      max-width: 600px;
      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);
    }
    .space-battle-area {
      width: 100%;
    }
  }

  @media screen and (max-width: 640px) {
    .space-page-container {
      padding: 10px;
    }
    .config-side-left {
      flex-direction: column;
      width: 100%;
      max-width: 100%;
    }
    .side-config-box {
      flex: 1 1 auto;
      width: 100%;
    }
    .diff-vertical-list {
      grid-template-columns: 1fr;
    }
    .tables-grid {
      grid-template-columns: repeat(3, 1fr);
    }
    #space-canvas {
      height: 320px;
    }
    .space-status-bar {
      padding: 6px 10px;
      gap: 6px;
    }
    .arcade-stat {
      font-size: 12px;
    }
    .digit-btn {
      font-size: 17px;
      padding: 7px 2px;
    }
  }
