/* ============================================================
   StickyPrinter — Global Styles
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --yellow: #ffe066;
  --yellow-dark: #f5c800;
  --blue: #3a86ff;
  --blue-dark: #2563eb;
  --red: #ef4444;
  --green: #22c55e;
  --orange: #f97316;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
  --white: #ffffff;
  --shadow: 0 2px 8px rgba(0,0,0,0.12);
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
}

#app { min-height: 100vh; }

/* ── Loading ─────────────────────────────────────────────── */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 16px;
  color: var(--gray-600);
}
.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Navigation ──────────────────────────────────────────── */
nav {
  background: var(--white);
  border-bottom: 2px solid var(--yellow);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
nav .brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--gray-800);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
nav .brand-icon { font-size: 1.4rem; }
nav .nav-spacer { flex: 1; }
nav a, nav button.nav-link {
  color: var(--gray-600);
  text-decoration: none;
  font-size: 0.9rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  font-family: var(--font);
}
nav a:hover, nav button.nav-link:hover { background: var(--gray-100); color: var(--gray-800); }

/* ── Page container ──────────────────────────────────────── */
.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 16px;
}
.page-wide {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 16px;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: var(--font);
  font-weight: 500;
  transition: filter 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn:hover { filter: brightness(0.93); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--blue); color: var(--white); }
.btn-yellow  { background: var(--yellow); color: var(--gray-800); }
.btn-red     { background: var(--red); color: var(--white); }
.btn-green   { background: var(--green); color: var(--white); }
.btn-orange  { background: var(--orange); color: var(--white); }
.btn-ghost   { background: var(--gray-100); color: var(--gray-600); }
.btn-sm      { padding: 6px 14px; font-size: 0.85rem; }
.btn-lg      { padding: 14px 28px; font-size: 1.05rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-group input, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font);
  transition: border-color 0.15s;
  background: var(--white);
}
.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--blue);
}
.form-group textarea { resize: vertical; min-height: 100px; }

/* ── Headings ─────────────────────────────────────────────── */
h1 { font-size: 1.8rem; margin-bottom: 8px; }
h2 { font-size: 1.4rem; margin-bottom: 8px; }
h3 { font-size: 1.1rem; margin-bottom: 6px; }

/* ── Hero section ─────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 48px 24px;
}
.hero h1 { font-size: 2.4rem; }
.hero p { color: var(--gray-600); margin: 12px 0 32px; font-size: 1.1rem; }

/* ── Sticky note card ─────────────────────────────────────── */
.sticky-card {
  background: var(--yellow);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 3px 3px 8px rgba(0,0,0,0.15);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  min-height: 120px;
  word-break: break-word;
}
.sticky-card:hover { transform: translateY(-3px); box-shadow: 4px 6px 14px rgba(0,0,0,0.18); }
.sticky-card .sticky-status {
  position: absolute;
  top: 8px; right: 10px;
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 20px;
}
.status-draft     { background: var(--gray-200); color: var(--gray-600); }
.status-submitted { background: var(--blue); color: var(--white); }
.status-printed   { background: var(--green); color: var(--white); }

.sticky-card .sticky-body {
  margin-top: 24px;
  font-size: 0.95rem;
  white-space: pre-wrap;
}
.sticky-card .sticky-meta {
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--gray-600);
}

/* ── Sticky grid ─────────────────────────────────────────── */
.sticky-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

/* ── Workshop code badge ─────────────────────────────────── */
.workshop-code {
  display: inline-block;
  font-family: monospace;
  font-size: 1.4rem;
  font-weight: 700;
  background: var(--yellow);
  padding: 8px 18px;
  border-radius: var(--radius);
  letter-spacing: 0.08em;
  border: 2px solid var(--yellow-dark);
}

/* ── Notification toast ──────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}
.toast {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: slide-in 0.25s ease;
  border-left: 4px solid var(--blue);
}
.toast.toast-success { border-left-color: var(--green); }
.toast.toast-warning { border-left-color: var(--orange); }
.toast .toast-title { font-weight: 600; font-size: 0.9rem; }
.toast .toast-body  { font-size: 0.82rem; color: var(--gray-600); }
@keyframes slide-in { from { transform: translateX(120%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Autoprint toggle ────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}
.toggle {
  width: 48px; height: 26px;
  border-radius: 13px;
  background: var(--gray-200);
  position: relative;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}
.toggle.on { background: var(--green); }
.toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--white);
  transition: left 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle.on::after { left: 25px; }

/* ── Canvas editor ───────────────────────────────────────── */
.canvas-container {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
  position: relative;
  touch-action: none;
}
#sticky-canvas {
  display: block;
  cursor: crosshair;
}
.canvas-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
  align-items: center;
}
.canvas-toolbar input[type="color"] {
  width: 36px; height: 36px;
  border: none; border-radius: 4px;
  cursor: pointer; padding: 0;
}
.canvas-toolbar input[type="range"] { width: 80px; }
.tool-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s;
}
.tool-btn.active, .tool-btn:hover { background: var(--yellow); border-color: var(--yellow-dark); }

/* ── Bluetooth print progress ────────────────────────────── */
.ble-progress-box { margin-top: 16px; }
.ble-progress-label { font-size: 0.85rem; color: var(--gray-600); margin-bottom: 6px; }
.ble-progress-track {
  width: 100%;
  height: 10px;
  background: var(--gray-200);
  border-radius: 999px;
  overflow: hidden;
}
.ble-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--green);
  border-radius: 999px;
  transition: width 0.2s ease-out;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.6rem; }
  .page { padding: 16px; }
  .sticky-grid { grid-template-columns: 1fr 1fr; }
}
