/* ==========================================================================
   COMPONENTS - ANIME PODCAST STUDIO
   Charte : Bleu sombre & Or uniquement (zéro rose)
   Support de l'import en vrac, détection automatique & multi-poses par émotion
   ========================================================================== */

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  user-select: none;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Bouton Primaire Or / Jaune Cyber AutoShort */
.btn-gold {
  background: var(--gold-primary);
  color: #000000;
  font-weight: 700;
  box-shadow: var(--shadow-gold);
  border: 1px solid var(--gold-light);
}

.btn-gold:hover {
  background: var(--gold-light);
  box-shadow: var(--shadow-gold-hover);
  transform: translateY(-1px);
}

.btn-gold:active {
  transform: translateY(0);
  background: var(--gold-dark);
}

.btn-gold:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Bouton Secondaire Noir Mat */
.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-highlight);
  color: var(--text-white);
}

.btn-outline-gold {
  background-color: transparent;
  color: var(--gold-primary);
  border-color: var(--border-gold);
}

.btn-outline-gold:hover {
  background-color: var(--gold-subtle);
  border-color: var(--gold-primary);
  box-shadow: var(--shadow-gold);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* Format Fixe 1920x1080 FHD */
.format-badge-fixed {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid var(--gold-primary);
  color: var(--gold-light);
  box-shadow: 0 0 12px var(--gold-subtle);
  letter-spacing: 0.02em;
}

/* Tabs & Sélecteurs de modes */
.tab-group {
  display: flex;
  background-color: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  gap: 4px;
  margin-bottom: 16px;
}

.tab-btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tab-btn.active {
  background-color: var(--bg-card);
  color: var(--gold-light);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-highlight);
}

/* Sélecteur de Mascottes */
.mascot-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.mascot-card {
  background-color: var(--bg-surface);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  text-align: center;
}

.mascot-card:hover {
  border-color: var(--border-highlight);
  background-color: var(--bg-card-hover);
}

.mascot-card.selected {
  border-color: var(--gold-primary);
  background-color: rgba(245, 158, 11, 0.08);
  box-shadow: 0 0 16px var(--gold-subtle);
}

.mascot-thumbnail {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-darker);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.mascot-thumbnail img,
.mascot-thumbnail svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mascot-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.mascot-stats-badge {
  font-size: 0.68rem;
  color: var(--gold-light);
  background: var(--gold-subtle);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.mascot-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--gold-primary);
  box-shadow: 0 0 8px var(--gold-light);
}

.btn-delete-mascot {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: rgba(220, 38, 38, 0.85);
  color: white;
  border: none;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.btn-delete-mascot:hover {
  transform: scale(1.15);
  background-color: #dc2626;
}

/* Pose & Emotion Pills */
.poses-preview-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}

.pose-pill {
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pose-pill:hover {
  border-color: var(--border-highlight);
  color: var(--text-white);
}

.pose-pill.active {
  background-color: var(--gold-subtle);
  border-color: var(--gold-primary);
  color: var(--gold-light);
  box-shadow: 0 0 10px var(--gold-subtle);
}

.pose-count-badge {
  font-size: 0.68rem;
  background: var(--bg-darker);
  border: 1px solid var(--border-subtle);
  padding: 1px 5px;
  border-radius: var(--radius-full);
  color: var(--gold-light);
}

/* Formulaires & Entrées */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.form-input,
.form-select,
.form-textarea {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 16px;
  color: var(--text-white);
  outline: none;
  transition: border-color var(--transition-fast);
  font-family: inherit;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 10px var(--gold-subtle);
}

.form-textarea {
  resize: vertical;
  min-height: 90px;
}

/* Zone de Drag & Drop Audio */
.audio-dropzone {
  border: 2px dashed var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  background-color: rgba(17, 29, 56, 0.3);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.audio-dropzone:hover,
.audio-dropzone.dragover {
  border-color: var(--gold-primary);
  background-color: rgba(245, 158, 11, 0.05);
}

.dropzone-icon {
  width: 44px;
  height: 44px;
  color: var(--gold-light);
}

.dropzone-text {
  font-size: 0.88rem;
  color: var(--text-white);
  font-weight: 600;
}

.dropzone-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Lecteur Audio */
.audio-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-top: 10px;
}

.audio-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.audio-icon-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--gold-primary);
  box-shadow: 0 0 8px var(--gold-light);
}

.audio-icon-pulse.playing {
  animation: audioPulse 1.2s infinite ease-in-out;
}

@keyframes audioPulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.4); opacity: 1; }
}

.audio-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.audio-duration {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: monospace;
}

/* Canevas Vidéo AutoShort */
.canvas-wrapper {
  position: relative;
  width: 100%;
  background-color: var(--bg-abyss);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.9);
  transition: all var(--transition-normal);
}

.canvas-wrapper.format-9-16 {
  aspect-ratio: 9 / 16;
  max-height: 520px;
  max-width: calc(520px * (9 / 16));
  margin: 0 auto;
}

