/* =========================================
   Âu Việt Global - Packing & Pallet Optimizer
   Design System & Styles
   ========================================= */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700&display=swap');

/* =========================================
   CSS Variables - Design Tokens
   ========================================= */
:root {
  /* Brand Colors */
  --blue-primary: #2563eb;
  --blue-dark: #1e40af;
  --blue-light: #eff6ff;
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-400: #60a5fa;
  --blue-600: #2563eb;
  --blue-800: #1e40af;

  /* Semantic Colors */
  --rose-50: #fff1f2;
  --rose-500: #f43f5e;
  --rose-600: #e11d48;
  --emerald-50: #ecfdf5;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --amber-50: #fffbeb;
  --amber-500: #f59e0b;
  --indigo-50: #eef2ff;
  --indigo-600: #4f46e5;
  --indigo-800: #3730a3;

  /* Neutral Colors */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* 3D Material Colors */
  --carton-kraft: #d4a373;
  --carton-edge: #78350f;
  --dimension-line: #facc15;
  --grid-floor: #334155;
  --product-glass: #60a5fa;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius: 0.5rem;
  --radius-md: 0.625rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition: 200ms ease;
  --transition-slow: 300ms ease;
}

/* =========================================
   Reset & Base Styles
   ========================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--slate-50);
  color: var(--slate-900);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* =========================================
   Typography
   ========================================= */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.25;
}

h1 {
  font-size: 1.875rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.125rem;
}

.text-primary {
  color: var(--blue-primary);
}

.text-secondary {
  color: var(--slate-500);
}

.text-muted {
  color: var(--slate-400);
}

/* =========================================
   Layout
   ========================================= */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  flex: 1;
  max-width: 1920px;
  margin: 0 auto;
  width: 100%;
}

/* =========================================
   Header
   ========================================= */
.header {
  background: linear-gradient(135deg, var(--blue-primary) 0%, var(--blue-dark) 100%);
  color: white;
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.header-logo svg {
  width: 28px;
  height: 28px;
  color: white;
}

.header-title {
  display: flex;
  flex-direction: column;
}

.header-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.header-title span {
  font-size: 0.75rem;
  opacity: 0.85;
  font-weight: 400;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}

/* =========================================
   Buttons
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: white;
  color: var(--blue-primary);
}

.btn-primary:hover {
  background: var(--blue-50);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--slate-100);
  color: var(--slate-700);
}

.btn-secondary:hover {
  background: var(--slate-200);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* =========================================
   Badges
   ========================================= */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-emerald {
  background: var(--emerald-50);
  color: var(--emerald-600);
}

.badge-amber {
  background: var(--amber-50);
  color: #d97706;
}

.badge-slate {
  background: var(--slate-100);
  color: var(--slate-500);
}

/* =========================================
   Control Panel (Left Column)
   ========================================= */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  max-height: calc(100vh - 120px);
  padding-right: 0.5rem;
}

.control-panel::-webkit-scrollbar {
  width: 6px;
}

.control-panel::-webkit-scrollbar-track {
  background: var(--slate-100);
  border-radius: 3px;
}

.control-panel::-webkit-scrollbar-thumb {
  background: var(--slate-300);
  border-radius: 3px;
}

/* =========================================
   Cards
   ========================================= */
.card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  overflow: visible;
  flex-shrink: 0;
}

.card-header {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-header svg {
  width: 20px;
  height: 20px;
  color: var(--blue-primary);
}

.card-header h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--slate-800);
}

.card-body {
  padding: 1rem;
}

/* =========================================
   Form Elements
   ========================================= */
.form-group {
  margin-bottom: 1rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--slate-600);
  margin-bottom: 0.375rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.input-group {
  position: relative;
  display: flex;
  flex-direction: column;
}

.input-group-label {
  display: block;
  font-size: 0.6875rem;
  color: var(--slate-500);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  font-weight: 500;
}

.input-group .input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  padding-right: 2.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius);
  background: var(--slate-50);
  color: var(--slate-900);
  transition: all var(--transition);
  font-family: inherit;
  height: 42px;
}

