@font-face {
  font-family: Vazirmatn;
  src: url("../../assets/libs/vazirmatn/Vazirmatn-Regular.woff2")
    format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Vazirmatn;
  src: url("../../assets/libs/vazirmatn/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --preview-bg: #f8fafc;
  --preview-stage-bg: linear-gradient(135deg, #e2e8f0 0%, #f8fafc 100%);
  --paper-border: #d7dce2;
  --paper-bg: #fff;
  --toolbar-bg: #fff;
  --toolbar-border: #cbd5e1;
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --text-color: #1e293b;
}

.preview-container,
.auth-panel {
  font-family: Vazirmatn, sans-serif;
}

.preview-container {
  width: 100%;
  max-width: 550px;
  margin: 0 auto;
  padding: 20px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgb(15 23 42 / 5%);
  box-sizing: border-box;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-color);
}

.zoom-badge {
  padding: 2px 8px;
  background: #f1f5f9;
  border-radius: 6px;
  color: #64748b;
  font-size: 12px;
}

/* --- تنظیمات جعبه‌ابزار و دکمه‌ها --- */
.preview-toolbar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 8px;
  background: var(--preview-bg);
  border: 1px solid var(--toolbar-border);
  border-radius: 10px;
  overflow-x: auto; /* قابلیت اسکرول افقی در صورت نیاز */
  scrollbar-width: thin;
}

.preview-toolbar button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 42px; /* بزرگ‌تر شدن دکمه‌ها برای لمس راحت‌تر در موبایل */
  height: 42px;
  padding: 0;
  background: var(--toolbar-bg);
  border: 1px solid var(--toolbar-border);
  border-radius: 8px;
  color: var(--text-color);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preview-toolbar button:hover:not(:disabled) {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

.preview-toolbar button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.preview-toolbar .active-lock {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #2563eb;
}

/* --------------------------------- */

.preview-workspace-container {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-rows: 28px minmax(380px, 1fr);
  margin-bottom: 15px;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
}

.preview-workspace-container .preview-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 100%;
  min-height: 100%;
  padding: 35px;
  background: #181818;
  box-sizing: border-box;
}

.preview-stage {
  width: 100%;
  height: 380px;
  background: var(--preview-stage-bg);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.ruler {
  position: relative;
  z-index: 10;
  background: #252525;
  color: #aaa;
  font:
    9px Tahoma,
    sans-serif;
  user-select: none;
  overflow: hidden;
  box-sizing: border-box;
}

.ruler-corner {
  grid-column: 1;
  grid-row: 1;
  border-right: 1px solid #444;
  border-bottom: 1px solid #444;
}

.ruler-horizontal {
  grid-column: 2;
  grid-row: 1;
  border-bottom: 1px solid #444;
}

.ruler-vertical {
  grid-column: 1;
  grid-row: 2;
  border-right: 1px solid #444;
}

.workspace-middle-row {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  overflow: auto;
  background: #111;
  min-height: 380px;
  scrollbar-width: thin;
  box-sizing: border-box;
}

.paper-frame {
  position: relative;
  flex: 0 0 auto;
  background: var(--paper-bg);
  border: 1px solid var(--paper-border);
  box-shadow: 0 8px 25px rgb(0 0 0 / 35%);
  box-sizing: border-box;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.paper-frame:active {
  cursor: grabbing;
}

.preview-image {
  position: absolute;
  left: 50%;
  top: 50%;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  will-change: transform;
  cursor: grab;
  touch-action: none;
  z-index: 2;
}

.preview-image:active {
  cursor: grabbing;
}

#paper-grid {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.margin-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  pointer-events: none;
}

.margin-side {
  position: absolute;
  background: #fff;
  pointer-events: none;
}

.margin-top {
  top: 0;
  left: 0;
  right: 0;
}

.margin-right {
  top: 0;
  right: 0;
  bottom: 0;
}

.margin-bottom {
  right: 0;
  bottom: 0;
  left: 0;
}

.margin-left {
  top: 0;
  bottom: 0;
  left: 0;
}

.ruler-tick-h,
.ruler-tick-v {
  position: absolute;
  background: #666;
  pointer-events: none;
  box-sizing: border-box;
}

.ruler-tick-h {
  bottom: 0;
  width: 1px;
}

.ruler-tick-v {
  right: 0;
  height: 1px;
}

.ruler-label-h,
.ruler-label-v {
  position: absolute;
  color: #bbb;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  font:
    9px Tahoma,
    sans-serif;
}

.ruler-label-h {
  bottom: 4px;
  transform: translateX(-1px);
}

.ruler-label-v {
  right: 3px;
  transform: translateY(-1px);
}

.preview-dimensions-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  margin-bottom: 15px;
  padding: 12px;
  border: 1px solid #d7e0eb;
  border-radius: 10px;
  background: #f8fafc;
  box-sizing: border-box;
  direction: rtl;
  align-items: center;
}

