/* Variables CSS */
:root {
  --primary-bg: #16213e;
  --secondary-bg: #1a2142;
  --accent-pink: #e8b4b8;
  --accent-gold: #f5c469;
  --text-primary: #ffffff;
  --text-secondary: #b8c5d6;
  --success-green: #28a745;
  --error-red: #dc3545;
}

.visual-editor-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--primary-bg);
}

.editor-toolbar {
  background: var(--secondary-bg);
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(232, 180, 184, 0.2);
  flex-shrink: 0;
}

.editor-toolbar .toolbar-section {
  display: flex;
  gap: 10px;
  align-items: center;
}

.editor-toolbar h4 {
  color: var(--accent-pink);
  margin: 0;
  font-size: 1.2rem;
}

.editor-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

.editor-sidebar {
  width: 280px;
  background: rgba(22, 33, 62, 0.5);
  padding: 20px;
  overflow-y: auto;
  border-right: 1px solid rgba(232, 180, 184, 0.1);
  flex-shrink: 0;
}

.editor-sidebar .control-section {
  margin-bottom: 30px;
}

.editor-sidebar .control-section h6 {
  color: var(--accent-pink);
  margin-bottom: 15px;
  font-weight: 600;
  font-size: 1rem;
}

.editor-sidebar .color-input-group {
  margin-bottom: 15px;
}

.editor-sidebar .color-input-group label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 8px;
  font-weight: 500;
}

.editor-sidebar .color-input-group input[type="color"] {
  width: 100%;
  height: 40px;
  border: 2px solid rgba(232, 180, 184, 0.3);
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
}

.editor-sidebar .color-input-group input[type="color"]:hover {
  border-color: var(--accent-pink);
}

.editor-sidebar .size-controls {
  margin-bottom: 15px;
}

.editor-sidebar .size-controls label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.editor-sidebar .size-controls input[type="range"] {
  width: 100%;
  margin: 10px 0;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.editor-sidebar .size-controls input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-pink);
  cursor: pointer;
  border: 2px solid white;
}

.editor-sidebar .size-controls span {
  color: var(--accent-gold);
  font-size: 0.9rem;
  font-weight: 600;
}

.editor-sidebar .form-select {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(232, 180, 184, 0.3);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 8px 12px;
  width: 100%;
}

.editor-sidebar .form-select:focus {
  border-color: var(--accent-pink);
  box-shadow: 0 0 0 2px rgba(232, 180, 184, 0.2);
  outline: none;
}

/* Contrôles de position */
.position-controls {
  margin-top: 10px;
  margin-bottom: 20px;
}

.position-controls > label {
  color: var(--accent-pink);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 10px;
  display: block;
}

.position-group {
  margin-bottom: 15px;
}

.position-group label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.position-group input[type="range"] {
  width: 100%;
  margin: 10px 0;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.position-group input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-pink);
  cursor: pointer;
  border: 2px solid white;
}

.position-group span {
  color: var(--accent-gold);
  font-size: 0.9rem;
  font-weight: 600;
}

.editor-sidebar .photo-controls label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: block;
  margin-bottom: 8px;
  margin-top: 15px;
  font-weight: 500;
}

.editor-sidebar .photo-controls label:first-child {
  margin-top: 0;
}

.editor-sidebar .photo-controls input[type="range"] {
  width: 100%;
  margin: 10px 0;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.editor-sidebar .photo-controls span {
  color: var(--accent-gold);
  font-size: 0.9rem;
  font-weight: 600;
  display: block;
  margin-bottom: 10px;
}

.editor-sidebar .color-input-group small,
.editor-sidebar .control-section small {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: 5px;
  display: block;
}

/* Zone de prévisualisation */
.editor-canvas-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--primary-bg);
  position: relative;
  overflow: auto;
  min-width: 0;
  min-height: 400px;
}

.memorial-preview-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: relative;
}

.memorial-preview {
  position: relative;
  background: #f5f3f0;
  border-radius: 15px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transition: all 0.3s ease;
  
  /* Dimensions par défaut (format carré) */
  width: 400px;
  height: 400px;
}

.memorial-preview[data-format="a5"] {
  width: 300px;
  height: 424px; /* Ratio A5 */
}

.memorial-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 1;
}

.memorial-photo {
  position: absolute;
  z-index: 2;
  border: 4px solid white;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  transition: all 0.3s ease;
  
  /* Position et taille par défaut */
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 120px;
  border-radius: 50%;
}

.memorial-photo.shape-rectangle {
  border-radius: 10px;
}

.memorial-photo.shape-oval {
  border-radius: 50%;
  transform: translateX(-50%) scaleY(0.8);
}

.memorial-photo.shape-circle {
  border-radius: 50%;
}

