/* ═══════════════════════════════════════════════
   The Digital Sample Gallery — Shared Stylesheet
   ═══════════════════════════════════════════════ */

/* ── Reset & Base ───────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #FFFFFF;
  --bg-alt: #F7F7F5;
  --bg-card: #FFFFFF;
  --border: #E8E8E4;
  --accent: #1A1A1A;
  --accent-hover: #333333;
  --muted: #6B6B6B;
  --muted-light: #9A9A9A;
  --chip-bg: #F2F2F0;
  --chip-active-bg: #1A1A1A;
  --chip-active-fg: #FFFFFF;
  --panel-width: 340px;
  --radius-card: 14px;
  --radius-chip: 999px;
  --radius-viewer: 16px;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 8px 28px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  --transition: 0.2s ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--accent);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font-family: var(--font);
  cursor: pointer;
  border: none;
  background: none;
}

/* ── Hero Section ───────────────────────────── */
.hero {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 56px 48px 48px;
}

.hero__eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}

.hero__title {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--accent);
  margin-bottom: 16px;
}

.hero__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hero__brand {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--chip-bg);
  padding: 4px 12px;
  border-radius: var(--radius-chip);
}

.hero__buyer {
  font-size: 13px;
  color: var(--muted);
}

.hero__buyer strong {
  color: var(--accent);
  font-weight: 500;
}

/* ── Product Grid Section ───────────────────── */
.section-grid {
  background: var(--bg-alt);
  padding: 48px;
}

.section-grid__header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 28px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-count {
  font-size: 13px;
  color: var(--muted-light);
}

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

/* ── Product Card ───────────────────────────── */
.product-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  border: 1px solid var(--border);
}

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

.product-card.active {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.product-card__thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg-alt);
}

.product-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.product-card:hover .product-card__thumb img {
  transform: scale(1.04);
}

.product-card__body {
  padding: 14px 16px 16px;
}

.product-card__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.product-card__id {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--chip-bg);
  padding: 2px 8px;
  border-radius: var(--radius-chip);
  letter-spacing: 0.03em;
}

/* ── Viewer Section ─────────────────────────── */
.section-viewer {
  background: var(--bg);
  padding: 48px;
}

.viewer-layout {
  display: grid;
  grid-template-columns: 1fr var(--panel-width);
  gap: 24px;
  align-items: start;
}

/* ── Viewer Canvas Container ────────────────── */
.viewer-canvas-wrap {
  position: relative;
  height: 70vh;
  min-height: 480px;
  border-radius: var(--radius-viewer);
  overflow: hidden;
  background: #F5F5F5;
  border: 1px solid var(--border);
}

#three-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Loading overlay */
.viewer-loading {
  position: absolute;
  inset: 0;
  background: #F5F5F5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.viewer-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-ring {
  width: 36px;
  height: 36px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.viewer-loading__text {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* 2D panel (replaces canvas) */
.viewer-2d-wrap {
  position: absolute;
  inset: 0;
  background: #F5F5F5;
  display: none;
  flex-direction: column;
  z-index: 5;
}

.viewer-2d-wrap.visible {
  display: flex;
}

.viewer-2d-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.viewer-2d-toolbar__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex: 1;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  background: var(--chip-bg);
  transition: background var(--transition), color var(--transition);
  line-height: 1;
}

.icon-btn:hover {
  background: var(--accent);
  color: #fff;
}

.viewer-2d-img-wrap {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#pattern-img {
  max-width: 100%;
  max-height: 100%;
  user-select: none;
  object-fit: contain;
}

/* ── Side Panel ─────────────────────────────── */
.side-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-viewer);
  padding: 24px;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.side-panel::-webkit-scrollbar {
  width: 4px;
}

.side-panel::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.panel-product-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
  line-height: 1.3;
  margin-bottom: 8px;
}

.panel-product-id {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--chip-bg);
  padding: 3px 10px;
  border-radius: var(--radius-chip);
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.panel-date {
  font-size: 12px;
  color: var(--muted-light);
  margin-bottom: 16px;
}

.panel-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.panel-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-light);
  margin-bottom: 10px;
}

/* Print details */
.print-details {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
  white-space: pre-line;
  background: var(--bg-alt);
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
}

/* ── Chip Buttons ───────────────────────────── */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-chip);
  font-size: 12px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  color: var(--accent);
  background: var(--bg);
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--accent);
  background: var(--chip-bg);
  transform: translateY(-1px);
}

.chip.active {
  background: var(--chip-active-bg);
  color: var(--chip-active-fg);
  border-color: var(--chip-active-bg);
}

/* color chips */
.chip--color {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border-width: 2px;
  position: relative;
}

.chip--color.active::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent);
}

/* pill action buttons */
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-chip);
  font-size: 13px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  width: 100%;
  justify-content: center;
}

.pill-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.pill-btn--outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--border);
}