.preview-dimensions-panel .dimension-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.preview-dimensions-panel .dimension-field label {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: #475569;
}

.preview-dimensions-panel .dimension-field input,
.preview-dimensions-panel .dimension-field select {
  width: 100%;
  height: 40px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  text-align: center;
  font-family: inherit;
  font-size: 14px;
  box-sizing: border-box;
}

.preview-dimensions-panel .dimension-field input:focus,
.preview-dimensions-panel .dimension-field select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgb(37 99 235 / 12%);
}

.preview-dimensions-panel .grid-controls-field {
  display: contents;
}

.preview-dimensions-panel .circle-guide-field {
  min-width: 0;
}

.preview-dimensions-panel .circle-guide-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
  cursor: pointer;
}

.preview-dimensions-panel .circle-guide-toggle input {
  width: 17px;
  height: 17px;
  margin: 0;
  flex: 0 0 auto;
}

.preview-dimensions-panel .circle-guide-toggle span {
  font-size: 13px;
  color: #334155;
  white-space: nowrap;
}

.preview-dimensions-panel > .apply-size-btn {
  grid-column: span 2;
  width: 100%;
  height: 40px;
  align-self: start;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: var(--primary-color);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.preview-dimensions-panel > .preview-upload-btn {
  grid-column: span 2;
  width: 100%;
  height: 40px;
  box-sizing: border-box;
}

.apply-size-btn {
  grid-column: span 1;
  width: 100%;
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: var(--primary-color);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.apply-size-btn:hover {
  background: var(--primary-hover);
}

.preview-hint {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.5;
  color: #64748b;
  text-align: center;
}

.preview-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 300px;
  margin: 15px auto 0;
}

.preview-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 20px;
  background: var(--text-color);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.preview-upload-btn input {
  display: none;
}

.preview-save-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: #10b981;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary-link {
  padding: 10px;
  background: #f1f5f9;
  border-radius: 8px;
  color: #475569;
  text-align: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.preview-info-box {
  position: relative;
  z-index: 10;
  width: 100%;
  margin: 0 auto 16px;
  padding: 22px 18px 18px;
  background: #eef6ff;
  border: 1px solid #b9d7ff;
  border-radius: 14px;
  box-sizing: border-box;
  direction: rtl;
  text-align: right;
}

.preview-info-content {
  width: 100%;
  box-sizing: border-box;
}

.preview-info-content p {
  margin: 0 0 22px;
  color: #1554c0;
  font-size: 15px;
  line-height: 2.1;
  text-align: justify;
}

.preview-info-content .preview-info-important {
  font-weight: 600;
}

.preview-size-help {
  margin-top: 8px;
  padding: 13px 12px;
  border: 1px dashed #adc5e8;
  border-radius: 10px;
  background: rgb(255 255 255 / 45%);
  color: #333;
  font-size: 14px;
  line-height: 2;
  text-align: center;
}

.preview-size-help strong {
  color: #2165db;
  font-weight: 700;
}

.preview-info-footer {
  display: flex;
  justify-content: flex-start;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #d4e3f5;
}

.preview-info-footer button {
  padding: 9px 18px;
  border: 0;
  border-radius: 8px;
  background: #3478ed;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.preview-info-footer button:active {
  transform: translateY(1px);
}

.info-box-highlight {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0 15px;
  padding: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: #1e40af;
  font-size: 13px;
  line-height: 1.5;
  text-align: right;
}

.info-box-highlight i {
  flex-shrink: 0;
  margin-top: 3px;
  color: #3b82f6;
}

.info-box-highlight p {
  margin: 0;
}

.info-box-container {
  margin-bottom: 20px;
  padding: 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: #1e40af;
  font-family: Vazirmatn, sans-serif;
  font-size: 14px;
  line-height: 1.8;
  text-align: right;
  box-shadow: 0 1px 3px rgb(0 0 0 / 5%);
}

.info-box-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.info-text {
  margin: 0;
  text-align: justify;
}

.info-box-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #dbeafe;
  text-align: left;
}

.info-close-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #3b82f6;
  border: 0;
  border-radius: 6px;
  color: #fff;
  font-family: Vazirmatn, sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.info-close-btn:hover {
  background: #2563eb;
}

.btn-success-styled,
.btn-primary-styled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-success-styled {
  background: #10b981;
}

