/* ── CSS Variables ── */
:root {
  --ink: #1c2333;
  --muted: #5b6478;
  --line: #e3e7f0;
  --bg: #f4f6fb;
  --card: #ffffff;
  --indigo: #4f46e5;
  --indigo-dark: #4338ca;
  --paper: #ffffff;
  --ok: #16a34a;
  --err: #dc2626;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(28, 35, 51, 0.08);
  --shadow-lg: 0 20px 60px rgba(28, 35, 51, 0.15);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Dark Mode ── */
[data-theme="dark"] {
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --line: #334155;
  --bg: #0f172a;
  --card: #1e293b;
  --paper: #ffffff;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
  --glass-bg: rgba(30, 41, 59, 0.8);
  --glass-border: rgba(51, 65, 85, 0.5);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; transition: background 0.3s ease, color 0.3s ease; }

html, body { margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes ripple {
  0% { transform: scale(0); opacity: 1; }
  100% { transform: scale(4); opacity: 0; }
}

@keyframes checkmark {
  0% { stroke-dashoffset: 100; }
  100% { stroke-dashoffset: 0; }
}

/* ── Top Bar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
  animation: fadeInDown 0.5s ease;
}

@supports (backdrop-filter: blur(20px)) {
  .topbar {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
}

.brand {
  font-weight: 800;
  font-size: 20px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.brand:hover {
  transform: scale(1.02);
  color: var(--indigo);
}

.brand-icon {
  font-size: 24px;
}

/* ── Theme Toggle ── */
.theme-toggle {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 50px;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  transition: var(--transition);
}

.theme-toggle:hover {
  background: var(--indigo);
  color: white;
  border-color: var(--indigo);
  transform: scale(1.05);
}

.theme-icon {
  font-size: 16px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
  transform: scale(0);
  opacity: 0;
  transition: transform 0.5s, opacity 0.5s;
  border-radius: 50%;
  pointer-events: none;
}

.btn:active::after {
  transform: scale(2);
  opacity: 1;
  transition: 0s;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.25);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn.primary {
  background: var(--gradient-1);
  border: none;
  color: #fff;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.btn.primary:hover {
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.5);
  animation: pulse 1s infinite;
}

.btn.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  animation: none;
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
}

.btn.ghost:hover {
  background: rgba(79, 70, 229, 0.1);
  border-color: var(--indigo);
}

.btn.sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-big {
  padding: 16px 32px;
  font-size: 16px;
  border-radius: 14px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
}

/* ── Home Page ── */
.home-main, .upload-main {
  width: min(1000px, 92vw);
  margin: 0 auto;
  flex: 1;
  padding: 40px 0 60px;
}

.hero {
  text-align: center;
  padding: 60px 20px;
  background: var(--gradient-1);
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
  border-radius: 24px;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
}

.hero h1 {
  font-size: clamp(28px, 5vw, 42px);
  margin: 0 0 16px;
  line-height: 1.2;
  color: #fff;
  font-weight: 800;
  letter-spacing: -1px;
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.8s ease;
}

.hero-sub {
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  margin: 0 auto 30px;
  max-width: 50ch;
  line-height: 1.6;
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.8s ease 0.2s both;
}

.hero .btn {
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.8s ease 0.4s both;
}

/* ── QR Card ── */
.qr-card {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  align-items: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 32px;
  animation: fadeInUp 0.8s ease 0.3s both;
  transition: var(--transition);
}

@supports (backdrop-filter: blur(20px)) {
  .qr-card {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
}

.qr-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 30px 80px rgba(79, 70, 229, 0.2);
}

.qr-wrap {
  position: relative;
}

.qr-wrap img {
  border-radius: 16px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  display: block;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  will-change: transform;
}

@media (hover: hover) {
  .qr-wrap img {
    transition: var(--transition);
    transform: rotateY(-5deg) rotateX(5deg);
  }

  .qr-wrap:hover img {
    transform: rotateY(0deg) rotateX(0deg);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2);
  }
}

.qr-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}

.qr-info {
  flex: 1 1 280px;
}

.qr-info h2 {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 700;
}

.qr-caption {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.6;
}

.qr-caption b {
  color: var(--indigo);
  font-size: 16px;
  font-weight: 700;
}

.muted { color: var(--muted); }

.qr-info .btn {
  margin-right: 10px;
  margin-bottom: 10px;
}

