/* nallium-vistera-frontend — design system
 *
 * Tokens (:root) et classes de "chrome" (topbar, boutons, panels, alertes)
 * copiés à l'identique de nallium-drive-frontend/css/style.css pour rester
 * visuellement cohérent avec le reste de l'écosystème Nallium — étendus
 * avec les éléments propres à un éditeur de design (grille de designs,
 * toolbar, rail de pages, canevas, panneau de calques).
 */

:root {
  --text: #172033;
  --muted: #64748b;
  --blue: #3b82f6;
  --green: #22c55e;
  --amber: #f59e0b;
  --pink: #ec4899;
  --violet: #8b5cf6;
  --red: #ef4444;
  --cyan: #06b6d4;
  --bg: #f7f9ff;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-solid: #ffffff;
  --border: rgba(30, 41, 59, 0.12);
  --shadow: 0 24px 80px rgba(30, 41, 59, 0.12);
  --shadow-soft: 0 14px 38px rgba(30, 41, 59, 0.09);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 4%, rgba(59, 130, 246, 0.16), transparent 28%),
    radial-gradient(circle at 90% 12%, rgba(236, 72, 153, 0.12), transparent 24%),
    radial-gradient(circle at 72% 88%, rgba(34, 197, 94, 0.13), transparent 26%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--blue);
  text-decoration: none;
}

button {
  font: inherit;
}

.btn {
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  padding: 8px 14px;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 13px;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
}

.btn-outline {
  background: var(--panel-solid);
  border-color: var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background: #eef2ff;
}

.btn-danger {
  background: #fff1f2;
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--red);
}

.btn-danger:hover {
  background: #ffe4e6;
}

/* ---------------------------------------------------------------------
 * Barre de navigation
 * ------------------------------------------------------------------- */
.store-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.store-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: #0f172a;
  cursor: pointer;
}

.store-brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: linear-gradient(135deg, var(--violet), var(--pink));
}

.vs-topbar-spacer {
  flex: 1;
}

.vs-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vs-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.store-page {
  padding: 24px 28px 60px;
  max-width: 1400px;
  margin: 0 auto;
}

