/* ==========================================================================
   CSS DÉDIÉ : ROBOT.PHP - Mission Robot & Algorithmique
   Fichier : css/robot.css
   École de l'Enfant-Jésus - Morlanwelz
   ========================================================================== */

/* Style spécifique au Robot-Labyrinthe */
  .robot-container {
    max-width: 1050px;
    margin: 0 auto 30px auto;
    background: #ffffff;
    border-radius: 24px;
    padding: 25px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    border: 3px solid #8c52ff;
  }

  /* Sélecteur des 2 modes de jeu */
  .mode-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
  }

  .mode-btn {
    padding: 12px 22px;
    border-radius: 20px;
    border: 3px solid #cbd5e1;
    background-color: #f8fafc;
    color: #475569;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Fredoka', 'Segoe UI', sans-serif;
  }

  .mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  }

  .mode-btn.active-mode1 {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border-color: #1e40af;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.4);
  }

  .mode-btn.active-mode2 {
    background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
    color: white;
    border-color: #6b21a8;
    box-shadow: 0 6px 18px rgba(168, 85, 247, 0.4);
  }

  /* Barres de sélection des sous-niveaux (1 à 10) */
  .level-bar {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 20px;
  }

  .level-btn {
    padding: 8px 12px;
    border-radius: 14px;
    background-color: #f1f5f9;
    border: 2px solid #cbd5e1;
    color: #475569;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: 'Fredoka', 'Segoe UI', sans-serif;
  }

  .level-btn:hover {
    background-color: #e2e8f0;
    transform: translateY(-2px);
  }

  .level-btn.active {
    background: linear-gradient(135deg, #8c52ff 0%, #6366f1 100%);
    color: white;
    border-color: #4f46e5;
    box-shadow: 0 4px 12px rgba(140, 82, 255, 0.35);
  }

  .level-btn.completed {
    border-color: #22c55e;
  }

  /* Zone du jeu : Grille à gauche, Programme à droite */
  .game-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 25px;
    align-items: flex-start;
  }

  @media screen and (max-width: 850px) {
    .game-layout {
      grid-template-columns: 1fr;
    }
  }

  /* Grille du Labyrinthe */
  .board-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f8fafc;
    padding: 18px;
    border-radius: 20px;
    border: 2px solid #e2e8f0;
  }

  .maze-grid {
    display: grid;
    gap: 3px;
    background-color: #cbd5e1;
    border: 4px solid #334155;
    border-radius: 12px;
    padding: 4px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
  }

  .grid-5 {
    grid-template-columns: repeat(5, 58px);
    grid-template-rows: repeat(5, 58px);
  }

  .grid-6 {
    grid-template-columns: repeat(6, 48px);
    grid-template-rows: repeat(6, 48px);
  }

  @media screen and (max-width: 500px) {
    .grid-5 {
      grid-template-columns: repeat(5, 46px);
      grid-template-rows: repeat(5, 46px);
    }
    .grid-6 {
      grid-template-columns: repeat(6, 38px);
      grid-template-rows: repeat(6, 38px);
    }
  }

  .maze-cell {
    background-color: #ffffff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    position: relative;
    transition: background-color 0.2s ease;
  }

  .maze-cell.obstacle {
    background-color: #64748b;
  }

  .maze-cell.start-cell {
    background-color: #e0e7ff;
  }

  .maze-cell.goal-cell {
    background-color: #fef9c3;
    animation: pulse 1.5s infinite alternate;
  }

  /* Animation du Robot */
  .robot-sprite {
    font-size: 34px;
    transition: transform 0.3s ease;
    display: inline-block;
  }

  .dir-0 { transform: rotate(0deg); }     /* Nord */
  .dir-1 { transform: rotate(90deg); }    /* Est */
  .dir-2 { transform: rotate(180deg); }   /* Sud */
  .dir-3 { transform: rotate(270deg); }   /* Ouest */

  /* Palette des blocs d'instructions */
  .instructions-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
  }

  .category-title {
    font-size: 14px;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .block-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
  }

  .cmd-btn {
    padding: 8px 12px;
    border-radius: 12px;
    border: 2px solid;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Fredoka', sans-serif;
    color: white;
  }

  .cmd-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  }

  /* Actions de base (Bleu) */
  .btn-move { background-color: #3b82f6; border-color: #2563eb; }
  .btn-left { background-color: #0284c7; border-color: #0369a1; }
  .btn-right { background-color: #6366f1; border-color: #4f46e5; }

  /* Boucles (Orange) */
  .btn-loop { background-color: #f97316; border-color: #ea580c; }

  /* Conditions (Violet / Rose) */
  .btn-cond { background-color: #d946ef; border-color: #c026d3; }

  /* Sequence / Fil du programme */
  .program-queue {
    background-color: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    padding: 12px;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
  }

  .queue-item {
    background-color: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13.5px;
    font-weight: 700;
    color: #334155;
    animation: fadeIn 0.2s ease;
  }

  .queue-item.tag-action { border-left: 5px solid #3b82f6; }
  .queue-item.tag-loop { border-left: 5px solid #f97316; background-color: #fff7ed; }
  .queue-item.tag-cond { border-left: 5px solid #d946ef; background-color: #fdf4ff; }

  .queue-item.active-step {
    border-color: #22c55e;
    background-color: #f0fdf4;
    box-shadow: 0 0 0 2px #4ade80;
  }

  .btn-remove {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    font-weight: bold;
  }

  /* Actions principales */
  .control-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
  }

  .btn-run {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 18px;
    font-weight: 800;
    font-size: 16px;
    cursor: pointer;
    flex-grow: 1;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
    transition: all 0.2s ease;
    font-family: 'Fredoka', sans-serif;
  }

  .btn-run:hover:not(:disabled) {
    transform: scale(1.03);
    box-shadow: 0 6px 15px rgba(34, 197, 94, 0.6);
  }

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

  .btn-reset:hover {
    background-color: #e2e8f0;
  }

  /* Modal de victoire / défaite */
  .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

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

  .modal-card {
    background: white;
    border-radius: 28px;
    padding: 30px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
    transform: scale(0.85);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 4px solid #8c52ff;
  }

  .modal-overlay.visible .modal-card {
    transform: scale(1);
  }

  @keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.08); }
  }

  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
  }