/* ── Steps ── */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.step {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 20px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: var(--transition);
  animation: fadeInUp 0.6s ease calc(var(--i, 0) * 0.1s) both;
}

@supports (backdrop-filter: blur(10px)) {
  .step {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}

.step:nth-child(1) { --i: 1; }
.step:nth-child(2) { --i: 2; }
.step:nth-child(3) { --i: 3; }
.step:nth-child(4) { --i: 4; }

.step:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: var(--shadow-lg);
  background: var(--card);
}

.step b {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.footnote {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  animation: fadeIn 1s ease 0.5s both;
}

/* ── Upload Page ── */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

@supports (backdrop-filter: blur(20px)) {
  .card {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
}

.dropcard {
  max-width: 680px;
  margin: 30px auto;
  animation: scaleIn 0.5s ease;
}

.drop-inner {
  padding: 50px 30px;
  text-align: center;
}

.drop-icon {
  font-size: 72px;
  line-height: 1;
  margin-bottom: 16px;
  animation: bounce 2s ease-in-out infinite;
  display: inline-block;
}

.drop-hint {
  color: var(--muted);
  margin: 8px 0 30px;
  font-size: 15px;
  line-height: 1.7;
}

.dropcard.dragover {
  outline: 3px dashed var(--indigo);
  outline-offset: -8px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  transform: scale(1.02);
  box-shadow: 0 20px 50px rgba(79, 70, 229, 0.3);
}

/* GPU acceleration for animations */
.file-icon,
.hero,
.step,
.qr-card,
.sheet,
.dropcard {
  will-change: transform;
}

.fileinput { display: none; }

.fileselect-name {
  min-height: 24px;
  color: var(--indigo);
  font-weight: 700;
  font-size: 15px;
  margin: 12px 0 0;
  animation: fadeInUp 0.3s ease;
}

.drop-note {
  color: var(--muted);
  font-size: 13px;
  margin-top: 24px;
}

/* ── File Type Icons ── */
.file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 16px;
  margin-bottom: 16px;
  font-size: 28px;
  animation: float 3s ease-in-out infinite;
}

.file-icon.pdf {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #dc2626;
}

.file-icon.image {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #2563eb;
}

.file-icon.text {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  color: #059669;
}

.file-icon.default {
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  color: #4f46e5;
}

/* ── Upload Progress ── */
.upload-progress {
  width: 100%;
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 20px;
  display: none;
}

.upload-progress.active {
  display: block;
}

.upload-progress-bar {
  height: 100%;
  background: var(--gradient-1);
  border-radius: 3px;
  animation: shimmer 1.5s infinite;
  background-size: 200% 100%;
}

/* ── Success Animation ── */
.upload-success {
  display: none;
  text-align: center;
  padding: 30px;
  animation: scaleIn 0.5s ease;
}

.upload-success.active {
  display: block;
}

.success-checkmark {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: scaleIn 0.5s ease 0.2s both;
}

.success-checkmark svg {
  width: 40px;
  height: 40px;
  stroke: #059669;
  stroke-width: 3;
  fill: none;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: checkmark 0.5s ease 0.5s forwards;
}

/* ── Loading / Spinner ── */
.busy { margin-top: 20px; }

.busy.htmx-indicator { opacity: 0; display: none; }

.htmx-request .busy.htmx-indicator { display: block; }

.busy p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--line);
  border-top-color: var(--indigo);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 0.8s linear infinite;
}

/* ── Error ── */
.err {
  margin: 20px 0 0;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border: 1px solid #fecaca;
  color: var(--err);
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.6;
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ── Preview Page ── */
.preview-main {
  flex: 1;
  width: min(1200px, 96vw);
  margin: 0 auto;
  padding: 24px 0 50px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 18px 22px;
  margin-bottom: 24px;
  position: sticky;
  top: 70px;
  z-index: 50;
  animation: fadeInDown 0.5s ease;
}

@supports (backdrop-filter: blur(20px)) {
  .toolbar {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
}

.ctl {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ctl label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.zoomctl { flex: 1 1 240px; }

.toolbar select {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.toolbar select:hover {
  border-color: var(--indigo);
}

.toolbar select:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.toolbar input[type=range] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  outline: none;
  -webkit-appearance: none;
  margin: 8px 0 0;
}

.toolbar input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gradient-1);
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.4);
  transition: var(--transition);
}

