/* ============================================================
   CustomGoods Advanced Sign Designer — Frontend Styles
   ============================================================ */

/* ── Reset / Base ──────────────────────────────────────────── */
.cgas-wrap *,
.cgas-wrap *::before,
.cgas-wrap *::after {
  box-sizing: border-box;
}

.cgas-wrap {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #222;
  width: 100vw;
  max-width: none;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 0 24px 48px;
}

/* ── Header ────────────────────────────────────────────────── */
.cgas-header {
  text-align: center;
  padding: 32px 0 20px;
}
.cgas-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: #1a1a2e;
}
.cgas-subtitle {
  color: #666;
  margin: 0;
}

/* ── Templates Bar ─────────────────────────────────────────── */
.cgas-templates-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  background: #f0f4ff;
  border-radius: 8px;
  margin-bottom: 20px;
}
.cgas-templates-label {
  font-weight: 600;
  color: #444;
  margin-right: 4px;
}
.cgas-tpl-btn {
  background: #fff;
  border: 1px solid #c0c8e0;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.cgas-tpl-btn:hover {
  background: linear-gradient(180deg, #efeae4 0%, #e8e0d9 100%);
  color: #fff;
  border-color: #1a1a2e;
}

/* ── Main Layout ───────────────────────────────────────────── */
.cgas-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 460px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .cgas-layout {
    grid-template-columns: 1fr;
  }
}

/* ── Preview Panel ─────────────────────────────────────────── */
.cgas-preview-panel {
  position: sticky;
  top: 80px;
}
.cgas-preview-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.cgas-mode-btn {
  background: #eee;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 4px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}
.cgas-mode-btn.active {
  background: #1a1a2e;
  color: #fff;
  border-color: #1a1a2e;
}
.cgas-size-label {
  margin-left: auto;
  font-size: 13px;
  color: #666;
}

/* ── Preview Stage ─────────────────────────────────────────── */
.cgas-preview-stage {
  position: relative;
  width: 100%;
  min-height: 72vh;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a2e;
  transition: background 0.4s;
}
.cgas-preview-stage.daytime {
  background: linear-gradient(180deg, #f5f5f5 0%, #ececec 100%);
}
.cgas-scene-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.25s ease, background-image 0.25s ease;
}
.cgas-backboard {
  position: relative;
  z-index: 1;
  padding: 30px 50px;
  border-radius: 12px;
  background: rgba(0,0,0,0.6);
  transition: background 0.3s, border-radius 0.3s;
  max-width: 88%;
  backdrop-filter: blur(1px);
}
.cgas-backboard.shape-none {
  background: transparent;
}
.cgas-backboard.shape-cut_to_letter {
  padding: 10px;
  background: transparent;
}
.cgas-backboard.shape-cut_to_shape {
  border-radius: 50px;
}
.cgas-sign-text {
  text-align: center;
}
.cgas-text-layer {
  display: block;
  font-family: 'Pacifico', cursive;
  font-size: clamp(28px, 5vw, 72px);
  color: #ffe8c0;
  text-shadow: 0 0 10px #ffe8c0, 0 0 25px #ffe8c0, 0 0 50px #ffe8c0;
  line-height: 1.2;
  transition: all 0.2s;
  white-space: pre-wrap;
  word-break: break-word;
}
.cgas-preview-stage.daytime .cgas-text-layer {
  text-shadow: none;
  color: #333;
}

/* ── Preview Actions ───────────────────────────────────────── */
.cgas-preview-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
#cgas-share-result {
  margin-top: 10px;
  padding: 10px;
  background: #f0f4ff;
  border-radius: 6px;
}

/* ── Options Panel ─────────────────────────────────────────── */
.cgas-options-panel {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
}

/* ── Sections ──────────────────────────────────────────────── */
.cgas-section {
  padding: 20px;
  border-bottom: 1px solid #f0f0f0;
}
.cgas-section:last-child {
  border-bottom: none;
}
.cgas-section-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #1a1a2e;
  margin: 0 0 14px;
}

/* ── Fields ────────────────────────────────────────────────── */
.cgas-field {
  margin-bottom: 12px;
}
.cgas-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 5px;
}
.cgas-input,
.cgas-select,
.cgas-field input[type="text"],
.cgas-field input[type="email"],
.cgas-field input[type="tel"],
.cgas-field input[type="number"],
.cgas-field select,
.cgas-field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
  background: #fff;
}
.cgas-input:focus,
.cgas-select:focus,
.cgas-field input:focus,
.cgas-field select:focus,
.cgas-field textarea:focus {
  border-color: #1a1a2e;
  outline: none;
}
.cgas-text-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
}
.cgas-text-input:focus {
  border-color: #1a1a2e;
  outline: none;
}
.cgas-mt {
  margin-top: 12px;
}
.cgas-desc {
  font-size: 12px;
  color: #777;
  margin: 0 0 10px;
  line-height: 1.5;
}

