:root {
  --brand-radius: 16px;
}

* {
  font-family: "Noto Sans Lao", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.card {
  border-radius: var(--brand-radius);
}

.btn, .form-control, .form-select, .badge, .alert {
  border-radius: 14px;
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: .2px;
}

.design-code {
  font-size: 1.05rem;
  letter-spacing: .5px;
}

.price-big {
  font-size: 1.6rem;
  font-weight: 800;
}

.muted-small {
  font-size: .9rem;
  opacity: .85;
}

.tag-pill {
  text-decoration: none;
  border: 1px solid var(--bs-border-color);
  padding: .2rem .6rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.tag-pill:hover {
  background: var(--bs-tertiary-bg);
}

.img-cover {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-top-left-radius: var(--brand-radius);
  border-top-right-radius: var(--brand-radius);
}

.img-thumb {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 12px;
}

.hero {
  border-radius: var(--brand-radius);
  overflow: hidden;
}

.hero img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  display: block;
}

.table td, .table th {
  vertical-align: middle;
}

.file-pill {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .7rem;
  border-radius: 999px;
  background: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
}

/* --- Custom design request pattern UI --- */
.pattern-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 768px) {
  .pattern-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.pattern-panel {
  position: relative;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--brand-radius);
  padding: 12px;
  background: var(--bs-body-bg);
  overflow: hidden;
  min-height: 380px;
}

.pattern-title {
  position: absolute;
  top: 10px;
  left: 12px;
  font-weight: 800;
  font-size: .85rem;
  opacity: .55;
  letter-spacing: .8px;
}

.pattern-svg {
  width: 100%;
  height: 340px;
  display: block;
}

.pattern-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #111;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}

.pattern-marker.filled {
  outline: 3px solid rgba(255,255,255,.55);
}

.marker-green { background: #35c46a; }
.marker-yellow { background: #ffd24a; }
.marker-teal { background: #3dd5f3; }

/* New SVG pattern editor (single stage) */
.pattern-stage {
  position: relative;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--brand-radius);
  padding: 12px;
  background: var(--bs-body-bg);
  overflow: auto;
}

.pattern-stage svg {
  width: 100%;
  height: auto;
  display: block;
}

.pattern-stage .slot-target {
  /* Template helpers: keep invisible and non-clickable */
  cursor: default;
  fill: rgba(0,0,0,0) !important;
  stroke: rgba(0,0,0,0) !important;
  pointer-events: none;
}

/* No hover/filled outlines (kept here in case of older cached JS) */
.pattern-stage .slot-target:hover,
.pattern-stage .slot-filled {
  stroke: rgba(0,0,0,0) !important;
}

.pattern-stage .slot-marker circle {
  fill: rgba(255,255,255,.9);
  stroke: rgba(0,0,0,.25);
  stroke-width: 1;
}

.pattern-stage .slot-marker text {
  fill: rgba(0,0,0,.65);
  font-size: 9px;
  font-family: var(--bs-font-sans-serif);
}

[data-bs-theme="dark"] .pattern-stage .slot-marker circle {
  fill: rgba(255,255,255,.12);
  stroke: rgba(255,255,255,.25);
}

[data-bs-theme="dark"] .pattern-stage .slot-marker text {
  fill: rgba(255,255,255,.85);
}

.pattern-stage .draggable-text {
  cursor: move;
}



/* --- Simple editor (image-based customize page) --- */
.editor-stage{
  position: relative;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--brand-radius);
  background: rgba(255,255,255,0.02);
  overflow: hidden;
  min-height: 360px;
}
.editor-base{
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.editor-overlay{
  position: absolute;
  left: 0;
  top: 0;
  touch-action: none;
}
.editor-item{
  position: absolute;
  transform-origin: center center;
  touch-action: none;
  user-select: none;
}
.editor-item img{
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.editor-item .text-content{
  width: 100%;
  height: 100%;
  white-space: pre-wrap;
  line-height: 1.1;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}
.editor-item.selected{
  outline: 2px dashed rgba(0, 255, 153, 0.8);
  outline-offset: 2px;
}
.editor-handle{
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.35);
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.editor-handle.nw{ left: -8px; top: -8px; cursor: nwse-resize; }
.editor-handle.ne{ right: -8px; top: -8px; cursor: nesw-resize; }
.editor-handle.sw{ left: -8px; bottom: -8px; cursor: nesw-resize; }
.editor-handle.se{ right: -8px; bottom: -8px; cursor: nwse-resize; }
.editor-handle.rotate{
  left: 50%;
  top: -34px;
  transform: translateX(-50%);
  cursor: grab;
  width: 18px;
  height: 18px;
  border-radius: 999px;
}
.editor-handle.rotate:active{ cursor: grabbing; }

.layer-item.active{
  border-color: rgba(0, 255, 153, 0.8) !important;
}

.editor-item .editor-handle{ display:none; }
.editor-item.selected .editor-handle{ display:block; }
