/* ===================================================
   THERMAL LABEL DESIGNER — CSS
   Clean, minimal, print-accurate
   =================================================== */

/* ---------- CSS Variables ---------- */
:root {
  --primary: #137fec;
  --primary-hover: #1068c4;
  --primary-light: rgba(19, 127, 236, 0.08);
  --primary-lighter: rgba(19, 127, 236, 0.04);
  --bg-light: #f6f7f8;
  --bg-white: #ffffff;
  --text-900: #0f172a;
  --text-700: #334155;
  --text-600: #475569;
  --text-500: #64748b;
  --text-400: #94a3b8;
  --border-200: #e2e8f0;
  --border-100: #f1f5f9;
  --green-500: #22c55e;
  --red-500: #ef4444;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  --radius: 0.25rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --transition: all 0.2s ease;

  /* Print dimensions in mm (for @media print) */
  --paper-w: 74mm;
  --paper-h: 22mm;
  --label-w: 35mm;
  --label-h: 20mm;

  /* Screen scale: 1mm ≈ 8px for preview */
  --scale: 8;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-light);
  color: var(--text-900);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input,
select {
  font-family: inherit;
}

/* ---------- Header ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-200);
  padding: 0 1.5rem;
  height: 57px;
  background: var(--bg-white);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-icon {
  width: 2rem;
  height: 2rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  border-radius: var(--radius-lg);
}

.header-title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-900);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-600);
  transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
}

/* ---------- Main Layout ---------- */
.app-main {
  flex: 1;
  display: flex;
  height: calc(100vh - 57px);
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 480px;
  min-width: 400px;
  background: var(--bg-white);
  border-right: 1px solid var(--border-200);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 10;
  box-shadow: var(--shadow-lg);
}

.sidebar-content {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1;
}

.sidebar-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-900);
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.sidebar-subtitle {
  font-size: 0.875rem;
  color: var(--text-500);
  line-height: 1.5;
}

.divider {
  height: 1px;
  background: var(--border-100);
  width: 100%;
}

/* ---------- Config Header ---------- */
.config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.config-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-700);
  letter-spacing: 0.05em;
}

.font-manage-btn {
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--primary);
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  background: var(--primary-lighter);
  border-radius: var(--radius);
  transition: var(--transition);
}

.font-manage-btn:hover {
  background: var(--primary-light);
  color: var(--primary-hover);
}

/* ---------- Form Inputs ---------- */
.config-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-700);
}

.input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.input-icon-wrapper {
  position: relative;
}

.input-icon-wrapper .input-icon {
  position: absolute;
  top: 50%;
  left: 0.5rem;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--text-400);
  pointer-events: none;
  transition: var(--transition);
}

.input-icon-wrapper:focus-within .input-icon {
  color: var(--primary);
}

.size-select {
  width: 85px;
  flex-shrink: 0;
}

.font-select {
  width: 140px;
  flex-shrink: 0;
}

/* ---------- Custom Font Picker (with preview) ---------- */
.font-picker {
  position: relative;
  width: 140px;
  flex-shrink: 0;
}

.font-picker-trigger {
  width: 100%;
  padding: 0.625rem 0.75rem 0.625rem 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-200);
  background: #f8fafc;
  color: var(--text-900);
  font-size: 0.8125rem;
  font-weight: 500;
  outline: none;
  transition: var(--transition);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 1.5rem;
}

.font-picker-trigger:hover {
  background-color: #f1f5f9;
}

.font-picker.open .font-picker-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 127, 236, 0.15);
  background-color: var(--bg-white);
}

.font-picker-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 260px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-white);
  border: 1px solid var(--border-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 100;
  padding: 0.25rem;
  animation: dropdown-in 0.15s ease;
}

.font-picker.open .font-picker-dropdown {
  display: block;
}

@keyframes dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.font-picker-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.font-picker-option:hover {
  background: var(--primary-light);
}

.font-picker-option.selected {
  background: var(--primary-light);
  color: var(--primary);
}

.font-picker-option .font-preview-text {
  font-size: 0.9375rem;
  line-height: 1.3;
  color: var(--text-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.font-picker-option .font-preview-name {
  font-size: 0.6875rem;
  color: var(--text-400);
  font-family: 'Inter', sans-serif !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.font-picker-option.selected .font-preview-text {
  color: var(--primary);
  font-weight: 600;
}

.font-picker-divider {
  height: 1px;
  background: var(--border-100);
  margin: 0.25rem 0;
}

/* Scrollbar cho dropdown */
.font-picker-dropdown::-webkit-scrollbar {
  width: 4px;
}

.font-picker-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.font-picker-dropdown::-webkit-scrollbar-thumb {
  background: var(--border-200);
  border-radius: 4px;
}


.flex-grow {
  flex: 1;
}

.form-input,
.form-select {
  width: 100%;
  padding: 0.625rem 0.75rem 0.625rem 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-200);
  background: #f8fafc;
  color: var(--text-900);
  font-size: 0.8125rem;
  font-weight: 500;
  outline: none;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 127, 236, 0.15);
  background: var(--bg-white);
}

.form-input:hover,
.form-select:hover {
  background: #f1f5f9;
}

.form-input::placeholder {
  color: var(--text-400);
}

.form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 1.5rem;
}