.toolbar input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 6px 15px rgba(79, 70, 229, 0.5);
}

#zoomval {
  color: var(--indigo);
  font-weight: 700;
}

.ctlactions {
  margin-left: auto;
}

/* ── Paper Sheet (3D Effect) ── */
.paper-out {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 400px;
}

@supports (perspective: 1500px) {
  .paper-out {
    perspective: 1500px;
  }
}

.stage-placeholder {
  color: var(--muted);
  padding: 80px 0;
  font-size: 16px;
  animation: fadeIn 0.5s ease;
}

.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  margin-bottom: 16px;
  flex-wrap: wrap;
  animation: fadeInUp 0.5s ease;
}

.name { margin: 0; font-size: 18px; }

.fname {
  margin: 0;
  font-size: 18px;
  word-break: break-all;
  font-weight: 700;
}

.fmeta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.stage {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sheet {
  position: relative;
  width: min(var(--sw), 100%);
  background: var(--paper);
  border: 1px solid #d7dbe6;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.02),
    0 8px 16px rgba(0, 0, 0, 0.04),
    0 24px 48px rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  animation: scaleIn 0.5s ease 0.2s both;
  will-change: transform;
}

@supports (transform-style: preserve-3d) {
  .sheet {
    transform-style: preserve-3d;
    transform: rotateX(2deg) rotateY(-1deg);
  }
}

@media (hover: hover) {
  .sheet:hover {
    transform: rotateX(0deg) rotateY(0deg) scale(1.02);
    box-shadow:
      0 4px 8px rgba(0, 0, 0, 0.04),
      0 16px 32px rgba(0, 0, 0, 0.08),
      0 48px 96px rgba(0, 0, 0, 0.12);
  }
}

.sheet::before {
  content: "";
  display: block;
  padding-top: calc(var(--sh) / var(--sw) * 100%);
}

.clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.art {
  position: absolute;
  inset: 0;
  transform: scale(var(--zoom));
  transform-origin: top left;
  transition: transform 0.3s ease;
}

.pg-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pg-frame {
  width: 100%;
  height: 100%;
  border: 0;
}

.pg-text {
  margin: 0;
  padding: 16px;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  background: #fff;
}

.pg-unavail {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

/* ── Print Status ── */
.print-status {
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  display: none;
  animation: fadeInUp 0.3s ease;
}

.print-status.ok {
  display: block;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #bbf7d0;
  color: #166534;
}

.print-status.fail {
  display: block;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border: 1px solid #fecaca;
  color: #991b1b;
}

.print-status.pending {
  display: block;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.print-status .spinner-sm {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid #93c5fd;
  border-top-color: #1e40af;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 10px;
}

/* ── Printer Info ── */
.printer-info {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--muted);
  display: none;
  animation: fadeInUp 0.3s ease;
}

@supports (backdrop-filter: blur(10px)) {
  .printer-info {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}

.printer-info strong {
  color: var(--ink);
}

.printer-info .printer-list {
  margin: 4px 0 0;
  font-weight: 600;
  color: var(--indigo);
}

/* ── Batch Upload ── */
.batch-zone {
  margin-top: 20px;
  padding: 20px;
  border: 2px dashed var(--line);
  border-radius: 16px;
  text-align: center;
  transition: var(--transition);
}

.batch-zone:hover {
  border-color: var(--indigo);
  background: rgba(79, 70, 229, 0.05);
}

.batch-zone.dragover {
  border-color: var(--indigo);
  background: rgba(79, 70, 229, 0.1);
}

.file-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  animation: fadeInUp 0.3s ease;
  transition: var(--transition);
}

.file-item:hover {
  border-color: var(--indigo);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.file-item-icon {
  font-size: 24px;
}

.file-item-name {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
  word-break: break-all;
}

.file-item-size {
  color: var(--muted);
  font-size: 13px;
}

.file-item-status {
  font-size: 18px;
}

.file-item-remove {
  background: none;
  border: none;
  color: var(--err);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  border-radius: 6px;
  transition: var(--transition);
}

.file-item-remove:hover {
  background: rgba(220, 38, 38, 0.1);
}

/* ── Batch Actions ── */
.batch-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: center;
}

/* ── Print ── */
@page { size: A4; margin: 0; }

/* ── Upload Animation ── */
.upload-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.upload-modal {
  background: var(--card);
  border-radius: 24px;
  padding: 40px 50px;
  text-align: center;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
  animation: scaleIn 0.4s ease;
  max-width: 400px;
  width: 90%;
}

.upload-modal .upload-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  position: relative;
}

.upload-modal .upload-icon .file-fly {
  font-size: 48px;
  animation: fileFlyUp 1.5s ease-in-out infinite;
}

@keyframes fileFlyUp {
  0%, 100% { transform: translateY(0) scale(1); opacity: 1; }
  50% { transform: translateY(-15px) scale(1.1); opacity: 0.8; }
}

.upload-modal .upload-icon .arrow-up {
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 24px;
  color: var(--indigo);
  animation: arrowBounce 1s ease-in-out infinite;
}

@keyframes arrowBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-8px); }
}