.pill-btn--outline:hover {
  background: var(--chip-bg);
  border-color: var(--accent);
}

/* ── Material variant select ────────────────── */
.variant-select-wrap {
  position: relative;
}

.variant-select {
  width: 100%;
  padding: 8px 36px 8px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  font-family: var(--font);
  font-size: 13px;
  color: var(--accent);
  background: var(--bg);
  appearance: none;
  cursor: pointer;
  transition: border-color var(--transition);
}

.variant-select:focus {
  outline: none;
  border-color: var(--accent);
}

.variant-select-wrap::after {
  content: '▾';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}

/* ── Renders Section ────────────────────────── */
.section-renders {
  background: var(--bg-alt);
  padding: 48px;
  border-top: 1px solid var(--border);
}

.renders-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 24px;
}

.renders-title span {
  color: var(--accent);
  font-weight: 700;
}

.renders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.render-item {
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  background: var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
  border: 1px solid var(--border);
}

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

.render-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.render-item:hover img {
  transform: scale(1.05);
}

/* ── Lightbox ───────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox__img-wrap {
  max-width: 88vw;
  max-height: 88vh;
  position: relative;
}

.lightbox__img {
  max-width: 88vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.lightbox__counter {
  position: absolute;
  bottom: -32px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 500;
  white-space: nowrap;
}

.lightbox__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
  backdrop-filter: blur(8px);
}

.lightbox__btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox__prev {
  left: -60px;
}

.lightbox__next {
  right: -60px;
}

.lightbox__close {
  position: fixed;
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ── Empty / Error states ───────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--muted);
}

.empty-state__icon {
  font-size: 40px;
  margin-bottom: 16px;
}

.empty-state__title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--accent);
}

.empty-state__sub {
  font-size: 13px;
}

/* ── No-product placeholder ─────────────────── */
.viewer-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--muted);
}

.viewer-placeholder__icon {
  font-size: 40px;
}

.viewer-placeholder__text {
  font-size: 13px;
  font-weight: 500;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 1024px) {
  .viewer-layout {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
    max-height: none;
  }

  :root {
    --panel-width: 100%;
  }
}

@media (max-width: 768px) {

  .hero,
  .section-grid,
  .section-viewer,
  .section-renders {
    padding: 32px 20px;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .renders-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .lightbox__prev {
    left: 8px;
  }

  .lightbox__next {
    right: 8px;
  }
}

/* ── Utility ────────────────────────────────── */
.hidden {
  display: none !important;
}

.mt-8 {
  margin-top: 8px;
}

.mt-12 {
  margin-top: 12px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-20 {
  margin-top: 20px;
}

/* ── Measure Tool Overlay ───────────────────── */
.measure-overlay {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 260px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  z-index: 100;
  overflow: hidden;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.measure-overlay__header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-alt);
}

.measure-overlay__title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.measure-overlay__close {
  font-size: 14px;
  color: var(--muted);
  transition: color var(--transition);
}

.measure-overlay__close:hover {
  color: var(--accent);
}

.measure-overlay__body {
  padding: 16px;
}

.measure-value-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.measure-label {
  font-size: 10px;
  color: var(--muted-light);
  font-weight: 600;
  text-transform: uppercase;
}

.measure-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.measure-disclaimer {
  font-size: 10px;
  line-height: 1.4;
  color: var(--muted-light);
  font-style: italic;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

/* Dark mode override for measure overlay */
.viewer-canvas-wrap[data-bg="dark"] .measure-overlay {
  background: rgba(30, 30, 30, 0.85);
  border-color: rgba(255,255,255,0.1);
  color: #fff;
}

.viewer-canvas-wrap[data-bg="dark"] .measure-overlay__header {
  background: rgba(40, 40, 40, 0.5);
  border-bottom-color: rgba(255,255,255,0.1);
}

.viewer-canvas-wrap[data-bg="dark"] .measure-value {
  color: #fff;
}

.viewer-canvas-wrap[data-bg="dark"] .measure-overlay__title {
  color: var(--muted-light);
}

/* ═══════════════════════════════════════════════
   Viewer Vertical Toolbar
   Floating tool panel on the LEFT edge of the
   viewer canvas — like Blender / Figma toolbars.
   ═══════════════════════════════════════════════ */

.viewer-toolbar {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  padding: 8px 6px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.10), 0 1px 4px rgba(0, 0, 0, 0.06);
  user-select: none;
}

.vtb-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4A4A4A;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
  flex-shrink: 0;
}

.vtb-btn svg {
  width: 17px;
  height: 17px;
  pointer-events: none;
  flex-shrink: 0;
}

.vtb-btn:hover {
  background: rgba(0, 0, 0, 0.07);
  color: #1A1A1A;
  transform: scale(1.06);
}

.vtb-btn.active {
  background: #1A1A1A;
  color: #FFFFFF;
}

.vtb-btn.active:hover {
  background: #333333;
  color: #FFFFFF;
}