/* Number input spin buttons */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 1;
  height: 28px;
}

/* ---------- Radio Buttons ---------- */
.radio-group {
  display: flex;
  gap: 1rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-600);
  cursor: pointer;
  transition: var(--transition);
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-lg);
}

.radio-label:hover {
  color: var(--primary);
  background: var(--primary-lighter);
}

.radio-label.active {
  color: var(--text-900);
  font-weight: 500;
}

.radio-label input[type="radio"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ---------- Action Buttons ---------- */
.sidebar-actions {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-generate {
  width: 100%;
  height: 3rem;
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 0.9375rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.btn-generate:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.btn-generate:active {
  transform: translateY(0);
}

.btn-generate .material-symbols-outlined {
  transition: var(--transition);
}

.btn-generate:hover .material-symbols-outlined {
  animation: pulse-icon 1s infinite;
}

@keyframes pulse-icon {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.disclaimer-text {
  font-size: 0.75rem;
  text-align: center;
  color: var(--text-400);
}

/* ---------- Preview Section ---------- */
.preview-section {
  flex: 1;
  background: var(--bg-light);
  display: flex;
  flex-direction: column;
  position: relative;
}

.preview-toolbar {
  height: 4rem;
  border-bottom: 1px solid var(--border-200);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 10;
}

.toolbar-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-500);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-secondary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-white);
  border: 1px solid var(--border-200);
  border-radius: var(--radius-lg);
  color: var(--text-700);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: #f8fafc;
}

.btn-print {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--text-900);
  color: white;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.btn-print:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.btn-print:active {
  transform: translateY(0);
}

/* ---------- Canvas Area ---------- */
.canvas-area {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  position: relative;
}

.dot-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.03;
  pointer-events: none;
  background-image: radial-gradient(#000 1px, transparent 1px);
  background-size: 20px 20px;
}

.canvas-wrapper {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Print Canvas: 74mm x 22mm at screen scale (8px/mm) */
.print-canvas {
  position: relative;
  width: calc(74 * var(--scale) * 1px);
  /* 592px */
  min-height: calc(22 * var(--scale) * 1px);
  /* 176px min */
  width: 592px;
  min-height: 176px;
  background: #fdfdfd;
  box-shadow: var(--shadow-2xl);
  border-radius: 2px;
  overflow: visible;
  border: 1px solid var(--border-100);
}

/* Dimension markers */
.dim-top {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1rem;
  border-bottom: 1px dashed var(--border-200);
  display: flex;
  justify-content: space-between;
  padding: 0 0.5rem;
  align-items: center;
}

.dim-left {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 1rem;
  border-right: 1px dashed var(--border-200);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.5rem 0;
  align-items: center;
}

.dim-label {
  font-size: 10px;
  color: var(--text-400);
  font-family: 'Courier New', monospace;
}

.dim-rotated {
  transform: rotate(90deg);
  white-space: nowrap;
}

/* Labels container */
.labels-container {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Each page row = 1 printed page (max 2 labels) */
.preview-page-row {
  width: 100%;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 8px 5px;
  box-sizing: border-box;
}

.preview-page-row+.preview-page-row {
  border-top: 2px dashed var(--border-200);
}

/* Individual label: 35mm w x 20mm h at screen scale */
.label-card {
  position: relative;
  width: 280px;
  /* 35mm * 8 */
  height: 160px;
  /* 20mm * 8 */
  background: white;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  overflow: hidden;
}

.label-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px var(--border-100);
  pointer-events: none;
}

.label-card:hover {
  border-color: var(--primary);
}

.label-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 1.5rem;
  height: 1.5rem;
  background: #e2e8f0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-500);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  z-index: 20;
}

.label-card:hover .label-badge {
  background: var(--primary);
  color: white;
}

.label-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
}

.label-product-name {
  font-weight: 700;
  color: var(--text-900);
  line-height: 1.2;
  text-transform: uppercase;
  margin-bottom: 4px;
  word-break: break-word;
}

.label-date {
  color: var(--text-600);
  font-weight: 500;
  margin-top: 4px;
}

/* Canvas shadow */
.canvas-shadow {
  width: 560px;
  height: 16px;
  background: rgba(0, 0, 0, 0.06);
  filter: blur(16px);
  border-radius: 100%;
  margin-top: 1rem;
}

