/* ═══════════════════════════════════════════════════════════════════════════
   TricotStudio — CSS personnalisé
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables CSS ──────────────────────────────────────────────────────── */
:root {
  --color-brand:   #4A90A4;
  --color-accent:  #E8A87C;
  --color-surface: #FAF9F6;
  --color-border:  #E5E7EB;
  --radius-card:   1rem;
  --shadow-card:   0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.05);
}

.dark {
  --color-surface: #030712;
  --color-border:  #1f2937;
}

/* ── Base ───────────────────────────────────────────────────────────────── */
body {
  background-color: var(--color-surface);
  font-family: 'Inter', system-ui, sans-serif;
}

/* ── Scrollbar fine ─────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E0; border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }
.dark ::-webkit-scrollbar-thumb { background: #374151; }
.dark ::-webkit-scrollbar-thumb:hover { background: #4B5563; }

/* ── Focus ring cohérent ────────────────────────────────────────────────── */
*:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ── Formulaires ────────────────────────────────────────────────────────── */
input[type="number"],
input[type="text"],
select,
textarea {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type="number"]:focus,
input[type="text"]:focus,
select:focus,
textarea:focus {
  border-color: var(--color-brand) !important;
  box-shadow: 0 0 0 3px rgba(74, 144, 164, 0.15);
}

/* ── Inputs range (sliders) ─────────────────────────────────────────────── */
input[type="range"] {
  -webkit-appearance: none;
  height: 4px;
  background: #E5E7EB;
  border-radius: 9999px;
  outline: none;
  cursor: pointer;
}
.dark input[type="range"] { background: #374151; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-brand);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  transition: transform 0.1s ease;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

/* ── Skeleton loader ────────────────────────────────────────────────────── */
.skeleton-pulse {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.dark .skeleton-pulse {
  background: linear-gradient(90deg, #1f2937 25%, #374151 50%, #1f2937 75%);
  background-size: 200% 100%;
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* ── Animations ─────────────────────────────────────────────────────────── */
@keyframes slide-in-right {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-slide-in-right { animation: slide-in-right 0.22s cubic-bezier(.16,1,.3,1); }
.animate-fade-in        { animation: fade-in 0.2s ease-out; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: var(--radius-card);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
}
.dark .card {
  background: #111827;
  border-color: #1f2937;
}

/* ── Badges difficulté ──────────────────────────────────────────────────── */
.badge-difficulty-1 { background: #D1FAE5; color: #065F46; }
.badge-difficulty-2 { background: #FEF3C7; color: #92400E; }
.badge-difficulty-3 { background: #FEE2E2; color: #991B1B; }
.dark .badge-difficulty-1 { background: #064E3B; color: #6EE7B7; }
.dark .badge-difficulty-2 { background: #78350F; color: #FDE68A; }
.dark .badge-difficulty-3 { background: #7F1D1D; color: #FCA5A5; }

/* ── Canvas éditeur grille ──────────────────────────────────────────────── */
#grid-canvas {
  cursor: crosshair;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ── Tableau instructions patron ────────────────────────────────────────── */
.pattern-table th {
  background: #F9FAFB;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6B7280;
}
.dark .pattern-table th {
  background: #1f2937;
  color: #9CA3AF;
}
.pattern-table td {
  vertical-align: top;
  font-size: 0.875rem;
}

/* ── Stepper navigation sidebar ─────────────────────────────────────────── */
.step-active  { background: var(--color-brand); color: white; }
.step-done    { background: #D1FAE5; color: #065F46; }
.step-pending { background: #F3F4F6; color: #9CA3AF; }
.dark .step-done    { background: #064E3B; color: #6EE7B7; }
.dark .step-pending { background: #1f2937; color: #6B7280; }

/* ── Sélecteurs de type (boutons toggle) ────────────────────────────────── */
.toggle-btn {
  border: 1px solid #E5E7EB;
  background: #F9FAFB;
  color: #6B7280;
  border-radius: 0.625rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  text-align: center;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  cursor: pointer;
}
.toggle-btn:hover {
  border-color: #7bbfcf;
  background: #eef6f9;
  color: #3a7a8d;
}
.toggle-btn.active {
  background: #d6ecf3;
  border-color: #4a90a4;
  color: #2e6474;
  font-weight: 600;
}
.dark .toggle-btn {
  border-color: #374151;
  background: #1f2937;
  color: #9CA3AF;
}
.dark .toggle-btn:hover {
  border-color: #4a90a4;
  background: #0a2229;
  color: #7bbfcf;
}
.dark .toggle-btn.active {
  background: #0a2229;
  border-color: #4a90a4;
  color: #7bbfcf;
}

/* ── Panneau section card ────────────────────────────────────────────────── */
.section-card {
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 0.875rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  padding: 1.25rem;
}
.dark .section-card {
  background: #111827;
  border-color: #1f2937;
}
.section-card h2 {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6B7280;
  margin-bottom: 0.875rem;
}
.dark .section-card h2 { color: #9CA3AF; }

/* ── Bouton primaire ─────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #4a90a4;
  color: white;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
  box-shadow: 0 1px 3px rgba(74,144,164,.3);
}
.btn-primary:hover  { background: #3a7a8d; box-shadow: 0 2px 6px rgba(74,144,164,.35); }
.btn-primary:active { background: #2e6474; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Bouton secondaire ───────────────────────────────────────────────────── */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: white;
  color: #4a90a4;
  border: 1px solid #7bbfcf;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-secondary:hover { background: #eef6f9; border-color: #4a90a4; }
.dark .btn-secondary {
  background: #111827;
  color: #7bbfcf;
  border-color: #2e6474;
}
.dark .btn-secondary:hover { background: #0a2229; border-color: #4a90a4; }

/* ── Tip / suggestion box ────────────────────────────────────────────────── */
.tip-box {
  background: #eef6f9;
  border: 1px solid #d6ecf3;
  border-radius: 0.75rem;
  padding: 0.875rem 1rem;
}
.dark .tip-box {
  background: #0a2229;
  border-color: #163842;
}
.tip-box .tip-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #2e6474;
  margin-bottom: 0.4rem;
}
.dark .tip-box .tip-title { color: #7bbfcf; }

/* ── Warning box ─────────────────────────────────────────────────────────── */
.warning-box {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem 0.875rem;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  color: #92400E;
}
.dark .warning-box {
  background: #451A03;
  border-color: #78350F;
  color: #FDE68A;
}

/* ── Responsive print ────────────────────────────────────────────────────── */
@media print {
  nav, footer, .no-print { display: none !important; }
  body { background: white !important; color: black !important; }
  .section-card { break-inside: avoid; }
}
