/* CSS Formulaire Chirostéo - Version originale + support éditeur visuel */

/* ===== STYLES POUR LES TAGS ===== */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.tag {
  padding: 8px 16px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  color: #333;
}

.tag:hover {
  background: #e0e0e0;
  border-color: #999;
}

.tag.active {
  background: #2196F3;
  color: white;
  border-color: #2196F3;
}

.details-container {
  margin-top: 15px;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 4px;
}

.details-container:empty {
  display: none;
}

.details-tag {
  margin-bottom: 10px;
}

.details-tag label {
  font-weight: normal;
  color: #666;
}

.details-tag textarea {
  margin-top: 5px;
}

/* ===== STYLES ORIGINAUX DU FORMULAIRE (PRÉSERVÉS) ===== */
body {
  font-family: 'Roboto', sans-serif;
  background: #f4f8fc;
  margin: 0;
  display: flex;
  justify-content: center;
  padding: 20px;
}

.container {
  background: #fff;
  width: 100%;
  max-width: 650px;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.logo {
  text-align: center;
  margin-bottom: 16px;
}

.logo img {
  max-height: 60px;
}

h2.title {
  color: #2c5985;
  text-align: center;
  margin-bottom: 20px;
  font-size: 1.4rem;
}

label {
  display: block;
  margin-bottom: 12px;
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 15px;
  font-size: 1rem;
  box-sizing: border-box;
}

.section-title {
  margin: 32px 0 12px;
  text-align: center;
  color: #2c5985;
  font-size: 1.2rem;
  font-weight: 700;
}

canvas {
  display: block;
  margin: 8px auto 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.btn-clear {
  background: #f9f9f9;
  color: #333;
  border: 1px solid #ccc;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-clear:hover {
  background: #eee;
}

button.submit {
  width: 100%;
  background: #2c5985;
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
}

button.submit:hover {
  background: #1f4061;
}

.hidden { 
  display: none; 
}

.consentbox {
  border: 1px solid #bbb;
  border-radius: 6px;
  max-height: 120px;
  overflow-y: scroll;
  background: #f8f8f8;
  padding: 10px;
  margin-bottom: 10px;
  font-size: 0.98em;
}

/* ---- TAGS / CHIPS ---- */
.tags {
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  background: #f1f5fa;
  color: #2c5985;
  border: 1px solid #bdd1e5;
  border-radius: 20px;
  padding: 7px 18px;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  outline: none;
  user-select: none;
}

.tag.active, .tag:focus-visible.active {
  background: #2c5985;
  color: #fff;
  border: 1px solid #2c5985;
}

.details-tag {
  margin-bottom: 15px;
}

.details-tag label {
  font-weight: 400;
  font-size: 0.98em;
}

@media (max-width: 600px) {
  .container { 
    padding: 8px; 
  }
  .tags { 
    gap: 4px; 
  }
  .tag { 
    padding: 7px 10px; 
    font-size: 0.97em; 
  }
}

/* ---- ERREURS DE VALIDATION ---- */
.field-error {
  color: #e22;
  font-size: 0.9em;
  margin-top: -10px;
  margin-bottom: 10px;
  display: none;
}

input.error, select.error, textarea.error {
  border-color: #e22;
  background-color: #fee;
}

input.error:focus, select.error:focus, textarea.error:focus {
  outline-color: #e22;
}

/* ---- ANIMATIONS ---- */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.error {
  animation: shake 0.5s;
}

/* ===== STYLES ADDITIONNELS POUR L'ÉDITEUR VISUEL ===== */
/* Ces styles ne s'appliquent QUE sur la page visual-edit.php */

/* Reset du body pour l'éditeur visuel */
body.visual-editor {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f5f6fa;
  display: block;
  padding: 0;
}

/* Conteneur principal de l'éditeur */
.editor-container {
  margin: 0;
  padding: 0;
}

.editor-container .top-bar {
  background: #2563eb;
  color: #fff;
  padding: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.editor-container .btn {
  background: #fff;
  border: 1px solid #2563eb;
  color: #2563eb;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.editor-container .btn:hover {
  background: #f0f8ff;
}

.editor-container .btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.editor-container .grid-editor {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 10px;
  padding: 10px;
  height: calc(100vh - 60px);
  box-sizing: border-box;
}

.editor-container .palette,
.editor-container .canvas,
.editor-container .props {
  background: #fff;
  border: 1px solid #ddd;
  padding: 10px;
  overflow: auto;
  border-radius: 4px;
}

.editor-container .palette-search {
  width: 100%;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
}

.editor-container .p-card {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: grab;
  transition: background 0.2s;
}

.editor-container .p-card:hover {
  background: #f0f8ff;
}

.editor-container .p-icon {
  font-size: 1.2em;
}

.editor-container .section {
  border: 1px solid #2563eb;
  margin-bottom: 10px;
  border-radius: 4px;
}

.editor-container .section-title {
  background: #e0f2ff;
  padding: 6px;
  cursor: pointer;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
  color: #2563eb;
  font-size: 1rem;
}

.editor-container .field {
  background: #f8fafc;
  padding: 6px;
  margin: 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: grab;
}

.editor-container .selected {
  background: #c7d2fe !important;
}

.editor-container .props label {
  display: block;
  margin-bottom: 6px;
  font-weight: normal;
  color: #374151;
}

.editor-container .props input[type=text],
.editor-container .props input[type=number],
.editor-container .props input[type=url],
.editor-container .props select {
  width: 100%;
  border: 1px solid #ccc;
  padding: 4px;
  margin-top: 2px;
  border-radius: 4px;
  box-sizing: border-box;
  margin-bottom: 0;
}

.editor-container .props textarea {
  width: 100%;
  border: 1px solid #ccc;
  padding: 4px;
  border-radius: 4px;
  box-sizing: border-box;
  margin-bottom: 0;
  resize: vertical;
}

.editor-container .preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.editor-container .preview-box {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  max-height: 90vh;
  overflow: auto;
  width: 90%;
  max-width: 800px;
}

.editor-container .preview-box h3 {
  margin-top: 0;
  color: #2c5985;
}

.editor-container .breadcrumb {
  font-size: 0.9em;
  margin-bottom: 8px;
  color: #555;
}

/* Responsive pour l'éditeur */
@media (max-width: 960px) {
  .editor-container .grid-editor {
    grid-template-columns: 1fr;
    height: auto;
  }
}

/* Classes utilitaires pour l'éditeur */
.editor-container .text-center {
  text-align: center;
}

.editor-container .mt-2 {
  margin-top: 8px;
}

.editor-container .mb-2 {
  margin-bottom: 8px;
}

/* Support pour Alpine.js cloak */
[x-cloak] {
  display: none !important;
}