/* Size info */
.size-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  text-align: center;
  margin-top: 3rem;
}

.size-info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.size-info-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.size-info-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-700);
}

/* ---------- Status Bar ---------- */
.status-bar {
  height: 2.5rem;
  background: var(--bg-white);
  border-top: 1px solid var(--border-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  font-size: 0.75rem;
  color: var(--text-500);
}

.status-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--green-500);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.status-bold {
  font-weight: 500;
  color: var(--text-700);
}

/* ---------- Modal ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-container {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  width: 100%;
  max-width: 28rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  animation: modal-in 0.25s ease;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border-200);
}

.modal-header h3 {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text-900);
}

.modal-close-btn {
  color: var(--text-500);
  transition: var(--transition);
  padding: 0.25rem;
  border-radius: var(--radius);
}

.modal-close-btn:hover {
  color: var(--text-700);
  background: #f1f5f9;
}

.modal-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-200);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-lg);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

/* Upload zone */
.upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.upload-zone:hover {
  background: #f8fafc;
  border-color: var(--primary);
}

.upload-zone.drag-over {
  background: var(--primary-lighter);
  border-color: var(--primary);
}

.upload-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.upload-zone:hover .upload-icon {
  transform: scale(1.1);
}

.upload-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-900);
}

.upload-subtitle {
  font-size: 0.75rem;
  color: var(--text-500);
}

/* Uploaded fonts list */
.uploaded-fonts-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.font-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.empty-font-msg {
  font-size: 0.8125rem;
  color: var(--text-400);
  text-align: center;
  padding: 1rem;
}

.font-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: #f8fafc;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-200);
}

.font-item-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.font-item-info .material-symbols-outlined {
  color: var(--text-400);
}

.font-item-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-900);
}

.font-item-file {
  font-size: 0.75rem;
  color: var(--text-500);
}

.font-delete-btn {
  color: var(--text-400);
  padding: 0.25rem;
  border-radius: var(--radius);
  transition: var(--transition);
}

.font-delete-btn:hover {
  color: var(--red-500);
  background: rgba(239, 68, 68, 0.08);
}

/* ---------- Font Badges ---------- */
.font-badge {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.125rem 0.375rem;
  border-radius: 9999px;
  vertical-align: middle;
  margin-left: 0.375rem;
}

.font-badge.local {
  background: #dcfce7;
  color: #166534;
}

.font-badge.session {
  background: #fef3c7;
  color: #92400e;
}

/* ---------- Print Area — luôn render off-screen ---------- */
.print-area {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 74mm;
  height: 22mm;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  background: white;
}

/* ==========================================
   PRINT — chỉ hiện print area, 1 trang duy nhất
   ========================================== */
@media print {

  /* Ẩn TẤT CẢ phần tử (display:none = xóa khỏi flow = 1 trang) */
  body>*:not(#printArea) {
    display: none !important;
  }

  /* Hiện print area */
  #printArea {
    display: block !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 74mm;
    margin: 0;
    padding: 0;
  }

  .print-page {
    width: 74mm;
    height: 22mm;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    page-break-after: always;
  }

  .print-label {
    width: 35mm;
    height: 20mm;
    margin: 1mm;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: none;
    box-sizing: border-box;
  }

  .print-label-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    height: 100%;
    padding: 1mm;
    box-sizing: border-box;
  }

  .print-product-name {
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.15;
    color: black;
    word-break: break-word;
  }

  .print-date {
    color: black;
    font-weight: 500;
    margin-top: 0.5mm;
  }

  @page {
    size: 74mm 22mm;
    margin: 0;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app-main {
    flex-direction: column;
    overflow-y: auto;
  }

  .sidebar {
    width: 100%;
    min-width: unset;
    border-right: none;
    border-bottom: 1px solid var(--border-200);
    box-shadow: none;
  }

  .header-nav {
    display: none;
  }

  .canvas-area {
    padding: 1.5rem;
  }

  .print-canvas {
    width: 370px;
    height: 110px;
  }

  .label-card {
    width: 170px;
    height: 95px;
  }

  .label-product-name {
    font-size: 12px !important;
  }

  .label-date {
    font-size: 10px !important;
  }

  .canvas-shadow {
    width: 350px;
  }
}

/* ---------- Toast Notification ---------- */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.75rem 1.25rem;
  background: var(--text-900);
  color: white;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  z-index: 100;
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2.7s forwards;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(1rem);
  }
}

/* ---------- Animation on generate ---------- */
.label-card.animate {
  animation: label-pop 0.4s ease;
}

@keyframes label-pop {
  0% {
    transform: scale(0.9);
    opacity: 0.5;
  }

  50% {
    transform: scale(1.03);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}