/* ============================================================
   TEE BUILDER — PRODUCTION STYLES
   Mobile-first responsive design with orange accents
   ============================================================ */

/* ── Reset & Root ──────────────────────────────────────── */

.ctb-root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1a1a1a;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 100px;
  -webkit-font-smoothing: antialiased;
}

/* ── Garment Heading ───────────────────────────────────── */

.ctb-garment-heading {
  text-align: center;
  padding: 20px 0 8px;
}

.ctb-garment-name {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
  letter-spacing: -0.3px;
}

/* ── Header ────────────────────────────────────────────── */

.ctb-header {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 100;
  padding: 12px 0 0;
  border-bottom: 1px solid #eee;
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
}

.ctb-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.ctb-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: #1a1a1a;
}

.ctb-header-price {
  text-align: right;
}

.ctb-header-price .ctb-price-total {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  display: block;
}

.ctb-header-price .ctb-price-unit {
  font-size: 12px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.ctb-discount-badge {
  background: #E8740C;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  letter-spacing: 0.3px;
}

/* ── Step Indicator ────────────────────────────────────── */

.ctb-steps {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 0;
}

.ctb-steps::-webkit-scrollbar {
  display: none;
}

.ctb-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px 10px;
  border: none;
  background: transparent;
  cursor: default;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  min-width: 0;
}

.ctb-step.done {
  cursor: pointer;
}

.ctb-step.active {
  border-bottom-color: #E8740C;
}

.ctb-step.done .ctb-step-icon {
  color: #E8740C;
}

.ctb-step-icon {
  font-size: 16px;
  line-height: 1;
}

.ctb-step-label {
  font-size: 11px;
  font-weight: 500;
  color: #999;
  white-space: nowrap;
}

.ctb-step.active .ctb-step-label {
  color: #E8740C;
  font-weight: 600;
}

.ctb-step.done .ctb-step-label {
  color: #666;
}

/* ── Content Area ──────────────────────────────────────── */

.ctb-content {
  padding-top: 20px;
}

.ctb-step-panel {
  animation: ctbFadeIn 0.25s ease;
}

@keyframes ctbFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ctb-step-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
  color: #1a1a1a;
}

.ctb-step-desc {
  font-size: 14px;
  color: #666;
  margin: 0 0 20px;
}

/* ── Step 1: Colour Grid ───────────────────────────────── */

.ctb-colour-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.ctb-colour-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px 8px;
  border: 2px solid #e5e5e5;
  border-radius: 10px;
  background: white;
  cursor: pointer;
  transition: all 0.15s;
}

.ctb-colour-btn:hover {
  border-color: #ccc;
  transform: translateY(-1px);
}

.ctb-colour-btn.active {
  border-color: #E8740C;
  box-shadow: 0 0 0 1px #E8740C;
}

.ctb-colour-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: block;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}

.ctb-colour-name {
  font-size: 10px;
  font-weight: 500;
  color: #555;
  text-align: center;
  line-height: 1.2;
}

.ctb-colour-check {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  background: #E8740C;
  color: white;
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* ── Tee Preview ───────────────────────────────────────── */

.ctb-tee-preview {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}

.ctb-tee-photo-wrap {
  text-align: center;
}

.ctb-tee-photo {
  width: 100%;
  max-width: 360px;
  height: auto;
  border-radius: 12px;
  background: #f5f5f5;
}

.ctb-tee-label {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.ctb-tee-mock {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1;
  border-radius: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 16px;
}

/* ── Step 2: Size Table ────────────────────────────────── */

.ctb-size-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.ctb-size-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #f8f8f8;
  border-radius: 10px;
  border: 1px solid #eee;
}

.ctb-size-name {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  min-width: 40px;
}

.ctb-qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.ctb-qty-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: white;
  font-size: 18px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}

.ctb-qty-btn:hover {
  background: #f0f0f0;
}

.ctb-qty-btn:disabled {
  color: #ccc;
  cursor: not-allowed;
}

.ctb-qty-btn:active {
  background: #E8740C;
  color: white;
}

