/**
 * CSS Niveau 1 — Primitives & Éléments Communs (primitives.css)
 * Reset global, châssis de mise en page, boutons, inputs, badges et spinners.
 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family-sans);
  background-color: var(--color-bg-canvas);
  color: var(--color-text-primary);
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  background-image:
    radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.14) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(217, 38, 248, 0.14) 0%, transparent 45%);
  background-attachment: fixed;
}

/* --- Châssis Global de l'Interface Studio --- */
.app-container {
  flex: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.65rem 0.85rem 0.5rem;
  min-width: 0;
}

.creator-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
  min-height: 0;
}

.workspace-top-area {
  flex: 1;
  display: flex;
  gap: 0.75rem;
  min-height: 0;
  padding: 0.65rem 0.75rem;
  overflow: hidden;
}

/* --- Boutons Primitifs Studio --- */
.btn-primary,
.btn-studio-primary,
.btn-secondary,
.btn-studio-secondary,
.btn-danger,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.45rem 0.9rem;
  font-family: var(--font-family-sans);
  font-size: var(--font-size-sm);
  font-weight: 600;
  line-height: 1.25;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}

.btn-primary,
.btn-studio-primary {
  background: var(--gradient-brand);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled),
.btn-studio-primary:hover:not(:disabled) {
  background: var(--gradient-brand-hover);
  box-shadow: 0 4px 16px rgba(217, 38, 248, 0.4);
  transform: translateY(-1px);
}

.btn-secondary,
.btn-studio-secondary {
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
  border-color: var(--color-border);
}

.btn-secondary:hover:not(:disabled),
.btn-studio-secondary:hover:not(:disabled) {
  background: var(--color-bg-card-hover);
  border-color: var(--color-border-hover);
  color: #ffffff;
}

.btn-danger {
  background: var(--color-status-danger-bg);
  color: var(--color-status-danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
  background: var(--color-status-danger);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text-primary);
}

.btn-primary:disabled,
.btn-studio-primary:disabled,
.btn-secondary:disabled,
.btn-studio-secondary:disabled,
.btn-danger:disabled,
.btn-ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* --- Badges & Piles --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.2rem 0.55rem;
  font-family: var(--font-family-mono);
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  line-height: 1;
}

.badge-credit {
  background: var(--color-credit-bg);
  color: var(--color-credit-gold);
  border: 1px solid var(--color-credit-border);
}

.badge-success {
  background: var(--color-status-success-bg);
  color: var(--color-status-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* --- Formulaires & Champs --- */
.input-text,
.input-textarea,
.input-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-family: var(--font-family-sans);
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
  background-color: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-text:focus,
.input-textarea:focus,
.input-select:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* --- Sliders / Ranges --- */
.slider-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-full);
  outline: none;
}

.slider-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-brand-blue);
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* --- Spinner --- */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: studio-spin 0.8s linear infinite;
}

@keyframes studio-spin {
  to { transform: rotate(360deg); }
}