.alert-banner {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-banner.error {
  background: #fff1f2;
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
}

.empty-icon {
  font-size: 42px;
  margin-bottom: 12px;
}

.login-gate {
  text-align: center;
  padding: 80px 20px;
}

/* ---------------------------------------------------------------------
 * Liste "Mes designs" / Corbeille
 * ------------------------------------------------------------------- */
.vs-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.vs-list-header h2 {
  font-size: 22px;
  font-weight: 800;
  margin: 0;
}

.vs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.vs-card {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.vs-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.vs-card-thumb {
  position: relative;
  width: 100%;
  background: linear-gradient(135deg, #eef2ff, #fdf2f8);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.vs-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vs-card-placeholder {
  font-size: 36px;
  opacity: 0.5;
}

.vs-card-star {
  position: absolute;
  top: 8px;
  right: 8px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.vs-card-body {
  padding: 10px 12px;
}

.vs-card-name {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vs-card-meta {
  font-size: 12px;
  color: var(--muted);
}

.vs-card-actions {
  display: flex;
  gap: 4px;
  padding: 0 12px 10px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------------
 * Modale de création / publication
 * ------------------------------------------------------------------- */
.vs-modal-content {
  border-radius: 18px;
  border: none;
}

.vs-field-label {
  font-weight: 700;
  font-size: 13px;
  display: block;
  margin-bottom: 4px;
}

.vs-field-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}

#vs-create-tabs {
  margin-bottom: 16px;
}

.vs-create-tab-body {
  min-height: 200px;
}

.vs-format-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.vs-format-card {
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  background: var(--panel-solid);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.vs-format-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
}

.vs-format-card.selected {
  border-color: var(--blue);
  background: #eff6ff;
}

.vs-format-icon {
  font-size: 26px;
}

.vs-format-label {
  font-weight: 600;
  font-size: 13px;
  margin-top: 4px;
}

.vs-format-dims {
  font-size: 11px;
  color: var(--muted);
}

.vs-custom-dims {
  display: flex;
  gap: 16px;
}

.vs-custom-dims label {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vs-custom-dims input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  width: 110px;
}

.vs-template-category {
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 12px 0 8px;
}

.vs-template-thumb {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #eef2ff;
  margin-bottom: 6px;
}

.vs-template-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------------------------------------------------------------------
 * Éditeur — toolbar
 * ------------------------------------------------------------------- */
.vs-toolbar {
  position: sticky;
  top: 65px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.vs-name-input {
  border: 1px solid transparent;
  background: transparent;
  font-weight: 700;
  font-size: 15px;
  padding: 6px 8px;
  border-radius: 8px;
  width: 200px;
}

.vs-name-input:hover,
.vs-name-input:focus {
  border-color: var(--border);
  background: var(--panel-solid);
}

.divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

.toolbar-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.toolbar-field input[type="number"] {
  width: 60px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
}

.toolbar-field input[type="color"] {
  width: 30px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}

.vs-save-status {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.vs-shape-dropdown {
  position: relative;
}

.vs-shape-menu {
  position: absolute;
  top: 110%;
  left: 0;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
  z-index: 30;
  min-width: 140px;
  overflow: hidden;
}

.vs-shape-menu-item {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.vs-shape-menu-item:hover {
  background: #eef2ff;
}

/* ---------------------------------------------------------------------
 * Éditeur — mise en page (rail | canevas | calques)
 * ------------------------------------------------------------------- */
.vs-shell {
  display: grid;
  grid-template-columns: 150px 1fr 240px;
  height: calc(100vh - 122px);
}

.vs-pages-rail {
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vs-rail-item {
  position: relative;
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  padding: 4px;
}

.vs-rail-item.active {
  border-color: var(--blue);
}

.vs-rail-number {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 2px;
}

.vs-rail-thumb {
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.vs-rail-thumb-inner {
  width: 100%;
}

.vs-rail-actions {
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  gap: 2px;
}

.vs-rail-item:hover .vs-rail-actions {
  display: flex;
}

.vs-rail-actions button {
  border: none;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 6px;
  font-size: 11px;
  padding: 2px 4px;
  cursor: pointer;
}

.vs-rail-add {
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: transparent;
  padding: 10px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.vs-canvas-area {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background: #eef1f8;
}

.vs-canvas-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vs-canvas-scalewrap {
  position: relative;
}

.vs-canvas {
  position: relative;
  transform-origin: top left;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.vs-element {
  position: absolute;
  cursor: move;
}

.vs-element.el-text {
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.vs-element.el-shape.shape-ellipse {
  border-radius: 50%;
}

.vs-element.el-shape.shape-line {
  border-radius: 2px;
}

.vs-element.el-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.vs-image-loading {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef2ff;
  font-size: 20px;
}

.vs-element.selected {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 2px solid var(--blue);
  border-radius: 50%;
}

.resize-handle.h-nw {
  top: -6px;
  left: -6px;
  cursor: nwse-resize;
}

.resize-handle.h-ne {
  top: -6px;
  right: -6px;
  cursor: nesw-resize;
}

.resize-handle.h-sw {
  bottom: -6px;
  left: -6px;
  cursor: nesw-resize;
}

.resize-handle.h-se {
  bottom: -6px;
  right: -6px;
  cursor: nwse-resize;
}

.rotate-handle {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid var(--violet);
  border-radius: 50%;
  cursor: grab;
}

/* ---------------------------------------------------------------------
 * Panneau de calques
 * ------------------------------------------------------------------- */
.vs-layers-panel {
  border-left: 1px solid var(--border);
  padding: 14px 10px;
  overflow-y: auto;
  background: var(--panel-solid);
}

.vs-layers-title {
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.vs-layers-empty {
  font-size: 12px;
  color: var(--muted);
}

.vs-layer-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
}

.vs-layer-row:hover {
  background: #f1f5f9;
}

.vs-layer-row.active {
  background: #eff6ff;
  outline: 1px solid var(--blue);
}

.vs-layer-icon {
  font-size: 13px;
}

.vs-layer-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vs-layer-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 6px;
}

.vs-layer-btn:hover {
  background: #e2e8f0;
}

/* ---------------------------------------------------------------------
 * Responsive — mobile (voir Drive/Gather : barre d'outils empilée sous
 * 720px, panneau de calques masqué faute de place — limite assumée v1,
 * édition de designs pensée d'abord pour un usage desktop/tablette).
 * ------------------------------------------------------------------- */
@media (max-width: 900px) {
  .vs-shell {
    grid-template-columns: 90px 1fr;
  }

  .vs-layers-panel {
    display: none;
  }
}

@media (max-width: 640px) {
  .store-topbar {
    padding: 10px 14px;
  }

  .store-page {
    padding: 16px 14px 40px;
  }

  .vs-toolbar {
    top: 57px;
  }
}
