/* ==========================================================================
   CSS DÉDIÉ : PIXEL_ART.PHP - Pixel Art Créatif Libre
   Fichier : css/pixel_art.css
   École de l'Enfant-Jésus - Morlanwelz
   ========================================================================== */

/* Style propre à l'Atelier Pixel Art */
  .pixel-container {
    max-width: 1040px;
    margin: 0 auto 30px auto;
    background: #ffffff;
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    border: 3px solid #62d0ff;
  }

  /* Espace de travail principal côte à côte */
  .pixel-workspace {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    justify-content: center;
  }

  /* Colonne Gauche : Sélecteur de dessins */
  .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: #f8fafc;
    border: 2px solid #bae6fd;
    border-radius: 16px;
    padding: 12px 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.04);
  }

  .side-config-title {
    font-size: 13px;
    font-weight: 800;
    color: #0369a1;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Fredoka', 'Segoe UI', sans-serif;
  }

  .side-config-sub {
    font-size: 11px;
    color: #64748b;
    text-align: center;
    margin-bottom: 10px;
  }

  /* Grille des niveaux dans la colonne gauche */
  .level-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

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

  .level-chip:hover {
    background-color: #f0f9ff;
    border-color: #62d0ff;
    transform: translateY(-1px);
  }

  .level-chip.active {
    background: linear-gradient(135deg, #62d0ff 0%, #3a86ff 100%);
    color: white;
    border-color: #2563eb;
    box-shadow: 0 3px 10px rgba(58, 134, 255, 0.35);
  }

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

  /* Style spécial pour le niveau Dessin Libre */
  .level-chip.free-mode-chip {
    grid-column: span 2;
    background: #fffbeb;
    border-color: #f59e0b;
    color: #b45309;
    font-size: 12px;
    padding: 8px 6px;
    font-weight: 800;
  }

  .level-chip.free-mode-chip:hover {
    background: #fef3c7;
    border-color: #d97706;
  }

  .level-chip.free-mode-chip.active {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-color: #b45309;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
  }

  .side-reset-btn {
    width: 100%;
    margin-top: 10px;
    padding: 7px 8px;
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Fredoka', 'Segoe UI', sans-serif;
    transition: all 0.2s ease;
  }

  .side-reset-btn:hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #b91c1c;
  }

  /* Zone de jeu à droite */
  .pixel-play-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  /* Info du niveau actuel */
  .level-header {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    margin-bottom: 20px;
    background-color: #f0f9ff;
    padding: 12px 20px;
    border-radius: 16px;
    border: 2px dashed #93c5fd;
  }

  .level-title {
    font-size: 22px;
    font-weight: 800;
    color: #1e3a8a;
    margin-bottom: 4px;
  }

  .level-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: bold;
    color: white;
  }

  .badge-easy { background-color: #10b981; }
  .badge-medium { background-color: #3b82f6; }
  .badge-hard { background-color: #f59e0b; }
  .badge-free { background: linear-gradient(135deg, #f59e0b 0%, #ec4899 100%); }

  /* Zone des grilles côte à côte */
  .workspace {
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
    align-items: flex-start;
    margin-bottom: 25px;
    width: 100%;
  }

  @media screen and (max-width: 880px) {
    .pixel-workspace {
      flex-direction: column;
      align-items: stretch;
    }
    .config-side-left {
      flex: none;
      width: 100%;
      max-width: none;
    }
    .level-selector {
      grid-template-columns: repeat(4, 1fr);
    }
    .level-chip.free-mode-chip {
      grid-column: span 4;
    }
  }

  @media screen and (max-width: 600px) {
    .level-selector {
      grid-template-columns: repeat(3, 1fr);
    }
    .level-chip.free-mode-chip {
      grid-column: span 3;
    }
  }

  .grid-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .grid-box h3 {
    font-size: 16px;
    color: #334155;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  /* La grille Pixel Art */
  .pixel-grid {
    display: grid;
    gap: 1px;
    background-color: #cbd5e1;
    border: 3px solid #475569;
    border-radius: 8px;
    padding: 2px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
    user-select: none;
    touch-action: none;
  }

  .grid-10 {
    grid-template-columns: repeat(10, 26px);
    grid-template-rows: repeat(10, 26px);
  }

  .grid-12 {
    grid-template-columns: repeat(12, 24px);
    grid-template-rows: repeat(12, 24px);
  }

  .grid-15 {
    grid-template-columns: repeat(15, 20px);
    grid-template-rows: repeat(15, 20px);
  }

  @media screen and (max-width: 600px) {
    .grid-10 {
      grid-template-columns: repeat(10, 22px);
      grid-template-rows: repeat(10, 22px);
    }
    .grid-12 {
      grid-template-columns: repeat(12, 19px);
      grid-template-rows: repeat(12, 19px);
    }
    .grid-15 {
      grid-template-columns: repeat(15, 17px);
      grid-template-rows: repeat(15, 17px);
    }
  }

  .cell {
    background-color: #ffffff;
    width: 100%;
    height: 100%;
    cursor: pointer;
    transition: background-color 0.1s ease;
  }

  .cell.target-cell {
    cursor: default;
  }

  /* Palette de couleurs */
  .palette-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    background-color: #f8fafc;
    padding: 14px;
    border-radius: 18px;
    border: 2px solid #e2e8f0;
  }

  .color-swatch {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
  }

  .color-swatch:hover {
    transform: scale(1.15);
  }

  .color-swatch.active {
    transform: scale(1.25);
    border-color: #1e293b;
    box-shadow: 0 0 0 3px #38bdf8;
  }

  /* Actions et Outils */
  .control-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
  }

  .btn-pixel {
    padding: 10px 20px;
    border-radius: 18px;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    font-family: 'Fredoka', sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .btn-check {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.35);
  }

  .btn-check:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 15px rgba(34, 197, 94, 0.5);
  }

  .btn-clear {
    background-color: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
  }

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

  /* Indicateur de précision */
  .progress-box {
    text-align: center;
    margin-top: 15px;
    font-weight: bold;
    font-size: 16px;
    color: #334155;
  }

  /* Modal de félicitations */
  .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 #62d0ff;
  }

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

  .modal-icon {
    font-size: 55px;
    margin-bottom: 10px;
  }
