/**
 * Monaco Editor Block Styles - Grade A v3
 * Extension du composant CodePen Block avec éditeur Monaco
 * 
 * @version 2.0.3
 * @author Frédéric Moitry - Formation Product Designer UX/UI
 */

/* ============================================
   ÉDITEUR MONACO - ZONE SANDBOX
   ============================================ */
.monaco-sandbox {
  margin-top: 15px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  background: #1e1e1e;
}

/* En-tête de l'éditeur avec onglets */
.monaco-header {
  display: flex;
  align-items: center;
  background: #252526;
  border-bottom: 1px solid #3c3c3c;
  padding: 0;
}

.monaco-tabs {
  display: flex;
  flex: 1;
}

.monaco-tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: #969696;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
}

.monaco-tab:hover {
  color: #fff;
  background: #2d2d2d;
}

.monaco-tab.active {
  color: #fff;
  background: #1e1e1e;
  border-bottom: 2px solid #007acc;
}

/* Boutons d'action */
.monaco-actions {
  display: flex;
  gap: 8px;
  padding: 0 12px;
}

.monaco-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.monaco-btn-run {
  background: #0e639c;
  color: #fff;
}

.monaco-btn-run:hover {
  background: #1177bb;
}

.monaco-btn-reset {
  background: #3c3c3c;
  color: #ccc;
}

.monaco-btn-reset:hover {
  background: #4c4c4c;
}

.monaco-btn-save {
  background: #388a34;
  color: #fff;
}

.monaco-btn-save:hover {
  background: #4caf50;
}

/* Conteneur principal éditeur + preview - Layout vertical */
.monaco-container {
  display: flex;
  flex-direction: column;
  height: 600px;
}

/* Zone éditeur : 50% - 35px compensation */
.monaco-editor-wrapper {
  flex: 0 0 calc(50% - 35px);
  display: flex;
  flex-direction: column;
  border-right: none;
  border-bottom: none;
}

.monaco-editor-pane {
  flex: 1;
  display: none;
}

.monaco-editor-pane.active {
  display: block;
}

/* Zone preview : 50% + 35px compensation */
.monaco-preview-wrapper {
  flex: 0 0 calc(50% + 35px);
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow: hidden;
}

.monaco-preview-header {
  padding: 8px 15px;
  background: #252526;
  color: #969696;
  font-size: 12px;
  font-weight: 500;
  border-bottom: 1px solid #3c3c3c;
  flex-shrink: 0;
}

.monaco-preview {
  flex: 1 1 auto;
  width: 100%;
  min-height: 200px;
  height: 100%;
  border: none;
  background: #fff;
  display: block;
}

/* Indicateur de statut */
.monaco-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #343a40;
  color: #fff;
  font-size: 12px;
}

.monaco-status.success {
  background: #388a34;
}

.monaco-status.error {
  background: #c72e2e;
}

.monaco-status-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.monaco-status-right {
  opacity: 0.8;
}

/* ============================================
   RESPONSIVE - LAYOUT VERTICAL 50/50 VISUEL
   Compensation barre "Result" (35px)
   ============================================ */

/* Tablet & Desktop étroit (< 1024px) */
@media (max-width: 1024px) {
  .monaco-container {
    flex-direction: column;
    height: 600px;
  }

  /* Éditeur : 50% - 35px compensation */
  .monaco-editor-wrapper {
    flex: 0 0 calc(50% - 35px);
    border-right: none;
    border-bottom: none;
    height: auto;
    min-height: 0;
  }

  /* Preview : 50% + 35px compensation */
  .monaco-preview-wrapper {
    flex: 0 0 calc(50% + 35px);
    height: auto;
    min-height: 0;
  }

  .monaco-preview-header {
    background: #343a40;
    color: #fff;
    padding: 10px 15px;
    font-size: 13px;
  }
}

/* Tablet (< 768px) */
@media (max-width: 768px) {
  .monaco-container {
    height: 550px;
  }

  .monaco-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .monaco-tabs {
    order: 1;
  }

  .monaco-actions {
    order: 2;
    flex-wrap: wrap;
    padding: 0;
    gap: 6px;
  }
}

/* Mobile (< 576px) */
@media (max-width: 576px) {
  .monaco-container {
    height: 500px;
  }

  .monaco-header {
    padding: 8px 10px;
  }

  .monaco-tab {
    padding: 8px 12px;
    font-size: 12px;
  }

  .monaco-btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  .monaco-editor-wrapper {
    height: 220px;
    min-height: 220px;
  }

  .monaco-preview-wrapper {
    height: 280px;
    min-height: 280px;
  }

  .monaco-preview-header {
    padding: 8px 12px;
    font-size: 12px;
  }

  .monaco-status {
    padding: 5px 10px;
    font-size: 11px;
  }
}

/* ============================================
   INTÉGRATION ACCORDÉON WPA
   ============================================ */
.wpa-accordion-content .monaco-sandbox {
  margin: 15px 0;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  .monaco-sandbox {
    display: none;
  }
}
