/* Etiket Tasarım Modülü */
.label-designer {
  padding-bottom: 32px;
}

/* Hero */
.lbl-hero {
  padding: 18px 16px;
  margin-bottom: 14px;
}

.lbl-hero-top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.lbl-hero-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.lbl-hero-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 6px;
}

.lbl-hero-desc {
  font-size: .84rem;
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.lbl-hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.lbl-stat {
  text-align: center;
  min-width: 0;
}

.lbl-stat strong {
  display: block;
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lbl-stat span {
  display: block;
  font-size: .68rem;
  color: var(--muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Preview card */
.lbl-preview-card {
  padding: 0;
  overflow: hidden;
  margin-bottom: 14px;
}

.lbl-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}

.lbl-preview-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lbl-preview-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
}

.lbl-preview-info {
  font-size: .75rem;
  color: var(--muted);
}

.lbl-preview-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.lbl-ctrl-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .15s;
}

.lbl-ctrl-btn:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.lbl-ctrl-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.lbl-zoom-label,
.lbl-preview-counter {
  font-size: .72rem;
  color: var(--muted);
  min-width: 36px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.label-preview-wrap {
  --lbl-zoom: 1;
  background:
    linear-gradient(45deg, rgba(148, 163, 184, .12) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, .12) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, .12) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, .12) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #e8edf3;
  padding: 28px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 220px;
  overflow: auto;
}

html[data-theme-mode="dark"] .label-preview-wrap {
  background-color: #1a2230;
}

.label-sheet-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 4mm;
  justify-content: center;
  max-width: 100%;
  transform: scale(var(--lbl-zoom));
  transform-origin: center center;
  transition: transform .15s ease;
}

.lbl-preview-hint {
  font-size: .75rem;
  color: var(--muted);
  text-align: center;
  padding: 10px 14px;
  margin: 0;
  border-top: 1px solid var(--border);
}

.lbl-preview-error {
  color: var(--danger);
  font-size: .85rem;
  padding: 12px;
  text-align: center;
}

/* Tabs */
.lbl-tabs {
  margin-bottom: 12px;
}

.lbl-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .2);
  font-size: .68rem;
  font-weight: 700;
}

.tab:not(.active) .lbl-tab-badge {
  background: var(--surface-active);
  color: var(--primary);
}

.lbl-tab-panel.hidden {
  display: none;
}

/* Sections */
.lbl-section {
  padding: 16px;
  margin-bottom: 12px;
}

.lbl-section-head {
  margin-bottom: 14px;
}

.lbl-section-head h4 {
  font-size: .95rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.lbl-section-head p {
  font-size: .8rem;
  color: var(--muted);
  margin: 0;
}

.lbl-inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.lbl-inline-fields--3 {
  grid-template-columns: 1fr;
}

@media (min-width: 480px) {
  .lbl-inline-fields--3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.lbl-custom-size {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

/* Quick templates */
.lbl-template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.lbl-template-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  text-align: left;
  transition: .15s;
}

.lbl-template-btn:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.lbl-template-name {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
}

.lbl-template-desc {
  font-size: .72rem;
  color: var(--muted);
}

/* Size cards */
.lbl-size-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.lbl-size-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  text-align: center;
  transition: .15s;
  position: relative;
}

.lbl-size-card:hover:not(.is-locked) {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.lbl-size-card.is-active {
  border-color: var(--primary);
  background: var(--surface-active);
  box-shadow: 0 0 0 1px var(--primary);
}

.lbl-size-card.is-locked {
  opacity: .55;
  cursor: not-allowed;
}

.lbl-size-visual-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 4px 0;
}

.lbl-size-visual {
  width: 48px;
  max-height: 36px;
  background: #fff;
  border: 1.5px solid var(--primary);
  border-radius: 2px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5);
}

.lbl-size-card.is-active .lbl-size-visual {
  background: var(--primary-light);
  border-color: var(--primary-dark);
}

.lbl-size-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.lbl-size-dim {
  font-size: .7rem;
  color: var(--muted);
}

.lbl-size-tag,
.lbl-size-lock {
  font-size: .62rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.lbl-size-tag {
  background: var(--surface-active);
  color: var(--primary);
}

.lbl-size-lock {
  background: rgba(245, 158, 11, .15);
  color: var(--warning);
}

/* Field toggles */
.lbl-field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 520px) {
  .lbl-field-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.lbl-field-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  transition: .15s;
}

.lbl-field-card:hover:not(.is-locked) {
  border-color: var(--primary);
}

.lbl-field-card.is-on {
  border-color: var(--primary);
  background: var(--surface-active);
}

