/* Palette reprise de l'identité GeoSol Studio (terracotta / brun / beige) */
:root {
  --hdr:      #6B4C2A;
  --dark:     #4A2E1A;
  --orange:   #C77B3D;
  --beige:    #C9A880;
  --bg:       #FDFAF7;
  --card:     #F0EBE4;
  --card2:    #FBF6EE;
  --sep:      #D0C8BE;
  --text:     #2E2014;
  --text-dim: #7A5C46;
  --white:    #FFFFFF;
  --ok:       #1A5C38;
  --err:      #8B2500;
  --radius:   12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Trebuchet MS', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--dark);
  color: #E8DDD1;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 6px 10px 20px;
  color: var(--white);
  letter-spacing: 0.3px;
}
.brand img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
}

.nav-group { margin-bottom: 18px; }

.nav-group-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--beige);
  padding: 6px 10px;
  font-weight: 600;
}

.nav-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: #E8DDD1;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
}

.nav-btn:hover { background: rgba(255,255,255,0.08); }

.nav-btn.active {
  background: var(--orange);
  color: var(--white);
}

.sidebar-footer {
  margin-top: auto;
  font-size: 0.72rem;
  color: #B0938A;
  padding: 10px;
  line-height: 1.5;
}

.main {
  flex: 1;
  padding: 36px 42px;
  max-width: 920px;
}

.tool-panel { display: none; }
.tool-panel.active { display: block; }

.tool-panel h2 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  color: var(--hdr);
}

.tool-panel h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: var(--hdr);
}

.page-intro {
  max-width: 920px;
  margin: 0 0 22px;
}
.page-intro h1 {
  margin: 0 0 8px;
  font-size: 1.4rem;
  color: var(--hdr);
}
.page-intro p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.5;
}

.hint {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin: 0 0 18px;
  line-height: 1.5;
}

.subtool {
  margin-bottom: 10px;
  background: var(--card2);
  border: 1px solid var(--sep);
  border-radius: var(--radius);
  padding: 20px;
}

hr {
  border: none;
  border-top: 1px solid var(--sep);
  margin: 24px 0;
}

.dropzone {
  border: 2px dashed var(--beige);
  border-radius: var(--radius);
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  color: var(--text-dim);
  background: var(--white);
  transition: border-color .15s, background .15s;
  margin-bottom: 16px;
}

.dropzone:hover { border-color: var(--orange); }
.dropzone.drag { border-color: var(--orange); background: #FDE9D4; }
.dropzone p { margin: 0; font-size: 0.92rem; }

.preview.hidden, .hint.hidden, .progress.hidden { display: none; }

.preview {
  background: var(--white);
  border: 1px solid var(--sep);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 16px rgba(74,46,26,0.08);
}

.preview-img {
  max-width: 100%;
  max-height: 260px;
  border-radius: 8px;
  border: 1px solid var(--sep);
  display: block;
  margin-bottom: 16px;
}

.checkerboard {
  background-image:
    linear-gradient(45deg, #999 25%, transparent 25%),
    linear-gradient(-45deg, #999 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #999 75%),
    linear-gradient(-45deg, transparent 75%, #999 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0px;
  background-color: #ccc;
}

.compare {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}
.compare > div { flex: 1; }
.compare-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sizes-check {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 18px;
  font-size: 0.9rem;
}
.sizes-check label { display: flex; align-items: center; gap: 6px; }

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  margin-bottom: 16px;
}

.form-row label, label {
  font-size: 0.88rem;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.checkbox-inline {
  flex-direction: row !important;
  align-items: center;
  gap: 6px !important;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.mode-tab {
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--sep);
  background: var(--white);
  color: var(--text-dim);
  cursor: pointer;
  transition: all .15s;
}
.mode-tab:hover { border-color: var(--orange); color: var(--orange); }
.mode-tab.active { background: var(--orange); border-color: var(--orange); color: var(--white); }

.color-swatch {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1px solid var(--sep);
  vertical-align: middle;
  margin-top: 2px;
}

#bg-before { cursor: crosshair; }
#bg-after { cursor: crosshair; touch-action: none; width: 100%; height: auto; }

.thumb-item.marked-delete { opacity: 0.4; border-color: var(--err); }

.cut-toggle {
  align-self: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px dashed var(--beige);
  background: var(--white);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.cut-toggle:hover { border-color: var(--orange); color: var(--orange); }
.cut-toggle.active { background: var(--orange); border-color: var(--orange); color: var(--white); }

#qr-canvas-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  padding: 16px;
  background: var(--card2);
  border-radius: var(--radius);
}
#qr-canvas-wrap canvas, #qr-canvas-wrap svg {
  max-width: 100%;
  border-radius: 8px;
}

input[type="color"] {
  padding: 2px;
  width: 48px;
  height: 34px;
  cursor: pointer;
}

input[type="file"] {
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text-dim);
}

input[type="text"], input[type="number"], select, textarea {
  font-family: inherit;
  font-size: 0.92rem;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid var(--sep);
  background: var(--white);
  color: var(--text);
}
input[type="text"]:focus, input[type="number"]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--orange);
}

