/* ═══════════════════════════════════════════════════════════════
   StickDecor Custom Design — Canvas-based Customizer
   Supports wallpaper, perspex, and sticker sub-types
   ═══════════════════════════════════════════════════════════════ */

.sd-cd, .sd-cd *, .sd-cd *::before, .sd-cd *::after { box-sizing: border-box; margin: 0; padding: 0; }

.sd-cd {
  direction: rtl;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: #1a1a1a;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.sd-cd button:not(.sd-cd-bottom__cart):not(.sd-cd-landing__type):not(.sd-cd-panel__next):not(.sd-cd-reset-btn):not(.sd-cd-sticker-types__card):not(.sd-cd-text-input__next):not(.sd-cd-icon-btn) { font-family: inherit; cursor: pointer; border: none; background: none; }
.sd-cd input { font-family: inherit; }

/* ═══ Landing ═══ */
.sd-cd-landing {
  min-height: calc(100vh - 200px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 24px; background: #fff;
}
.sd-cd-landing__hero { text-align: center; margin-bottom: 56px; max-width: 600px; }
.sd-cd-landing__hero h1 { font-size: 2.8rem; font-weight: 600; margin: 0 0 16px; letter-spacing: -0.02em; color: #000; line-height: 1.2; }
.sd-cd-landing__hero p { font-size: 1.05rem; color: #6b6b6b; margin: 0; line-height: 1.7; }
.sd-cd-landing__types { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; max-width: 800px; }
.sd-cd-landing__type {
  background: #fff; border: 1.5px solid #e5e5e5; border-radius: 0;
  padding: 48px 32px 40px; text-align: center; cursor: pointer; transition: all 0.2s;
  width: 240px; display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.sd-cd-landing__type:hover { border-color: #000; box-shadow: 0 2px 20px rgba(0,0,0,0.08); }
.sd-cd-landing__type-icon { width: 52px; height: 52px; color: #333; }
.sd-cd-landing__type-icon svg { width: 100%; height: 100%; }
.sd-cd-landing__type-name { font-size: 1.1rem; font-weight: 600; color: #000; }
.sd-cd-landing__type-price { font-size: 0.9rem; color: #888; font-weight: 400; }

/* ═══ Sticker Sub-Types ═══ */
.sd-cd-sticker-types {
  min-height: calc(100vh - 200px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px; background: #fff; position: relative;
}
.sd-cd-sticker-types__inner { text-align: center; max-width: 800px; width: 100%; }
.sd-cd-sticker-types__inner h2 { font-size: 1.8rem; font-weight: 600; margin: 0 0 10px; color: #000; }
.sd-cd-sticker-types__inner > p { color: #6b6b6b; margin: 0 0 40px; font-size: 1rem; }
.sd-cd-sticker-types__grid { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.sd-cd-sticker-types__card {
  background: #fff; border: 1.5px solid #e5e5e5; padding: 32px 24px;
  text-align: center; cursor: pointer; transition: all 0.2s; width: 240px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-family: inherit;
}
.sd-cd-sticker-types__card:hover { border-color: #000; box-shadow: 0 2px 20px rgba(0,0,0,0.08); }
.sd-cd-sticker-types__icon { width: 48px; height: 48px; color: #333; }
.sd-cd-sticker-types__icon svg { width: 100%; height: 100%; }
.sd-cd-sticker-types__card strong { font-size: 1.05rem; color: #000; }
.sd-cd-sticker-types__card span { font-size: 0.82rem; color: #888; line-height: 1.5; }
.sd-cd-sticker-types__price { font-size: 0.82rem; color: #555; font-weight: 600; margin-top: 4px; }

/* ═══ Upload ═══ */
.sd-cd-upload-screen {
  min-height: calc(100vh - 200px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px; background: #fff; position: relative;
}
.sd-cd-back { position: absolute; top: 24px; right: 24px; font-size: 0.9rem; color: #666; padding: 10px 20px; transition: color 0.15s; display: flex; align-items: center; gap: 6px; cursor: pointer; border: none; background: none; font-family: inherit; }
.sd-cd-back:hover { color: #000; }
.sd-cd-upload-screen__inner { text-align: center; max-width: 460px; width: 100%; }
.sd-cd-upload-screen__inner h2 { font-size: 1.7rem; font-weight: 600; margin: 0 0 10px; color: #000; }
.sd-cd-upload-screen__inner > p { color: #6b6b6b; margin: 0 0 40px; font-size: 1rem; line-height: 1.6; }
.sd-cd-upload-btn {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 56px 40px; border: 2px dashed #d0d0d0; cursor: pointer;
  transition: all 0.2s; background: #fafafa; color: #999;
}
.sd-cd-upload-btn:hover { border-color: #000; background: #f5f5f5; }
.sd-cd-upload-btn svg { color: #999; transition: color 0.2s; }
.sd-cd-upload-btn:hover svg { color: #333; }
.sd-cd-upload-btn__cta { display: inline-block; background: #000; color: #fff; padding: 14px 36px; font-size: 1rem; font-weight: 600; transition: background 0.2s; }
.sd-cd-upload-btn:hover .sd-cd-upload-btn__cta { background: #333; }
.sd-cd-upload-btn small { font-size: 0.8rem; color: #aaa; }
.sd-cd-upload-screen__terms { font-size: 0.75rem; color: #bbb; margin-top: 20px; line-height: 1.5; }

.sd-cd-upload-loading { display: none; position: absolute; inset: 0; background: rgba(255,255,255,0.9); z-index: 10; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.sd-cd-upload-loading.active { display: flex; }
.sd-cd-upload-loading__spinner { width: 40px; height: 40px; border: 3px solid #e5e5e5; border-top-color: #000; border-radius: 50%; animation: sd-spin 0.8s linear infinite; }
@keyframes sd-spin { to { transform: rotate(360deg); } }
.sd-cd-upload-loading__text { font-size: 0.95rem; color: #666; }

/* ═══ Text Input Screen ═══ */
.sd-cd-text-input {
  min-height: calc(100vh - 200px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px; background: #fff; position: relative;
}
.sd-cd-text-input__inner { text-align: center; max-width: 520px; width: 100%; }
.sd-cd-text-input__inner h2 { font-size: 1.7rem; font-weight: 600; margin: 0 0 10px; color: #000; }
.sd-cd-text-input__inner > p { color: #6b6b6b; margin: 0 0 32px; font-size: 1rem; }
.sd-cd-text-input__form { position: relative; margin-bottom: 24px; }
.sd-cd-text-input__form textarea {
  width: 100%; padding: 20px; border: 1.5px solid #e5e5e5; font-size: 1.2rem;
  font-family: inherit; resize: vertical; min-height: 100px; text-align: center;
  transition: border-color 0.15s; direction: rtl;
}
.sd-cd-text-input__form textarea:focus { border-color: #000; outline: none; }
.sd-cd-text-input__form small { display: block; text-align: left; font-size: 0.72rem; color: #bbb; margin-top: 6px; }
.sd-cd-text-input__next {
  display: inline-flex; align-items: center; gap: 8px;
  background: #000; color: #fff; padding: 14px 40px; font-size: 1rem;
  font-weight: 600; border: none; cursor: pointer; transition: background 0.2s;
  font-family: inherit;
}
.sd-cd-text-input__next:hover { background: #333; }

/* ═══ Customizer Layout ═══ */
.sd-cd-customizer { display: flex; min-height: calc(100vh - 160px); background: #e8e4de; }

/* Preview (canvas) */
.sd-cd-customizer__preview {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px; position: relative; min-height: 500px;
}
.sd-cd-customizer__back { position: absolute; top: 12px; right: 12px; font-size: 0.82rem; color: #7a7060; padding: 8px 14px; transition: color 0.15s; display: flex; align-items: center; gap: 6px; z-index: 2; }
.sd-cd-customizer__back:hover { color: #000; }

.sd-cd-canvas-wrap { width: 100%; flex: 1; min-height: 400px; position: relative; }
.sd-cd-canvas-wrap canvas { width: 100%; height: 100%; display: block; }

.sd-cd-preview-bar {
  display: flex; align-items: center; gap: 12px; margin-top: 8px;
  font-size: 0.78rem; color: #7a7060;
}
.sd-cd-reset-btn {
  display: flex; align-items: center; gap: 4px; font-size: 0.78rem;
  color: #7a7060; padding: 5px 12px; background: rgba(255,255,255,0.6);
  backdrop-filter: blur(4px); transition: all 0.15s;
}
.sd-cd-reset-btn:hover { color: #000; background: rgba(255,255,255,0.9); }
.sd-cd-preview-bar__info { background: rgba(255,255,255,0.6); padding: 5px 14px; backdrop-filter: blur(4px); }

/* Controls panel (right) */
.sd-cd-customizer__controls {
  width: 360px; background: #fff; display: flex; flex-direction: column;
  box-shadow: -2px 0 16px rgba(0,0,0,0.04); overflow-y: auto; max-height: 100vh;
  position: sticky; top: 0;
}

/* Sections */
.sd-cd-section { padding: 16px 22px; border-bottom: 1px solid #f0f0f0; }
.sd-cd-section__title { font-size: 0.82rem; font-weight: 700; color: #555; margin: 0 0 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.sd-cd-section__hint { font-size: 0.72rem; color: #999; margin: 0 0 8px; }

/* Dimensions */
.sd-cd-dims { display: flex; align-items: flex-end; gap: 8px; }
.sd-cd-dims__field { flex: 1; }
.sd-cd-dims__field label { display: block; font-size: 0.72rem; color: #999; margin-bottom: 4px; font-weight: 500; }
.sd-cd-dims__input-wrap { position: relative; }
.sd-cd-dims__input-wrap input {
  width: 100%; padding: 10px 40px 10px 12px; border: 1.5px solid #e5e5e5;
  font-size: 1rem; font-weight: 600; text-align: center; transition: border-color 0.15s; background: #fff;
}
.sd-cd-dims__input-wrap input:focus { border-color: #000; outline: none; }
.sd-cd-dims__unit { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 0.72rem; color: #aaa; }
.sd-cd-dims__x { font-size: 1rem; color: #ccc; padding-bottom: 10px; }
.sd-cd-dims__margin { margin-top: 10px; font-size: 0.78rem; }
.sd-cd-dims__margin label { display: flex; align-items: center; gap: 6px; cursor: pointer; color: #666; }
.sd-cd-dims__margin input[type="checkbox"] { accent-color: #000; width: 14px; height: 14px; }

/* Options row */
.sd-cd-options-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.sd-cd-toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 0.82rem; color: #555; }
.sd-cd-toggle input { accent-color: #000; width: 14px; height: 14px; }

/* Filters */
.sd-cd-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.sd-cd-filter { cursor: pointer; }
.sd-cd-filter input { display: none; }
.sd-cd-filter__pill {
  display: inline-block; padding: 5px 12px; font-size: 0.76rem; font-weight: 500;
  border: 1.5px solid #e5e5e5; color: #666; transition: all 0.15s; white-space: nowrap;
}
.sd-cd-filter__pill:hover { border-color: #999; }
.sd-cd-filter input:checked + .sd-cd-filter__pill { border-color: #000; color: #000; background: #f5f5f5; font-weight: 600; }

/* Materials — compact */
.sd-cd-materials { display: flex; flex-direction: column; gap: 6px; }
.sd-cd-mat { cursor: pointer; }
.sd-cd-mat input { display: none; }
.sd-cd-mat__card {
  border: 1.5px solid #e5e5e5; padding: 10px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; transition: all 0.15s;
}
.sd-cd-mat__card:hover { border-color: #999; }
.sd-cd-mat input:checked + .sd-cd-mat__card { border-color: #000; background: #fafafa; }
.sd-cd-mat__info { flex: 1; min-width: 0; }
.sd-cd-mat__info strong { font-size: 0.85rem; color: #000; }
.sd-cd-mat__info span { display: block; font-size: 0.72rem; color: #999; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-cd-mat__price { font-weight: 600; color: #000; white-space: nowrap; font-size: 0.82rem; }

/* ═══ Shape / Size / Qty pills (shared pattern) ═══ */
.sd-cd-shape-pills,
.sd-cd-size-pills,
.sd-cd-qty-pills { display: flex; gap: 6px; flex-wrap: wrap; }

.sd-cd-shape, .sd-cd-size, .sd-cd-qty { cursor: pointer; }
.sd-cd-shape input, .sd-cd-size input, .sd-cd-qty input { display: none; }

.sd-cd-shape__pill, .sd-cd-size__pill, .sd-cd-qty__pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; font-size: 0.82rem; font-weight: 500;
  border: 1.5px solid #e5e5e5; color: #666; transition: all 0.15s; white-space: nowrap;
}
.sd-cd-shape__pill:hover, .sd-cd-size__pill:hover, .sd-cd-qty__pill:hover { border-color: #999; }
.sd-cd-shape input:checked + .sd-cd-shape__pill,
.sd-cd-size input:checked + .sd-cd-size__pill,
.sd-cd-qty input:checked + .sd-cd-qty__pill { border-color: #000; color: #000; background: #f5f5f5; font-weight: 600; }

.sd-cd-shape__pill svg { width: 18px; height: 18px; }

.sd-cd-qty-detail { font-size: 0.78rem; color: #888; margin-top: 8px; }

/* ═══ Font List ═══ */
.sd-cd-font-list { display: flex; gap: 6px; flex-wrap: wrap; }
.sd-cd-font { cursor: pointer; }
.sd-cd-font input { display: none; }
.sd-cd-font__pill {
  display: inline-block; padding: 6px 14px; font-size: 0.88rem;
  border: 1.5px solid #e5e5e5; color: #666; transition: all 0.15s; white-space: nowrap;
}
.sd-cd-font__pill:hover { border-color: #999; }
.sd-cd-font input:checked + .sd-cd-font__pill { border-color: #000; color: #000; background: #f5f5f5; font-weight: 600; }

/* ═══ Color Picker ═══ */
.sd-cd-color-row { display: flex; align-items: center; gap: 12px; }
.sd-cd-color-label { font-size: 0.82rem; color: #555; }
.sd-cd-color-input {
  width: 40px; height: 32px; border: 1.5px solid #e5e5e5; padding: 2px;
  cursor: pointer; background: #fff;
}
.sd-cd-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.sd-cd-color-input::-webkit-color-swatch { border: none; }

/* ═══ Icon Grid ═══ */
.sd-cd-icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.sd-cd-icon-btn {
  width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border: 1.5px solid #e5e5e5; background: #fff; cursor: pointer; transition: all 0.15s;
  padding: 6px; color: #555; font-family: inherit;
}
.sd-cd-icon-btn:hover { border-color: #000; color: #000; background: #f5f5f5; }
.sd-cd-icon-btn svg { width: 22px; height: 22px; }

/* ═══ Text Edit in Customizer ═══ */
#sdTextEdit {
  width: 100%; padding: 10px 14px; border: 1.5px solid #e5e5e5; font-size: 0.95rem;
  font-family: inherit; resize: vertical; min-height: 50px; direction: rtl;
  transition: border-color 0.15s;
}
#sdTextEdit:focus { border-color: #000; outline: none; }

/* ═══ Bottom bar ═══ */
.sd-cd-bottom { padding: 16px 22px; border-top: 1px solid #eee; background: #fff; margin-top: auto; }
.sd-cd-bottom__row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; font-size: 0.82rem; color: #888; }
.sd-cd-bottom__row--big { font-size: 0.95rem; color: #000; margin-top: 2px; padding-top: 6px; border-top: 1px solid #f0f0f0; }
.sd-cd-bottom__row--big strong { font-size: 1.3rem; color: #000; font-weight: 700; }
.sd-cd-bottom__min { font-size: 0.7rem; color: #bbb; margin-bottom: 4px; }
button.sd-cd-bottom__cart {
  width: 100%; padding: 13px !important; background: #000 !important; color: #fff !important; border: none !important;
  font-size: 0.95rem; font-weight: 600; cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 8px; margin-top: 10px; transition: background 0.2s;
}
button.sd-cd-bottom__cart:hover { background: #333 !important; }
button.sd-cd-bottom__cart:disabled { background: #ddd !important; color: #999 !important; cursor: not-allowed; }
.sd-cd-bottom__cart--loading { pointer-events: none; opacity: 0.7; }
.sd-cd-bottom__shipping { display: block; text-align: center; font-size: 0.7rem; color: #bbb; margin-top: 8px; }

/* Change image */
.sd-cd-change-img { display: flex; align-items: center; gap: 6px; color: #999; font-size: 0.78rem; padding: 12px 22px; transition: color 0.15s; cursor: pointer; border: none; background: none; font-family: inherit; }
.sd-cd-change-img:hover { color: #000; }

/* ═══ Responsive ═══ */
@media (max-width: 900px) {
  .sd-cd-customizer { flex-direction: column; }
  .sd-cd-customizer__controls { width: 100%; max-height: none; position: static; }
  .sd-cd-customizer__preview { min-height: 280px; padding: 12px; }
  .sd-cd-canvas-wrap { min-height: 300px; }
}
@media (max-width: 600px) {
  .sd-cd-landing { padding: 48px 16px; }
  .sd-cd-landing__hero h1 { font-size: 2rem; }
  .sd-cd-landing__types { flex-direction: column; align-items: center; }
  .sd-cd-landing__type { width: 100%; max-width: 300px; padding: 32px 24px; }
  .sd-cd-sticker-types { padding: 48px 16px; }
  .sd-cd-sticker-types__grid { flex-direction: column; align-items: center; }
  .sd-cd-sticker-types__card { width: 100%; max-width: 300px; }
  .sd-cd-text-input { padding: 48px 16px; }
  .sd-cd-customizer__controls { width: 100%; }
  .sd-cd-section { padding: 14px 16px; }
  .sd-cd-bottom { padding: 14px 16px; }
  .sd-cd-icon-grid { grid-template-columns: repeat(4, 1fr); }
}