.btn-primary-styled {
  margin: 0;
  background: var(--primary-color);
}

.btn-secondary-styled {
  padding: 10px;
  background: #f1f5f9;
  border-radius: 8px;
  color: #475569;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
  transition: 0.2s;
}

.internal-links-section {
  max-width: 800px;
  margin: 25px auto 40px;
  padding: 0 15px;
}

.internal-links-wrapper {
  padding: 24px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgb(0 0 0 / 4%);
}

.internal-links-header {
  margin-bottom: 20px;
  text-align: center;
}

.internal-links-header h3 {
  margin: 0 0 6px;
  color: #1e293b;
  font-size: 1.15rem;
  font-weight: 800;
}

.internal-links-header p {
  margin: 0;
  color: #64748b;
  font-size: 0.9rem;
}

.internal-links-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.internal-link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  color: #334155;
  text-align: center;
  text-decoration: none;
  transition: all 0.25s ease;
}

.internal-link-card:hover {
  background: #f0fdf4;
  border-color: #22c55e;
  color: #166534;
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgb(34 197 94 / 12%);
}

.internal-link-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
  background: #e0f2fe;
  border-radius: 10px;
  color: #0284c7;
  font-size: 18px;
  transition: all 0.25s ease;
}

.internal-link-card:hover .internal-link-icon {
  background: #dcfce7;
  color: #16a34a;
}

.internal-link-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.circle-guide {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  border: 1px dashed #ef4444;
  border-radius: 50%;
  box-sizing: border-box;
  display: none;
}

#circle-guide {
  position: absolute;
  z-index: 2;
  box-sizing: border-box;
  border: 1px dashed #f00;
  border-radius: 50%;
  pointer-events: none;
  display: none;
}

/* #region DW For User */
.preview-save-file-btn,
.preview-print-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #334155;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.preview-save-file-btn:hover:not(:disabled) {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.preview-save-file-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* #endregion */

/* #region Check Box Discription */

/* کانتینر کلی نوع چاپ و خطوط راهنما */
.print-type-container {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 15px;
  direction: rtl;
  text-align: right;
}

.print-type-container > label {
  display: block;
  margin-bottom: 8px;
  color: #333;
  font-size: 13px;
  font-weight: 700;
}

.print-type-container .radio-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.print-type-container .radio-group label {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
  gap: 6px;
  margin: 0;
  padding: 8px 6px;
  color: #333;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  cursor: pointer;
}

.print-type-container .radio-group input[type="radio"] {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin: 0;
}

/* استایل کادر توضیحات (تکست‌آریا) */
#order-description {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  direction: rtl;
  text-align: right;
  box-sizing: border-box;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

#order-description:focus {
  border-color: #0d6efd;
  outline: none;
  box-shadow: 0 0 0 3px rgb(13 110 253 / 15%);
}

.order-extra-options-container {
  direction: rtl;
  text-align: right;
}

.order-extra-options-container .dimension-field {
  width: 100%;
}

.dimension-upload-btn {
  grid-column: 1/-1;
  width: 100%;
  box-sizing: border-box;
}

.apply-size-btn,
.preview-upload-btn {
  place-self: center center;
  width: 100%;
}