.upload-modal h3 {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.upload-modal p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.upload-modal .progress-ring {
  width: 60px;
  height: 60px;
  margin: 0 auto;
}

.upload-modal .progress-ring circle {
  transition: stroke-dashoffset 0.3s ease;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

/* ── Printing Animation ── */
.printing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.printing-modal {
  background: var(--card);
  border-radius: 24px;
  padding: 40px 50px;
  text-align: center;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
  animation: scaleIn 0.4s ease;
  max-width: 400px;
  width: 90%;
}

.printer-anim {
  width: 120px;
  height: 100px;
  margin: 0 auto 24px;
  position: relative;
}

.printer-body {
  width: 100px;
  height: 60px;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  border-radius: 8px;
  position: absolute;
  bottom: 0;
  left: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.printer-body::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 6px;
  background: #16a34a;
  border-radius: 3px;
  animation: printerBlink 1.5s ease-in-out infinite;
}

@keyframes printerBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.printer-tray {
  width: 70px;
  height: 8px;
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
  border-radius: 2px;
  position: absolute;
  bottom: -4px;
  left: 25px;
}

.paper-out-anim {
  width: 60px;
  height: 45px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  position: absolute;
  top: 10px;
  left: 30px;
  animation: paperSlideOut 2s ease-in-out infinite;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.paper-out-anim::after {
  content: '';
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  height: 3px;
  background: #e5e7eb;
  border-radius: 2px;
  box-shadow: 0 8px 0 #e5e7eb, 0 16px 0 #e5e7eb;
}

@keyframes paperSlideOut {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  50% { transform: translateY(-40px) rotate(-2deg); opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-50px) rotate(-2deg); opacity: 0; }
}

.printing-modal h3 {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.printing-modal p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.printing-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 4px;
}

.printing-dots span {
  width: 6px;
  height: 6px;
  background: var(--indigo);
  border-radius: 50%;
  animation: dotPulse 1.4s ease-in-out infinite;
}

.printing-dots span:nth-child(2) { animation-delay: 0.2s; }
.printing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── Success Checkmark Large ── */
.success-large {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: scaleIn 0.5s ease;
}

.success-large svg {
  width: 40px;
  height: 40px;
  stroke: #059669;
  stroke-width: 3;
  fill: none;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: checkmark 0.6s ease 0.3s forwards;
}

@media print {
  body { background: #fff !important; }
  .no-print, .toolbar, .topbar { display: none !important; }
  .preview-main { width: 100%; padding: 0; margin: 0; }
  .sheet {
    width: var(--sw) !important;
    max-width: none;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    page-break-after: avoid;
    transform: none;
  }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .topbar {
    padding: 12px 16px;
  }
  
  .brand {
    font-size: 16px;
  }
  
  .hero {
    padding: 40px 16px;
    border-radius: 16px;
  }
  
  .hero h1 {
    font-size: 24px;
  }
  
  .qr-card {
    padding: 20px;
    border-radius: 16px;
  }
  
  .toolbar {
    padding: 14px 16px;
    border-radius: 14px;
  }
  
  .btn-big {
    padding: 14px 24px;
    font-size: 15px;
  }

  /* Disable heavy 3D effects on mobile */
  .sheet {
    transform: none !important;
  }

  .qr-wrap img {
    transform: none !important;
  }

  /* Reduce animation complexity on mobile */
  .hero {
    animation: fadeIn 0.5s ease;
  }

  .step {
    animation: fadeIn 0.4s ease calc(var(--i, 0) * 0.05s) both;
  }
}