.input-group input:focus {
  outline: none;
  border-color: var(--blue-primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-group .input-suffix {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--slate-400);
  font-weight: 500;
  pointer-events: none;
}

/* =========================================
   Radio Button Group
   ========================================= */
.radio-group {
  display: flex;
  gap: 0.75rem;
}

.radio-option {
  flex: 1;
  position: relative;
}

.radio-option input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 1;
}

.radio-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem;
  background: var(--slate-50);
  border: 2px solid var(--slate-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.radio-option input:checked+label {
  background: var(--blue-50);
  border-color: var(--blue-primary);
  box-shadow: var(--shadow-md);
}

.radio-option label .radio-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--slate-800);
}

.radio-option label .radio-desc {
  font-size: 0.75rem;
  color: var(--slate-500);
}

/* 3-column radio group */
.radio-group-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.radio-group-3 .radio-option label {
  padding: 0.625rem 0.5rem;
}

.radio-group-3 .radio-option label svg {
  width: 24px;
  height: 24px;
  margin-bottom: 0.25rem;
  color: var(--slate-500);
}

.radio-group-3 .radio-option input:checked+label svg {
  color: var(--blue-primary);
}

/* Switch Toggle */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--slate-300);
  transition: var(--transition);
  border-radius: 26px;
}

.switch-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: var(--transition);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

.switch input:checked+.switch-slider {
  background-color: var(--emerald-500);
}

.switch input:checked+.switch-slider::before {
  transform: translateX(22px);
}

/* Form Hint */
.form-hint {
  font-size: 0.75rem;
  color: var(--slate-500);
  margin-top: 0.5rem;
  font-style: italic;
}

/* =========================================
   Multi-Layer Divider Configuration
   ========================================= */

/* Layer Tabs */
.layer-tabs {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.layer-tab {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  color: var(--slate-600);
  cursor: pointer;
  transition: all var(--transition);
}

.layer-tab:hover {
  background: var(--slate-200);
}

.layer-tab.active {
  background: var(--blue-primary);
  border-color: var(--blue-primary);
  color: white;
}

/* Divider Grid Container */
.divider-grid-container {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.divider-grid-label {
  font-size: 0.6875rem;
  color: var(--slate-500);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.divider-grid {
  display: grid;
  gap: 2px;
  margin-bottom: 0.5rem;
}

/* Divider Grid Cells */
.divider-cell {
  background: var(--slate-200);
  border-radius: 2px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  color: var(--slate-400);
}

.divider-cell.product {
  background: var(--blue-100);
  border: 1px solid var(--blue-200);
  min-height: 32px;
  min-width: 32px;
  cursor: default;
}

.divider-cell.product::before {
  content: '📦';
  font-size: 0.875rem;
}

.divider-cell.vertical {
  min-width: 12px;
  min-height: 32px;
  background: var(--slate-300);
}

.divider-cell.vertical.active {
  background: var(--emerald-500);
}

.divider-cell.horizontal {
  min-height: 12px;
  min-width: 32px;
  background: var(--slate-300);
}

.divider-cell.horizontal.active {
  background: var(--emerald-500);
}

.divider-cell.corner {
  min-width: 12px;
  min-height: 12px;
  background: transparent;
  cursor: default;
}

.divider-grid-legend {
  display: flex;
  gap: 1rem;
  font-size: 0.6875rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.legend-on {
  color: var(--emerald-500);
}

.legend-off {
  color: var(--slate-400);
}

/* Quick Actions */
.divider-quick-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 0.375rem 0.625rem;
  font-size: 0.6875rem;
}

/* Divider Statistics */
.divider-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.divider-stat {
  text-align: center;
  background: var(--slate-50);
  padding: 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
}

.divider-stat-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--blue-primary);
}

.divider-stat-label {
  font-size: 0.625rem;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* Divider Dimensions List */
.divider-dims-list {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--slate-200);
}

.divider-dim-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0;
  font-size: 0.75rem;
}

.divider-dim-item .dim-label {
  color: var(--slate-600);
}

.divider-dim-item .dim-value {
  font-weight: 600;
  color: var(--slate-800);
  font-family: 'Roboto Mono', monospace;
}

.divider-dim-pad {
  padding-top: 0.5rem;
  margin-top: 0.25rem;
  border-top: 1px solid var(--slate-200);
}