.lbl-field-card.is-locked {
  opacity: .6;
  cursor: not-allowed;
}

.lbl-field-card input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.lbl-field-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: .85rem;
  flex-shrink: 0;
}

.lbl-field-card.is-on .lbl-field-icon {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.lbl-field-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lbl-field-name {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
}

.lbl-field-name small {
  font-weight: 500;
  color: var(--warning);
}

.lbl-field-hint {
  font-size: .72rem;
  color: var(--muted);
  line-height: 1.3;
}

.lbl-field-switch {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--border);
  flex-shrink: 0;
  position: relative;
  transition: .15s;
}

.lbl-field-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: .15s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.lbl-field-card.is-on .lbl-field-switch {
  background: var(--primary);
}

.lbl-field-card.is-on .lbl-field-switch::after {
  left: 19px;
}

.lbl-save-btn {
  width: 100%;
  margin-top: 4px;
}

/* Products tab */
.lbl-stock-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
}

.lbl-stock-toggle input {
  width: auto;
  margin-top: 3px;
  accent-color: var(--primary);
}

.lbl-stock-toggle strong {
  display: block;
  font-size: .88rem;
  margin-bottom: 2px;
}

.lbl-stock-toggle small {
  display: block;
  font-size: .75rem;
  color: var(--muted);
  line-height: 1.35;
}

.lbl-search {
  margin-bottom: 10px;
}

.lbl-filter-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.lbl-filter-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: .78rem;
  cursor: pointer;
  transition: .15s;
}

.lbl-filter-btn.is-active {
  border-color: var(--primary);
  background: var(--surface-active);
  color: var(--primary);
  font-weight: 600;
}

.lbl-product-picker {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
}

.lbl-product-row {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 2px 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: .12s;
  align-items: start;
}

.lbl-product-row:last-child {
  border-bottom: none;
}

.lbl-product-row:hover {
  background: var(--surface-hover);
}

.lbl-product-row.is-selected {
  background: var(--surface-active);
}

.lbl-product-row input {
  width: auto;
  grid-row: 1 / 3;
  align-self: center;
  accent-color: var(--primary);
}

.lbl-product-main {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.lbl-product-name {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
}

.lbl-product-variant {
  font-size: .68rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-active);
  color: var(--primary);
}

.lbl-product-meta {
  grid-column: 2;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: .75rem;
  color: var(--muted);
}

.lbl-product-barcode {
  font-family: ui-monospace, monospace;
  letter-spacing: .03em;
}

.lbl-product-warn {
  color: var(--warning);
  font-weight: 600;
}

.lbl-product-stock {
  margin-left: auto;
}

.lbl-picker-actions {
  display: flex;
  gap: 8px;
}

.lbl-picker-actions .btn {
  flex: 1;
}

.lbl-empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}

.lbl-empty-state span {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}

.lbl-empty-state p {
  margin: 0 0 4px;
  font-weight: 600;
  color: var(--text);
}

.lbl-empty-state small {
  font-size: .78rem;
}

/* Label print output */
.product-label {
  background: #fff;
  color: #000;
  border: 1px dashed #94a3b8;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
}

.product-label .lbl-company {
  font-weight: 700;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-label .lbl-name {
  font-weight: 600;
  width: 100%;
  line-height: 1.15;
  word-break: break-word;
}

.product-label .lbl-code,
.product-label .lbl-unit {
  color: #475569;
  width: 100%;
}

.product-label .lbl-price {
  font-weight: 700;
  width: 100%;
}

.product-label .lbl-barcode-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  justify-content: center;
}

.product-label .lbl-barcode-wrap svg {
  max-width: 100%;
  height: auto;
}

.product-label .lbl-barcode-text {
  font-family: ui-monospace, monospace;
  letter-spacing: .05em;
}

.product-label .lbl-qr {
  display: flex;
  justify-content: center;
}

.product-label.font-small { font-size: 7pt; }
.product-label.font-medium { font-size: 9pt; }
.product-label.font-large { font-size: 11pt; }

/* Print */
#print-labels-root { display: none; }

@media print {
  body * { visibility: hidden !important; }
  #print-labels-root, #print-labels-root * { visibility: visible !important; }
  #print-labels-root {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #fff;
    padding: 0;
    margin: 0;
  }
  .product-label {
    border: none;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .print-sheet-a4 {
    display: grid;
    grid-template-columns: repeat(3, 70mm);
    gap: 0;
    width: 210mm;
    padding: 8mm;
  }
  @page {
    size: A4;
    margin: 0;
  }
}