.ctb-qty-input {
  width: 50px;
  text-align: center;
  border: none;
  border-left: 1px solid #eee;
  border-right: 1px solid #eee;
  font-size: 16px;
  font-weight: 600;
  padding: 8px 0;
  -moz-appearance: textfield;
  outline: none;
}

.ctb-qty-input::-webkit-outer-spin-button,
.ctb-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.ctb-pricing-summary {
  margin-top: 16px;
}

.ctb-hint-box {
  text-align: center;
  padding: 16px;
  background: #FFF5EB;
  border: 1px solid #FFD6A5;
  border-radius: 10px;
  color: #9A5A00;
  font-size: 14px;
  font-weight: 500;
}

.ctb-hint-box.ctb-hint-warning {
  background: #FFF0F0;
  border-color: #FFBDBD;
  color: #C00;
}

/* ── Step 3: Print Options ─────────────────────────────── */

.ctb-print-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.ctb-print-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid #e5e5e5;
  border-radius: 12px;
  background: white;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.ctb-print-btn:hover {
  border-color: #ccc;
}

.ctb-print-btn.active {
  border-color: #E8740C;
  background: #FFF8F2;
  box-shadow: 0 0 0 1px #E8740C;
}

.ctb-print-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.ctb-print-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ctb-print-label {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
}

.ctb-print-desc {
  font-size: 12px;
  color: #888;
}

.ctb-print-price {
  font-size: 14px;
  font-weight: 600;
  color: #E8740C;
  white-space: nowrap;
}

.ctb-print-thumbs {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.ctb-print-thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
  background: #f5f5f5;
}

.ctb-print-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  background: #E8740C;
  color: white;
  border-radius: 50%;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* ── Step 4: Designer Panel ────────────────────────────── */

.ctb-designer-panel {
  /* let the canvas fill the width */
}

/* ── Step 5: Summary ───────────────────────────────────── */

.ctb-summary-card {
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.ctb-summary-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 12px;
  color: #1a1a1a;
}

.ctb-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  color: #333;
}

.ctb-summary-row span:first-child {
  color: #666;
}

.ctb-summary-row span:last-child {
  font-weight: 500;
}

.ctb-summary-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

.ctb-summary-divider {
  border-top: 1px solid #eee;
  margin: 8px 0;
}

.ctb-summary-discount {
  color: #28a745 !important;
}

.ctb-summary-discount span {
  color: #28a745 !important;
  font-weight: 600 !important;
}

.ctb-summary-total {
  padding-top: 8px;
}

.ctb-summary-total span {
  font-size: 16px !important;
  font-weight: 700 !important;
  color: #1a1a1a !important;
}

.ctb-summary-unit {
  text-align: right;
  font-size: 13px;
  color: #888;
  margin-top: 2px;
}

/* ── Warning Box ───────────────────────────────────────── */

.ctb-warning-box {
  background: #FFF8E1;
  border: 1px solid #FFE082;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.ctb-warning-box h4 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: #E65100;
}

.ctb-warning-box p {
  margin: 0 0 8px;
  font-size: 13px;
  color: #795548;
  line-height: 1.5;
}

/* ── Legal Box ─────────────────────────────────────────── */

.ctb-legal-box {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.ctb-legal-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 10px;
  color: #1a1a1a;
}

.ctb-legal-text {
  font-size: 12px;
  color: #555;
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 8px;
  margin-bottom: 12px;
  white-space: pre-wrap;
}

/* ── Checkbox Labels ───────────────────────────────────── */

.ctb-check-label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.5;
  color: #333;
}

.ctb-check-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: #E8740C;
  cursor: pointer;
}

.ctb-legal-check {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  margin-top: 8px;
}

/* ── Add to Cart Button ────────────────────────────────── */

.ctb-atc-btn {
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: 12px;
  background: #E8740C;
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.3px;
}

.ctb-atc-btn:hover {
  background: #D06A0B;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(232, 116, 12, 0.3);
}

.ctb-atc-btn:active {
  transform: translateY(0);
}

.ctb-atc-btn.disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.ctb-atc-btn.loading {
  background: #E8740C;
  opacity: 0.7;
  cursor: wait;
}