.canvas-wrapper.format-16-9 {
  aspect-ratio: 16 / 9;
  width: 100%;
  max-height: 520px;
}

.canvas-wrapper.checkerboard {
  background-image: 
    linear-gradient(45deg, #18181c 25%, transparent 25%), 
    linear-gradient(-45deg, #18181c 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #18181c 75%), 
    linear-gradient(-45deg, transparent 75%, #18181c 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0px;
  background-color: #101014;
}

#preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.canvas-overlay-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(16, 16, 20, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.canvas-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-top: 12px;
}

.playback-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-play {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
}

/* Modales */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 11, 20, 0.88);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  max-width: 820px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9), 0 0 30px var(--gold-subtle);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-white);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--gold-light);
}

/* ==========================================================================
   ZONE D'IMPORT EN VRAC (BULK UPLOAD) & REVUE / CORRECTION
   ========================================================================== */

.bulk-upload-dropzone {
  border: 2px dashed var(--gold-primary);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.06) 0%, rgba(17, 29, 56, 0.4) 100%);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: all var(--transition-normal);
  box-shadow: 0 0 20px var(--gold-subtle);
}

.bulk-upload-dropzone:hover,
.bulk-upload-dropzone.dragover {
  border-color: var(--gold-light);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.12) 0%, rgba(28, 46, 86, 0.5) 100%);
  transform: translateY(-2px);
  box-shadow: 0 0 30px var(--gold-glow);
}

.bulk-dropzone-icon {
  width: 52px;
  height: 52px;
  color: var(--gold-light);
  filter: drop-shadow(0 0 8px var(--gold-glow));
}

.bulk-dropzone-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-white);
}

.bulk-dropzone-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 480px;
}

/* Grille de Revue & Correction */
.bulk-review-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.bulk-review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bulk-review-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-white);
  display: flex;
  align-items: center;
  gap: 8px;
}

.bulk-review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 6px;
}

.bulk-review-card {
  background: var(--bg-darker);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  transition: border-color var(--transition-fast);
}

.bulk-review-card:hover {
  border-color: var(--border-highlight);
}

.bulk-review-thumb {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-sm);
  background: var(--bg-abyss);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
}

.bulk-review-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.bulk-review-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.bulk-review-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bulk-select-emotion {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--gold-light);
  font-size: 16px !important;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast);
  width: 100%;
  max-width: 100%;
}

.bulk-select-emotion:focus,
.bulk-select-emotion:hover {
  border-color: var(--gold-primary);
}

.bulk-btn-remove {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  align-self: flex-start;
}

.bulk-btn-remove:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

/* Outil d'ajout d'émotion personnalisée */
.custom-emotion-adder {
  display: flex;
  gap: 8px;
  background-color: var(--bg-surface);
  border: 1px dashed var(--border-gold);
  border-radius: var(--radius-md);
  padding: 12px;
  align-items: center;
  margin-top: 10px;
}

.custom-emotion-adder input {
  flex: 1;
}

/* Modale d'exportation */
.export-modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  padding: 20px 0;
}

.export-progress-ring {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.export-progress-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gold-light);
  font-family: monospace;
}

/* ==========================================================================
   MODALE : RÉGLAGE DE LA MASCOTTE (POSITION, ZOOM & TEINTE)
   ========================================================================== */
.tune-modal-body {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  align-items: start;
  padding: 10px 0;
}

@media (max-width: 640px) {
  .tune-modal-body {
    grid-template-columns: 1fr;
  }
}

.tune-preview-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tune-preview-box {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: var(--bg-abyss);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.tune-preview-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: bottom center;
  transition: transform 0.05s ease-out, filter 0.05s ease-out;
}

.tune-poses-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.tune-pose-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px;
}

.tune-pose-thumb {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: var(--bg-abyss);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.tune-pose-selects {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.tune-pose-selects select {
  flex: 1;
  min-width: 130px;
  font-size: 0.75rem;
  padding: 5px 6px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-white);
  border-radius: var(--radius-sm);
}

.tune-pose-remove {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.tune-pose-remove:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}

.tune-controls-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 6px;
}

.tune-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 4px;
}

.tune-control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tune-control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tune-control-header label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-white);
}

.tune-val-badge {
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  color: var(--gold-bright);
  background-color: rgba(250, 204, 21, 0.1);
  border: 1px solid rgba(250, 204, 21, 0.25);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.form-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-surface-elevated);
  border-radius: 3px;
  outline: none;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold-primary);
  cursor: pointer;
  box-shadow: 0 0 6px var(--gold-light);
  border: 2px solid var(--bg-abyss);
  transition: transform 0.1s;
}

.form-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.form-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold-primary);
  cursor: pointer;
  box-shadow: 0 0 6px var(--gold-light);
  border: 2px solid var(--bg-abyss);
}