/* ── Font Grid ─────────────────────────────────────────────── */
.cgas-font-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}
.cgas-font-swatch {
  padding: 10px 8px;
  border: 2px solid #eee;
  border-radius: 6px;
  text-align: center;
  font-size: 18px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: #fafafa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cgas-font-swatch:hover {
  border-color: #1a1a2e;
  background: #f0f4ff;
}
.cgas-font-swatch.active {
  border-color: #1a1a2e;
  background: #e8eeff;
}

/* ── Color Grid ────────────────────────────────────────────── */
.cgas-color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cgas-color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.2s, border-color 0.2s;
}
.cgas-color-swatch:hover {
  transform: scale(1.15);
}
.cgas-color-swatch.active {
  border-color: #1a1a2e;
  transform: scale(1.15);
}

/* ── Option Grid (backboard / mounting) ────────────────────── */
.cgas-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.cgas-option-card {
  border: 2px solid #eee;
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: #fafafa;
}
.cgas-option-card:hover {
  border-color: #1a1a2e;
  background: #f0f4ff;
}
.cgas-option-card.active {
  border-color: #1a1a2e;
  background: #e8eeff;
}
.cgas-option-card-title {
  font-size: 12px;
  font-weight: 600;
  color: #333;
}
.cgas-option-card-price {
  font-size: 11px;
  color: #0073aa;
  margin-top: 3px;
}

/* ── Size Grid ─────────────────────────────────────────────── */
.cgas-size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
}
.cgas-size-card {
  border: 2px solid #eee;
  border-radius: 8px;
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.2s, background 0.2s;
  background: #fafafa;
}
.cgas-size-card:hover {
  border-color: #1a1a2e;
  background: #f0f4ff;
}
.cgas-size-card.active {
  border-color: #1a1a2e;
  background: #e8eeff;
}
.cgas-size-price {
  display: block;
  font-size: 12px;
  color: #0073aa;
  margin-top: 3px;
}

/* ── Add-ons ───────────────────────────────────────────────── */
.cgas-addons-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cgas-addon {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.cgas-addon input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ── Price Summary ─────────────────────────────────────────── */
.cgas-price-summary {
  background: #f8f9ff;
  border-radius: 8px;
  padding: 16px;
  margin: 0 20px;
}
.cgas-price-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #555;
  margin-bottom: 6px;
}
.cgas-price-total {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a2e;
  border-top: 1px solid #ddd;
  padding-top: 8px;
  margin-top: 8px;
}

/* ── Actions ───────────────────────────────────────────────── */
.cgas-actions {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cgas-btn-primary {
  display: block;
  width: 100%;
  padding: 14px;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  text-align: center;
  text-decoration: none;
}
.cgas-btn-primary:hover {
  background: #2d2d5e;
}
.cgas-btn-secondary {
  display: inline-block;
  padding: 10px 18px;
  background: #fff;
  color: #1a1a2e;
  border: 2px solid #1a1a2e;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  text-align: center;
  text-decoration: none;
}
.cgas-btn-secondary:hover {
  background: #1a1a2e;
  color: #fff;
}

/* ── Quote Form ────────────────────────────────────────────── */
#cgas-quote-form-wrap {
  padding: 20px;
  border-top: 1px solid #f0f0f0;
}
#cgas-quote-form-wrap h3 {
  margin: 0 0 16px;
  font-size: 16px;
}

/* ── Messages ──────────────────────────────────────────────── */
#cgas-messages {
  padding: 0 20px 10px;
}
.cgas-msg-success {
  background: #d4edda;
  color: #155724;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
}
.cgas-msg-error {
  background: #f8d7da;
  color: #721c24;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
}

/* ── Configure Button (product page) ──────────────────────── */
.cgas-configure-btn {
  display: inline-block;
  margin-bottom: 12px;
  padding: 12px 24px;
  background: #1a1a2e;
  color: #fff !important;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}
.cgas-configure-btn:hover {
  background: #2d2d5e;
}

/* ── UV Upload ─────────────────────────────────────────────── */
.cgas-uv-section {
  background: #fffbf0;
  border-left: 3px solid #f0a500;
}

/* ── Upload Preview ────────────────────────────────────────── */
#cgas-upload-preview {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#cgas-upload-preview img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #ddd;
}

/* ── Admin Order Panel ─────────────────────────────────────── */
.cgas-order-config-panel {
  margin-top: 20px;
  padding: 16px;
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
}


/* ── Scene Presets ─────────────────────────────────────────── */
.cgas-scene-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.cgas-scene-preset {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  border: 1px solid #d9deec;
  border-radius: 10px;
  padding: 8px;
  background: #fff;
  cursor: pointer;
  transition: all .2s ease;
}
.cgas-scene-preset img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
}
.cgas-scene-preset span {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  text-align: center;
}
.cgas-scene-preset.active {
  border-color: #1a1a2e;
  box-shadow: 0 0 0 2px rgba(26,26,46,0.08);
}
@media (max-width: 900px) {
  .cgas-wrap {
    width: auto;
    margin-left: 0;
    margin-right: 0;
    padding: 0 12px 32px;
  }
  .cgas-preview-panel {
    position: static;
  }
  .cgas-preview-stage {
    min-height: 360px;
  }
  .cgas-scene-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