.memorial-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.memorial-text {
  position: absolute;
  z-index: 3;
  text-align: center;
  transition: all 0.3s ease;
  color: #2c3e50;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.memorial-name {
  font-size: 32px;
  font-weight: bold;
  top: 220px;
  left: 20px;
  right: 20px;
}

.memorial-dates {
  font-size: 18px;
  top: 270px;
  left: 20px;
  right: 20px;
  color: #5d6d7e;
}

.memorial-profession {
  font-size: 16px;
  top: 300px;
  left: 20px;
  right: 20px;
  color: #7f8c8d;
  font-style: italic;
}

.memorial-biography {
  font-size: 14px;
  top: 330px;
  left: 20px;
  right: 20px;
  color: #34495e;
}

.memorial-footer {
  font-size: 24px;
  font-weight: bold;
  color: #34495e;
  letter-spacing: 1px;
  bottom: 30px;
  left: 20px;
  right: 20px;
}

/* Contrôles de prévisualisation */
.preview-controls {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  gap: 10px;
}

.preview-controls button {
  background: var(--secondary-bg);
  border: 1px solid rgba(232, 180, 184, 0.2);
  border-radius: 6px;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px 12px;
  transition: all 0.3s ease;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.preview-controls button:hover {
  color: var(--accent-pink);
  background: rgba(232, 180, 184, 0.1);
  border-color: var(--accent-pink);
}

.editor-info-panel {
  width: 300px;
  background: rgba(22, 33, 62, 0.5);
  padding: 20px;
  overflow-y: auto;
  border-left: 1px solid rgba(232, 180, 184, 0.1);
  flex-shrink: 0;
}

.editor-info-panel h6 {
  color: var(--accent-pink);
  margin-bottom: 15px;
  font-size: 1rem;
  font-weight: 600;
}

.editor-info-panel .info-locked {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 15px;
  border: 1px solid rgba(232, 180, 184, 0.1);
}

.editor-info-panel .info-locked p {
  margin-bottom: 10px;
  color: var(--text-primary);
  line-height: 1.5;
}

.editor-info-panel .info-locked p strong {
  color: var(--accent-gold);
  font-weight: 600;
}

.editor-info-panel .program-info {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  border: 1px solid rgba(232, 180, 184, 0.05);
}

.editor-info-panel .program-info strong {
  color: var(--accent-pink);
}

.editor-info-panel .program-info small {
  color: var(--text-secondary);
}

.editor-info-panel .instructions {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 12px;
  border: 1px solid rgba(232, 180, 184, 0.05);
}

.editor-info-panel .instructions p {
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
}

.editor-info-panel .instructions p strong {
  color: var(--accent-pink);
  font-weight: 600;
}

.editor-notification {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  padding: 15px 30px;
  border-radius: 25px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  animation: slideIn 0.3s ease;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.editor-notification.success {
  background: var(--success-green);
}

.editor-notification.error {
  background: var(--error-red);
}

/* Boutons de la toolbar */
.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-outline-light {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text-primary);
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-pink);
  color: var(--accent-pink);
}

.btn-success {
  background: var(--success-green);
  border-color: var(--success-green);
  color: white;
}

.btn-success:hover {
  background: #218838;
  border-color: #218838;
}

.btn-primary {
  background: var(--accent-pink);
  border-color: var(--accent-pink);
  color: white;
}

.btn-primary:hover {
  background: #d49ca1;
  border-color: #d49ca1;
}

.btn-secondary {
  background: var(--secondary-bg);
  border-color: rgba(232, 180, 184, 0.3);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(232, 180, 184, 0.1);
  border-color: var(--accent-pink);
  color: var(--accent-pink);
}

@keyframes slideIn {
  from {
    transform: translateX(-50%) translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 1200px) {
  .editor-sidebar {
    width: 250px;
  }
  
  .editor-info-panel {
    width: 250px;
  }
}

@media (max-width: 768px) {
  .editor-main {
    flex-direction: column;
  }
  
  .editor-sidebar, 
  .editor-info-panel {
    width: 100%;
    height: auto;
    max-height: 200px;
    border: none;
    border-bottom: 1px solid rgba(232, 180, 184, 0.1);
  }
  
  .editor-canvas-container {
    padding: 10px;
    flex: 1;
    min-height: 400px;
  }
  
  .preview-controls {
    bottom: 10px;
    right: 10px;
    padding: 8px 15px;
    gap: 10px;
  }
  
  .editor-toolbar {
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .editor-toolbar .toolbar-section {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .editor-toolbar {
    padding: 10px 15px;
  }
  
  .editor-toolbar h4 {
    font-size: 1rem;
  }
  
  .btn-sm {
    padding: 4px 8px;
    font-size: 0.8rem;
  }
  
  .editor-sidebar,
  .editor-info-panel {
    padding: 15px;
  }
  
  .memorial-preview {
    width: 300px;
    height: 300px;
  }
  
  .memorial-preview[data-format="a5"] {
    width: 250px;
    height: 354px;
  }
}