.divider-dim-pad .dim-value {
  color: var(--emerald-600);
}

/* =========================================
   Slider
   ========================================= */
.slider-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.slider-container input[type="range"] {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--slate-200);
  border-radius: 3px;
  outline: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--blue-primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition);
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.slider-value {
  min-width: 3rem;
  text-align: right;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--slate-700);
}

/* =========================================
   Info Cards (Results)
   ========================================= */

/* Results section - flex container for card reordering */
#results-section {
  display: flex;
  flex-direction: column;
}

.info-card {
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.info-card:last-child {
  margin-bottom: 0;
}

.info-card-blue {
  background: linear-gradient(135deg, var(--blue-600) 0%, var(--blue-800) 100%);
  color: white;
}

.info-card-rose {
  background: var(--rose-50);
  border: 1px solid rgba(244, 63, 94, 0.2);
}

.info-card-emerald {
  background: var(--emerald-50);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.info-card-indigo {
  background: linear-gradient(135deg, var(--indigo-600) 0%, var(--indigo-800) 100%);
  color: white;
}

.info-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.info-card-header svg {
  width: 18px;
  height: 18px;
}

.info-card-header span {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.info-card-blue .info-card-header span,
.info-card-indigo .info-card-header span {
  opacity: 0.9;
}

.info-card-rose .info-card-header {
  color: var(--rose-600);
}

.info-card-amber .info-card-header {
  color: var(--amber-600);
}

.info-card-emerald .info-card-header {
  color: var(--emerald-600);
}

.info-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.info-card-rose .info-card-value {
  color: var(--rose-600);
}

.info-card-emerald .info-card-value {
  color: var(--emerald-600);
}

.info-card-amber .info-card-value {
  color: var(--amber-600);
}

.info-card-sub {
  font-size: 0.8125rem;
  margin-top: 0.25rem;
}

.info-card-blue .info-card-sub,
.info-card-indigo .info-card-sub {
  opacity: 0.85;
}

.info-card-rose .info-card-sub {
  color: var(--rose-500);
}

.info-card-hint {
  font-size: 0.6875rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--slate-200);
  font-style: italic;
  line-height: 1.4;
}

.info-card-emerald .info-card-sub {
  color: var(--emerald-500);
}

.info-card-amber .info-card-sub {
  color: var(--amber-500);
}

/* =========================================
   Stage (Right Column - 3D Viewport)
   ========================================= */
.stage-container {
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: var(--radius-xl);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow);
  overflow: hidden;
  height: calc(100vh - 120px);
}

/* View Tabs */
.stage-tabs {
  display: flex;
  background: var(--slate-50);
  border-bottom: 1px solid var(--slate-200);
  padding: 0.5rem;
  gap: 0.5rem;
}

.stage-tab {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--slate-600);
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.stage-tab svg {
  width: 18px;
  height: 18px;
}

.stage-tab:hover {
  background: white;
  color: var(--slate-800);
}

.stage-tab.active {
  background: var(--blue-primary);
  color: white;
  box-shadow: var(--shadow-md);
}

/* 3D Viewport */
.stage-viewport {
  flex: 1;
  position: relative;
  background: var(--slate-900);
  overflow: hidden;
}

.stage-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Stage Toolbar */
.stage-toolbar {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
  z-index: 10;
}

.stage-toolbar .btn-tool {
  width: 40px;
  height: 40px;
  padding: 0;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  color: white;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage-toolbar .btn-tool svg {
  width: 20px;
  height: 20px;
}

.stage-toolbar .btn-tool:hover {
  background: rgba(255, 255, 255, 0.2);
}

.stage-toolbar .btn-tool.active {
  background: var(--blue-primary);
  border-color: var(--blue-primary);
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.3);
  margin: 0 0.25rem;
  align-self: center;
}

.zoom-display {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  height: 40px;
  min-width: 60px;
  justify-content: center;
}

/* Stage Label */
.stage-label {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  color: white;
  font-size: 0.8125rem;
  font-weight: 600;
  z-index: 10;
}

/* =========================================
   Texture Upload
   ========================================= */
.texture-upload-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.texture-upload-item {
  aspect-ratio: 1;
  background: var(--slate-100);
  border: 2px dashed var(--slate-300);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.texture-upload-item:hover {
  border-color: var(--blue-primary);
  background: var(--blue-50);
}

.texture-upload-item input {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.texture-upload-item svg {
  width: 24px;
  height: 24px;
  color: var(--slate-400);
  margin-bottom: 0.25rem;
}

.texture-upload-item span {
  font-size: 0.625rem;
  color: var(--slate-500);
  text-align: center;
}

.texture-upload-item img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* =========================================
   Export Overlay
   ========================================= */
.export-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-slow);
}

.export-overlay.active {
  opacity: 1;
  visibility: visible;
}

.export-modal {
  background: white;
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px);
  transition: transform var(--transition-slow);
}