.ctb-atc-note {
  text-align: center;
  font-size: 13px;
  color: #888;
  margin-top: 12px;
}

.ctb-link-btn {
  background: none;
  border: none;
  color: #E8740C;
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}

/* ── Navigation Buttons ────────────────────────────────── */

.ctb-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: white;
  border-top: 1px solid #eee;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  z-index: 100;
  max-width: 640px;
  margin: 0 auto;
}

.ctb-nav-back {
  flex: 0 0 auto;
  padding: 14px 20px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: white;
  color: #333;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.1s;
}

.ctb-nav-back:hover {
  background: #f5f5f5;
}

.ctb-nav-next {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: 10px;
  background: #E8740C;
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.ctb-nav-next:hover {
  background: #D06A0B;
}

.ctb-nav-next.disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* ── Price Display Component ───────────────────────────── */

.ctb-price-display {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 14px;
  font-size: 14px;
}

.ctb-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.ctb-price-main {
  font-size: 16px;
  font-weight: 600;
}

.ctb-price-label {
  color: #666;
  font-size: 13px;
}

.ctb-price-value {
  color: #1a1a1a;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ctb-price-badge {
  background: #E8740C;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
}

.ctb-price-strikethrough {
  text-decoration: line-through;
  color: #aaa;
  font-weight: 400;
  font-size: 13px;
}

.ctb-price-green {
  color: #28a745;
  font-weight: 600;
}

.ctb-price-divider {
  border-top: 1px solid #eee;
  margin: 8px 0;
}

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

.ctb-price-nudge {
  margin-top: 10px;
  background: #FFF5EB;
  color: #9A5A00;
  border: 1px solid #FFD6A5;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  text-align: center;
  font-weight: 500;
}

/* ── Designer Canvas ───────────────────────────────────── */

.ctb-designer-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ctb-mockup-wrapper {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto 12px;
}

.ctb-mockup-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

.ctb-mockup-placeholder {
  width: 100%;
  aspect-ratio: 0.85;
  border-radius: 8px;
}

.ctb-canvas-overlay {
  position: absolute;
  top: 22%;
  left: 26%;
  width: 48%;
  height: 52%;
  border: 2px dashed rgba(232, 116, 12, 0.5);
  border-radius: 4px;
  box-sizing: border-box;
  overflow: hidden;
}

.ctb-canvas-overlay canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.ctb-mockup-label {
  text-align: center;
  font-size: 11px;
  color: #888;
  margin-top: 6px;
  font-weight: 500;
}

.ctb-tab-switcher {
  display: flex;
  gap: 0;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  background: #f5f5f5;
}

.ctb-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: #888;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.ctb-tab:hover {
  color: #333;
}

.ctb-tab.ctb-tab-active {
  background: #E8740C;
  color: white;
  font-weight: 600;
}

.ctb-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  background: #f8f8f8;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
}

.ctb-tool-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: white;
  color: #444;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.1s;
}

.ctb-tool-btn:hover {
  background: #f0f0f0;
  border-color: #ccc;
}

.ctb-tool-btn:active {
  background: #E8740C;
  color: white;
  border-color: #E8740C;
}

.ctb-tool-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.ctb-tool-btn.ctb-tool-danger {
  color: #dc3545;
  border-color: #f5c6cb;
}

.ctb-tool-btn.ctb-tool-danger:hover {
  background: #dc3545;
  color: white;
  border-color: #dc3545;
}

.ctb-upload-input {
  display: none;
}

.ctb-dpi-warning {
  background: #FFF8E1;
  color: #E65100;
  border: 1px solid #FFE082;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-top: 8px;
  font-weight: 500;
}

/* ── Responsive Desktop ────────────────────────────────── */

@media (min-width: 768px) {
  .ctb-root {
    max-width: 900px;
    padding-bottom: 80px;
  }

  .ctb-colour-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .ctb-designer-container {
    flex-direction: column;
  }

  .ctb-nav {
    max-width: 900px;
  }
}

@media (min-width: 1024px) {
  .ctb-colour-grid {
    grid-template-columns: repeat(7, 1fr);
  }
}