textarea { width: 100%; resize: vertical; margin-bottom: 12px; }

input[type="range"] { vertical-align: middle; accent-color: var(--orange); }
input[type="checkbox"] { accent-color: var(--orange); }

.btn-primary, .btn-secondary {
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  margin-right: 8px;
  margin-top: 4px;
  transition: background .15s, color .15s;
}

.btn-primary {
  background: var(--orange);
  color: var(--white);
}
.btn-primary:hover { background: var(--hdr); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--sep);
}
.btn-secondary:hover { border-color: var(--orange); color: var(--orange); }

.file-list, .thumb-list {
  margin-bottom: 16px;
}

.file-item {
  padding: 7px 10px;
  border: 1px solid var(--sep);
  border-radius: 7px;
  font-size: 0.85rem;
  margin-bottom: 6px;
  background: var(--white);
}

.thumb-list {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.thumb-item {
  width: 140px;
  border: 1px solid var(--sep);
  border-radius: 8px;
  padding: 8px;
  background: var(--white);
  text-align: center;
}

.thumb-item img {
  width: 100%;
  height: 110px;
  object-fit: contain;
  border-radius: 4px;
  margin-bottom: 6px;
  background: #fff;
}

.thumb-controls {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.thumb-controls button, .thumb-item button {
  font-size: 0.78rem;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--sep);
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}
.thumb-controls button:hover, .thumb-item button:hover { border-color: var(--orange); color: var(--orange); }

.progress { margin: 14px 0; }
.progress-track {
  height: 8px;
  border-radius: 4px;
  background: var(--card);
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--orange);
  transition: width .2s;
}
.progress-label { font-size: 0.8rem; color: var(--text-dim); }

.progress-bar.indeterminate {
  width: 40% !important;
  animation: progress-sweep 1.2s ease-in-out infinite;
}
@keyframes progress-sweep {
  0% { margin-left: 0%; }
  50% { margin-left: 58%; }
  100% { margin-left: 0%; }
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: bold;
  margin-left: 8px;
  vertical-align: middle;
}
.badge-orange { background: #FDE9D4; color: var(--orange); }
.badge-green  { background: #D4EDDA; color: var(--ok); }
.badge-brown  { background: var(--card); color: var(--hdr); }

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}

.toast {
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--white);
  border: 1px solid var(--sep);
  color: var(--text);
  font-size: 0.88rem;
  box-shadow: 0 8px 32px rgba(74,46,26,0.18);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s, transform .25s;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-left: 3px solid var(--ok); }
.toast-error { border-left: 3px solid var(--err); }

/* ---- Badges numériques ---- */
.badges-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.badges-sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 20px;
}
.badge-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 70vh;
  overflow-y: auto;
}
.badge-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--sep);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
  font-size: 0.85rem;
}
.badge-list-item:hover { border-color: var(--orange); }
.badge-list-item.active { border-color: var(--orange); background: #FDE9D4; }
.badge-list-item .avatar {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
  background: var(--card); flex-shrink: 0;
}
.badge-list-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-list-item .del-btn {
  color: var(--text-dim); background: none; border: none; cursor: pointer;
  font-size: 0.95rem; padding: 2px 4px; line-height: 1;
}
.badge-list-item .del-btn:hover { color: var(--err); }

.badges-main { flex: 1; min-width: 0; }

.dropzone-sm { padding: 16px; margin-bottom: 8px; }

.bd-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.bd-row select { flex: 0 0 140px; }
.bd-row input[type="text"] { flex: 1; }
.bd-row .remove-btn {
  background: none; border: 1px solid var(--sep); border-radius: 6px; color: var(--text-dim);
  width: 30px; height: 30px; cursor: pointer; flex-shrink: 0; font-size: 0.9rem;
}
.bd-row .remove-btn:hover { border-color: var(--err); color: var(--err); }

.badge-preview-frame {
  width: 100%;
  height: 480px;
  border: 1px solid var(--sep);
  border-radius: var(--radius);
  background: #fff;
}

.qr-mini-wrap {
  display: flex;
  justify-content: center;
  padding: 10px;
  background: var(--card2);
  border-radius: 8px;
  margin-bottom: 8px;
  min-height: 80px;
  align-items: center;
}
.qr-mini-wrap canvas { max-width: 100%; border-radius: 6px; }

#bd-print-preview-wrap {
  display: flex;
  justify-content: center;
  margin: 16px 0;
  min-width: 0;
  overflow: hidden;
}
#bd-print-preview-wrap canvas {
  display: block;
  max-width: 100%;
  height: auto;
  min-width: 0;
  border: 1px solid var(--sep);
  border-radius: 8px;
}

@media (max-width: 900px) {
  .badges-layout { flex-direction: column; }
  .badges-sidebar { width: 100%; position: static; }
}

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .main { padding: 24px 18px; max-width: 100%; }
}