.export-overlay.active .export-modal {
  transform: translateY(0);
}

.export-loader {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem;
  border: 4px solid var(--slate-200);
  border-top-color: var(--blue-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.export-modal h3 {
  font-size: 1.25rem;
  color: var(--slate-900);
  margin-bottom: 0.5rem;
}

.export-modal p {
  color: var(--slate-500);
  margin-bottom: 1.5rem;
}

.progress-bar {
  height: 8px;
  background: var(--slate-200);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-primary), var(--blue-400));
  border-radius: 4px;
  width: 0%;
  transition: width var(--transition);
}

/* =========================================
   Pallet Results Grid
   ========================================= */
.pallet-results {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.pallet-stat {
  background: var(--slate-50);
  padding: 0.75rem;
  border-radius: var(--radius);
  text-align: center;
}

.pallet-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--slate-900);
}

.pallet-stat-label {
  font-size: 0.6875rem;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* =========================================
   Badge
   ========================================= */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-amber {
  background: var(--amber-50);
  color: var(--amber-500);
}

.badge-emerald {
  background: var(--emerald-50);
  color: var(--emerald-600);
}

.badge-blue {
  background: var(--blue-50);
  color: var(--blue-600);
}

/* =========================================
   Responsive Design
   ========================================= */
@media (max-width: 1200px) {
  .main-content {
    grid-template-columns: 380px 1fr;
  }
}

@media (max-width: 992px) {
  .main-content {
    grid-template-columns: 1fr;
  }

  .control-panel {
    max-height: none;
    order: 2;
  }

  .stage-container {
    height: 500px;
    order: 1;
  }
}

@media (max-width: 576px) {
  .header {
    padding: 0.75rem 1rem;
  }

  .header-title h1 {
    font-size: 1rem;
  }

  .main-content {
    padding: 1rem;
    gap: 1rem;
  }

  .form-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .stage-tabs {
    flex-wrap: wrap;
  }

  .stage-tab {
    flex: 1 1 calc(50% - 0.25rem);
  }
}

/* =========================================
   Utilities
   ========================================= */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.divider {
  height: 1px;
  background: var(--slate-200);
  margin: 1rem 0;
}

/* Export Menu Items */
.export-menu-item:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}

/* =========================================
   Form Select (Dropdown)
   ========================================= */
.form-select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  font-size: 0.9375rem;
  font-weight: 500;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius);
  background: var(--slate-50);
  color: var(--slate-900);
  transition: all var(--transition);
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

.form-select:focus {
  outline: none;
  border-color: var(--blue-primary);
  background-color: white;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* =========================================
   Truck Settings Styles
   ========================================= */
.truck-specs {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0;
  font-size: 0.8125rem;
}

.truck-spec-label {
  color: var(--slate-500);
}

.truck-spec-value {
  font-weight: 600;
  color: var(--slate-800);
  font-family: 'Roboto Mono', monospace;
  font-size: 1.1rem;
}

/* Info Card - Violet variant */
.info-card-violet {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  border-color: #c4b5fd;
}

.info-card-violet .info-card-header {
  color: #6d28d9;
}

.info-card-violet .info-card-header svg {
  color: #7c3aed;
}

.info-card-violet .info-card-value {
  color: #4c1d95;
}

/* =========================================
   Truck Mode - Reorder panels
   ========================================= */
.control-panel.truck-mode {
  display: flex;
  flex-direction: column;
}

.control-panel.truck-mode #truck-settings {
  order: -2;
}

.control-panel.truck-mode #truck-results-card {
  order: -1;
}