/* =====================================================
   DESIGNER WRAPPER
===================================================== */

.designer-shell {
  max-width: 1200px;
  margin: 0 auto;
}

/* =====================================================
   MASTER GRID (THE FIX)
===================================================== */

/* === HARD LOCK GRID COLUMNS === */
.designer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 280px;
  grid-template-rows: auto 1fr;
  gap: 16px;
  align-items: stretch;
}

/* Grid placement */
.designer-canvas { grid-column: 1 / span 3; grid-row: 1; }
.designer-order  { grid-column: 4; grid-row: 1 / span 2; }
.tool-image      { grid-column: 1; grid-row: 2; }
.tool-text       { grid-column: 2; grid-row: 2; }
.tool-align      { grid-column: 3; grid-row: 2; }

/* Force grid children to obey column width */
.tool-image,
.tool-text,
.tool-align {
  min-width: 0;
  width: 100%;
  display: flex;
}

.tool-image .tool-card,
.tool-text .tool-card,
.tool-align .tool-card {g
  width: 100%;
  height: 100%;
}

/* ===============================
   MUG POSITION GUIDES (FINAL)
================================ */

.mug-guides {
  position: relative;
  width: 100%;
  margin-top: 10px;
  font-size: 0.85rem;
  color: #6c757d;
  height: 24px;
}

.mug-guides .guide-left {
  position: absolute;
  left: 0;
}

.mug-guides .guide-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.mug-guides .guide-right {
  position: absolute;
  right: 0;
}

/* =====================================================
   TOOL CARDS
===================================================== */

.tool-card {
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
}

.tool-card .card-body {
  padding: 10px;
}

.tool-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
  color: #555;
}

.price {
  font-size: 18px;
  font-weight: 700;
}

.approve {
  font-size: 14px;
}

/* =====================================================
   GRID (VISIBLE, NOT EXPORTED)
===================================================== */

.canvas-grid-line {
  stroke: rgba(0,0,0,0.12);
  stroke-width: 1;
  pointer-events: none;
}

/* =====================================================
   RESPONSIVE
===================================================== */


.order-panel {
  display: flex;
}

.order-panel .tool-card {
  height: 100%;
}

/* Order card must span full grid height */
.order-panel {
  display: flex;
}

.order-panel .tool-card {
  height: 100%;
}

/* FORCE canvas to align with cards below */
.canvas-wrap {
  margin-bottom: 0 !important;
}

/* Prevent layer buttons wrapping */
#bringForward,
#sendBackward {
  white-space: nowrap;
  font-size: 12px;
  padding-left: 6px;
  padding-right: 6px;
}

/* ===============================
   WRAPPER
================================ */

.designer-shell {
  max-width: 1200px;
  margin: 0 auto;
}

/* ===============================
   MASTER GRID
================================ */

.designer-canvas {
  display: flex;
  flex-direction: column;
  align-items: stretch;   /* 🔥 instead of center */
}

/* Placement */
.designer-canvas { grid-column: 1 / span 3; grid-row: 1; }
.designer-order  { grid-column: 4; grid-row: 1 / span 2; }
.tool-image      { grid-column: 1; grid-row: 2; }
.tool-text       { grid-column: 2; grid-row: 2; }
.tool-align      { grid-column: 3; grid-row: 2; }

/* Equal width cards */
.tool-image,
.tool-text,
.tool-align {
  min-width: 0;
  display: flex;
}

.tool-image .tool-card,
.tool-text .tool-card,
.tool-align .tool-card {
  width: 100%;
  height: 100%;
}

/* ===============================
   CANVAS
================================ */

.canvas-wrap {
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fafafa;
  overflow: visible;
  margin-bottom: 0;

  text-align: center;   /* center canvas safely */
}

.canvas-scale {
  transform-origin: top left;
}

/* ===============================
   CARDS
================================ */

.tool-card {
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
}

.tool-card .card-body {
  padding: 10px;
}

.tool-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
  color: #555;
}

.price {
  font-size: 18px;
  font-weight: 700;
}

.approve {
  font-size: 14px;
}

/* Prevent wrapping */
#bringForward,
#sendBackward {
  white-space: nowrap;
  font-size: 12px;
}

/* ===============================
   RESPONSIVE – TABLET & MOBILE
================================ */

@media (max-width: 992px) {

  .designer-grid {
    grid-template-columns: 1fr;
  }

  /* Force single column */
  .designer-grid > * {
    grid-column: 1 !important;
  }

  /* Explicit mobile order */
  .designer-canvas { grid-row: 1 !important; }
  .tool-image      { grid-row: 2 !important; }
  .tool-text       { grid-row: 3 !important; }
  .tool-align      { grid-row: 4 !important; }
  .designer-order  { grid-row: 5 !important; }

  /* Order panel layout */
  .designer-order .d-flex {
    flex-direction: column;
  }

  .designer-order #qty {
    max-width: 100%;
  }

}


#addToCart:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


.canvas-wrap {
  text-align: center;
}

.canvas-wrap canvas {
  display: inline-block !important;
}

.canvas-wrap {
  display: flex;
  justify-content: center;
}

.canvas-wrap .canvas-container {
  margin: 0 auto;
}

/* Ensure grid behaves predictably */
.designer-grid {
    display: grid;
    gap: 20px;
}

/* ======================
   TABLET (≤ 1200px)
====================== */
@media (max-width: 1200px) {

    .designer-grid {
        grid-template-columns: 1fr 1fr;
    }

    .canvas-wrap {
        grid-column: span 2;
    }
}

/* ======================
   MOBILE (≤ 768px)
====================== */
@media (max-width: 768px) {

    .designer-grid {
        grid-template-columns: 1fr;
    }

    .canvas-wrap,
    .designer-order,
    .tool-image,
    .tool-text,
    .tool-align {
        grid-column: span 1;
        width: 100%;
    }

    /* Prevent button overflow */
    .tool-align .row > .col-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Prevent text wrapping weirdness */
    .tool-align button,
    .tool-text button,
    .tool-image button {
        white-space: normal;
    }

    /* Order panel quantity + button stack */
    .designer-order .d-flex {
        flex-direction: column;
    }

    .designer-order #qty {
        max-width: 100%;
    }
}

/* ===============================
   MOBILE FIX – REMOVE SIDE GUTTERS
================================ */

@media (max-width: 768px) {

  .site-inner {
    padding-left: 15px !important;
    padding-right: 15px !important;
    background: #ffffff; /* remove gradient gutter */
  }

}

.guide-left {
  position: absolute;
  left: 0;
  text-align: left;
}

.guide-centre {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.guide-right {
  position: absolute;
  right: 0;
  text-align: right;
}

.canvas-wrap canvas {
  display: inline-block;
}

.canvas-notes {
  width: 100%;
}