.color-mode-toggle input {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #94a3b8;
  border-radius: 4px;
  background: #fff;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}

.color-mode-toggle input:checked {
  background: #2563eb;
  border-color: #2563eb;
}

.color-mode-toggle input:checked::after {
  content: "✓";
  position: absolute;
  color: white;
  font-size: 14px;
  font-weight: bold;
  left: 2px;
  top: -2px;
}

/* #endregion */

/* #endregion */

@media (width <= 768px) {
  .color-mode-toggle span {
    white-space: nowrap;
  }

  .internal-links-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .internal-link-card {
    flex-direction: row;
    gap: 14px;
    padding: 12px 16px;
    text-align: right;
  }

  .internal-link-icon {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    margin-bottom: 0;
  }

  .preview-toolbar {
    position: fixed;
    top: 75px;
    left: 0;
    right: 0;
    z-index: 9990;
    display: flex;
    justify-content: flex-start; /* تغییر از center به flex-start برای اسکرول روان دکمه‌ها در موبایل */
    flex-wrap: nowrap;
    gap: 6px;
    margin: 0;
    padding: 8px 12px;
    background: var(--preview-bg);
    border: 1px solid var(--toolbar-border);
    border-radius: 0 0 12px 12px;
    box-sizing: border-box;
    box-shadow: 0 4px 12px rgb(0 0 0 / 8%);
  }

  .print-options-group {
    grid-template-columns: 1fr;
  }
}

@media (width <= 600px) {
  .preview-upload-btn {
    width: 100%;
    box-sizing: border-box;
  }

  .preview-dimensions-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .grid-controls-field {
    display: contents;
  }

  .apply-size-btn {
    grid-column: 1/-1;
  }
}

/* #region Pc View */
@media (width >= 769px) {
  .preview-container {
    width: min(1200px, calc(100vw - 40px));
    max-width: 1200px;
    margin: 20px auto;
  }

  .preview-workspace-container {
    grid-template-rows: 32px minmax(520px, 1fr);
    min-height: 560px;
  }

  .preview-workspace-container .preview-stage {
    min-height: 520px;
    padding: 45px;
  }

  .preview-stage {
    height: 520px;
  }

  .workspace-middle-row {
    min-height: 520px;
  }

  .preview-action-buttons {
    max-width: 420px;
    flex-direction: row;
  }

  .preview-action-buttons > * {
    flex: 1;
  }

  .preview-dimensions-panel {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .preview-dimensions-panel > .grid-controls-field,
  .preview-dimensions-panel > .apply-size-btn,
  .preview-dimensions-panel > .preview-upload-btn {
    grid-column: span 1;
    place-self: center center;
  }
}

/* #endregion */

/* #region Grayscale */
.grid-color-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  padding: 6px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
}

.grid-color-option input[type="color"] {
  width: 55px;
  height: 32px;
  padding: 2px;
  border-radius: 6px;
  cursor: pointer;
}

.print-type-container {
  width: 100%;
}

.print-options-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 25px;
  padding: 12px;
  min-height: 60px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  box-sizing: border-box;
}

.print-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
}

/* موبایل */
@media (width <= 768px) {
  .print-options-group {
    flex-wrap: wrap;
    gap: 15px;
  }

  .print-option {
    white-space: normal;
    justify-content: center;
  }
}

/* #endregion */
#preview-info-box {
  display: none !important;
}

.circle-guide-field .circle-guide-toggle {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-sizing: border-box;
}

.circle-guide-field .circle-guide-toggle input[type="checkbox"] {
  appearance: none;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  box-sizing: border-box;
  position: relative;
}

.circle-guide-field .circle-guide-toggle input[type="checkbox"]:checked {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.circle-guide-field .circle-guide-toggle input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.circle-guide-field .circle-guide-toggle span {
  white-space: nowrap;
}

@media (width <= 600px) {
  .preview-dimensions-panel .preview-upload-btn {
    grid-column: 1/-1;
    display: flex;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
  }
}

/* =====================================================
   AUTH PANEL PROFESSIONAL STYLE
===================================================== */

#auth-panel {
  position: fixed;
  inset: 0;
  z-index: 9999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgb(15 23 42 / 65%);
  backdrop-filter: blur(8px);
  direction: rtl;
}

/* وقتی hidden است */
#auth-panel[hidden] {
  display: none !important;
}

/* کارت اصلی */

#auth-panel .auth-box {
  width: min(380px, 92vw);
  padding: 28px 26px;
  background: #fff;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 25px 60px rgb(15 23 42 / 25%);
  animation: authShow 0.25s ease;
}

/* انیمیشن ورود */

@keyframes authShow {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* آیکون */

#auth-panel .auth-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f1f5f9;
  color: #334155;
  font-size: 22px;
}

/* عنوان */

#auth-panel h2 {
  margin: 0 0 12px;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}

/* توضیح */

#auth-panel p {
  margin: 0 0 28px;
  text-align: center;
  line-height: 1.8;
  font-size: 14px;
  color: #64748b;
}

/* فیلدها */

#auth-panel .auth-field {
  margin-bottom: 18px;
}

#auth-panel label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

#auth-panel input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  transition: 0.2s;
}

#auth-panel input:focus {
  outline: none;
  border-color: #334155;
  box-shadow: 0 0 0 3px rgb(51 65 85 / 12%);
}

/* همه دکمه ها */

#auth-panel button {
  width: 100%;
  height: 44px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
}

/* ورود اصلی */

#auth-submit {
  margin-top: 8px;
  border: none;
  background: #334155;
  color: white;
}

#auth-submit:hover {
  background: #1e293b;
}

/* دکمه های فرعی */

#auth-guest-btn,
#auth-back-btn {
  margin-top: 12px;
  background: #fff;
  border: 1px solid #cbd5e1;
  color: #475569;
}

#auth-guest-btn:hover,
#auth-back-btn:hover {
  background: #f8fafc;
}

