/* Core styles for the FA Textdesigner UI */

#fa-textdesigner {
  border: 1px solid #e6e8ec;
  border-radius: 14px;
  padding: 20px;
  margin: 16px 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

.fa-td-layout {
  display: grid;
  grid-template-columns: minmax(320px, 55%) minmax(260px, 1fr);
  gap: 18px;
  align-items: start;
}

/* Preview wrapper holds the canvas */
.fa-td-preview-wrapper {
  flex: initial;
  width: 100%;
  aspect-ratio: 800 / 609;
  height: auto;
  background: #eef2f5 url('preview-bg.png') no-repeat center center / cover;
  border-radius: 12px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.fa-td-zoom-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: #222;
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  line-height: 1;
  padding: 0;
  pointer-events: auto;
}

.fa-td-zoom-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
}

#fa-td-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 12px;
}

/* Measurements overlay */
.fa-td-measurements {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 11px;
  color: #f5f5f5;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  text-align: right;
}

.fa-td-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.fa-td-overlay.active {
  display: flex;
}

.fa-td-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.fa-td-overlay-content {
  position: relative;
  max-width: 95vw;
  max-height: 95vh;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  padding: 20px;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

.fa-td-overlay-close {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}

.fa-td-overlay-body {
  margin-top: 24px;
  min-width: 60vw;
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fa-td-overlay-rect {
  position: relative;
  width: 100%;
  height: 100%;
  background: #f7f7f7;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 32px 32px 56px;
}

#fa-td-overlay-img {
  width: 80vw;
  height: auto;
  max-width: 90vw;
  max-height: 80vh;
  display: none;
}

.fa-td-overlay-measure {
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: none;
}

.fa-td-overlay-error {
  position: absolute;
  inset: 0;
  display: none;
  color: #b3261e;
  font-weight: 600;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
}

.fa-td-overlay.show-img #fa-td-overlay-img,
.fa-td-overlay.show-img .fa-td-overlay-measure {
  display: block;
}

.fa-td-overlay.show-error #fa-td-overlay-error {
  display: flex;
}

.fa-td-measure-height {
  position: absolute;
  left: 24px;
  top: 32px;
  font-weight: 800;
  font-size: 21px;
  color: #111;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9), 0 1px 3px rgba(0, 0, 0, 0.22);
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.fa-td-measure-height::before {
  content: "";
  position: absolute;
  left: -12px;
  top: -8px;
  bottom: 120px;
  border-left: 2px solid #444;
}

.fa-td-measure-height::after {
  content: "";
  position: absolute;
  left: -16px;
  bottom: 114px;
  width: 20px;
  border-top: 2px solid #444;
}

.fa-td-measure-width {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 160px);
  text-align: center;
  font-weight: 800;
  font-size: 21px;
  color: #111;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8), 0 1px 3px rgba(0, 0, 0, 0.25);
}

.fa-td-measure-width::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  border-bottom: 2px solid #444;
}

/* Control panel styling */
.fa-td-controls {
  flex: initial;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fa-td-field {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.fa-td-field input[type="range"],
.fa-td-field input[type="color"],
.fa-td-field select,
.fa-td-field textarea,
.fa-td-field input[type="file"] {
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid #d0d5dd;
  background: #f8fafc;
  font-size: 14px;
  font-weight: 500;
  color: #101828;
}

.fa-td-field textarea {
  min-height: 64px;
}

.fa-td-field input[type="range"] {
  padding: 0;
  background: transparent;
  margin-left: auto;
  flex: 1 1 180px;
  min-width: 180px;
}

.fa-td-field input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: linear-gradient(90deg, #008a3b, #00b14f);
  border-radius: 999px;
}

.fa-td-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #00a14c;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  margin-top: -5px;
}

.fa-td-field input[type="range"]::-moz-range-track {
  height: 6px;
  background: linear-gradient(90deg, #008a3b, #00b14f);
  border-radius: 999px;
}

.fa-td-field input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #00a14c;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.fa-td-price {
  margin-top: 8px;
  font-weight: 800;
  font-size: 18px;
  color: #101828;
}

.fa-td-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 6px;
}

.fa-td-actions .fa-td-price {
  margin: 0;
}

.fa-td-add-to-cart {
  width: 100%;
  text-align: center;
}

@media (max-width: 960px) {
  .fa-td-layout {
    grid-template-columns: 1fr;
  }
  .fa-td-preview-wrapper,
  .fa-td-controls {
    width: 100%;
  }
}