/* Tooltip — appears to the RIGHT of each button */
.vtb-tooltip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: #1A1A1A;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  padding: 4px 9px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  letter-spacing: 0.03em;
  z-index: 30;
}

.vtb-tooltip::before {
  content: '';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: #1A1A1A;
}

.vtb-btn:hover .vtb-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.vtb-divider {
  width: 22px;
  height: 1px;
  background: rgba(0, 0, 0, 0.10);
  margin: 4px 0;
  flex-shrink: 0;
}

.vtb-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9A9A9A;
  margin: 2px 0;
  line-height: 1;
}

.vtb-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: block;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.vtb-bg-btn.active .vtb-swatch,
.vtb-man-btn.active .vtb-swatch {
  outline: 2px solid #1A1A1A;
  outline-offset: 2px;
}

/* Dark background mode — flip toolbar skin */
.viewer-canvas-wrap[data-bg="dark"] .viewer-toolbar {
  background: rgba(28, 28, 28, 0.88);
  border-color: rgba(255, 255, 255, 0.10);
}

.viewer-canvas-wrap[data-bg="dark"] .vtb-btn {
  color: #AAAAAA;
}

.viewer-canvas-wrap[data-bg="dark"] .vtb-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #FFF;
}

.viewer-canvas-wrap[data-bg="dark"] .vtb-btn.active {
  background: #FFFFFF;
  color: #1A1A1A;
}

#vtb-schematic.active {
  color: var(--accent);
  background: rgba(0, 0, 0, 0.05);
}

.viewer-canvas-wrap[data-bg="dark"] #vtb-schematic.active {
  color: #1A1A1A;
  background: #FFF;
}

.viewer-canvas-wrap[data-bg="dark"] .vtb-divider {
  background: rgba(255, 255, 255, 0.12);
}

.viewer-canvas-wrap[data-bg="dark"] .vtb-label {
  color: #555;
}

.viewer-canvas-wrap[data-bg="dark"] .vtb-bg-btn.active .vtb-swatch,
.viewer-canvas-wrap[data-bg="dark"] .vtb-man-btn.active .vtb-swatch {
  outline-color: #FFF;
}

/* Keep toolbar visible in fullscreen */
:-webkit-full-screen .viewer-toolbar {
  display: flex;
}

:-moz-full-screen .viewer-toolbar {
  display: flex;
}

:fullscreen .viewer-toolbar {
  display: flex;
}

/* ─── Markup Modal ─── */
.markup-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 75vw;
  height: 75vh;
  background: #FFF;
  border-radius: 20px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.25);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.markup-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.markup-modal__header {
  height: 60px;
  background: #FFF;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 15px;
  color: #1A1A1A;
}

.markup-modal__title {
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  flex-shrink: 0;
}

.markup-modal__tools {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.04); /* Matches toolbar look but light */
  padding: 4px;
  border-radius: 10px;
}

.tool-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #666;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.tool-btn svg {
  width: 18px;
  height: 18px;
}

.tool-btn:hover {
  background: #FFF;
  color: #000;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.tool-btn.active {
  background: var(--accent);
  color: #FFF;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.tool-btn--danger:hover {
  background: #FFE3E3;
  color: #E03131;
}

.tool-divider {
  width: 1px;
  height: 18px;
  background: rgba(0, 0, 0, 0.1);
  margin: 0 4px;
}

/* Fix save button width */
#markup-save {
  width: auto;
  min-width: 120px;
  padding: 8px 20px;
  font-size: 12px;
}

.markup-modal__close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent; /* Removed background */
  color: #888;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.markup-modal__close:hover {
  color: #000;
}

.markup-modal__body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #F9FAFB;
  overflow: hidden;
}

.markup-canvas-container {
  background: #FFF;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  max-width: 100%;
  max-height: 100%;
  position: relative;
  overflow: hidden;
}

#markup-canvas-bg, 
#markup-canvas-draw {
  display: block;
  max-width: 100%;
  max-height: calc(75vh - 100px);
  cursor: crosshair;
}

#markup-canvas-draw {
  position: absolute;
  top: 0;
  left: 0;
}

/* Mobile Friendly Adjustments */
@media (max-width: 768px) {
  .markup-modal {
    width: 95vw;
    height: 90vh;
    border-radius: 15px;
  }
  
  .markup-modal__header {
    padding: 0 15px;
    height: auto;
    padding-top: 15px;
    padding-bottom: 15px;
    flex-wrap: wrap;
    justify-content: space-between;
  }
  
  .markup-modal__title {
    width: 100%;
    margin-bottom: 10px;
    text-align: center;
  }
  
  .markup-modal__tools {
    order: 2;
    margin-top: 10px;
  }
  
  #markup-save {
    order: 3;
    margin-top: 10px;
    width: 100%; /* Take full width on mobile for better touch target */
  }
  
  .markup-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
  }
}