.auth-error {
  margin-top: 10px;
  color: #dc2626;
  font-size: 13px;
  text-align: center;
}
/* ==============================
   Undo / Redo Buttons
============================== */

.preview-toolbar button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#undo-btn,
#redo-btn {
  position: relative;
}

#undo-btn:hover:not(:disabled),
#redo-btn:hover:not(:disabled) {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

#undo-btn i,
#redo-btn i {
  font-size: 15px;
}

/* حالت فعال History */

#undo-btn:not(:disabled),
#redo-btn:not(:disabled) {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #2563eb;
}

/* ShopPrint Lite layout polish */

.preview-direct-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  grid-column: 1;
  grid-row: 2 / span 2;
  align-self: start;
  width: 100%;
  min-width: 0;
}
.preview-direct-actions .preview-save-file-btn,
.preview-direct-actions .preview-print-btn {
  width: 100%;
  min-height: 42px;
  box-sizing: border-box;
}
.preview-save-file-btn,
.preview-print-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #334155;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.preview-print-btn {
  background: #f1f5f9;
}
.preview-print-btn:hover,
.preview-save-file-btn:hover {
  background: #e2e8f0;
}
.preview-image-adjustments {
  width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box;
}
.preview-adjustment-row {
  display: grid !important;
  grid-template-columns: minmax(72px, auto) minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  box-sizing: border-box;
}
.preview-adjustment-row label {
  min-width: 0 !important;
  width: auto !important;
}
.preview-adjustment-row input[type="range"] {
  width: 100% !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
  box-sizing: border-box !important;
}
@media (max-width: 768px) {
  .preview-direct-actions {
    grid-column: 1/-1;
    grid-row: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .preview-image-adjustments {
    grid-column: 1/-1 !important;
    width: 100% !important;
  }
  .preview-adjustment-row {
    grid-template-columns: minmax(64px, auto) minmax(0, 1fr) !important;
  }
  .preview-adjustment-row input[type="range"] {
    width: 100% !important;
  }
}
@media (min-width: 769px) {
  .preview-direct-actions {
    grid-column: 1;
    grid-row: 2 / span 3;
  }
}

/* #region adjustments */
.preview-image-adjustments {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  background: linear-gradient(180deg, #f9fbff, #f3f7fc);
  border: 1px solid #d6e1ef;
  border-radius: 12px;
}

@media (max-width: 768px) {
  .preview-image-adjustments {
    grid-template-columns: 1fr;
  }
}
/* #endregion */

/* #region Line Guide */

/*
  Preview Guide - Clean Final CSS
  Visual only - excluded from print/export
*/

/* =========================
   Guide Lines
========================= */

#guide-horizontal,
#guide-vertical {
  position: absolute;
  z-index: 30;
  pointer-events: none;
  display: none;
}

#guide-horizontal.active,
#guide-vertical.active {
  display: block;
}

#guide-horizontal {
  left: 0;
  right: 0;
  border-top: 1px dashed #ff3b30;
}

#guide-vertical {
  top: 0;
  bottom: 0;
  border-left: 1px dashed #ff3b30;
}

/* =========================
   Guide Drag Handles
========================= */

#guide-horizontal-handle,
#guide-vertical-handle {
  position: absolute;
  display: none;
  z-index: 9999;
  background: rgb(255 0 0 / 18%);
  touch-action: none;
  transition: background 0.2s ease;
}

/* Visible after checkbox activation */

#guide-horizontal-handle.active,
#guide-vertical-handle.active {
  display: block;
}

/* Horizontal handle */

#guide-horizontal-handle {
  left: 0;
  right: 0;
  top: -30px;
  height: 60px;
  cursor: ns-resize;
}

/* Vertical handle */

#guide-vertical-handle {
  top: 0;
  bottom: 0;
  left: -30px;
  width: 60px;
  cursor: ew-resize;
}

/* User feedback */

#guide-horizontal-handle:hover,
#guide-vertical-handle:hover {
  background: rgb(255 0 0 / 35%);
}

/* =========================
   Position Labels
========================= */
#guide-horizontal-label,
#guide-vertical-label {
  position: absolute;
  z-index: 120;
  background: #111;
  color: #fff;
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 4px;
  display: none;
  pointer-events: none;
  direction: ltr;
}

#guide-horizontal-label.active,
#guide-vertical-label.active {
  display: block;
}

/* =========================
   Print
========================= */

@media print {
  #guide-horizontal,
  #guide-vertical,
  #guide-horizontal-label,
  #guide-vertical-label,
  #guide-horizontal-handle,
  #guide-vertical-handle {
    display: none !important;
  }
}

/* #endregion */


