/* ============================================
   PrintFlow — Custom CSS + Tailwind directives
   Compiled via: npx tailwindcss -i styles.css -o tailwind.css --minify
   ============================================ */

@tailwind base;
@tailwind components;
@tailwind utilities;

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Instrument+Serif:ital@0;1&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- Hide Google Translate Bar ---------- */
.goog-te-banner-frame, .skiptranslate, #goog-gt-tt, .goog-te-balloon-frame {
  display: none !important;
}
body { top: 0 !important; }
.goog-text-highlight { background: none !important; box-shadow: none !important; }

/* ---------- CSS Variables ---------- */
:root {
  --background: oklch(0.985 0.002 90);
  --foreground: oklch(0.12 0.01 60);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.12 0.01 60);
  --primary: oklch(0.12 0.01 60);
  --primary-foreground: oklch(0.985 0.002 90);
  --secondary: oklch(0.96 0.005 90);
  --secondary-foreground: oklch(0.12 0.01 60);
  --muted: oklch(0.94 0.005 90);
  --muted-foreground: oklch(0.45 0.02 60);
  --accent: oklch(0.92 0.01 90);
  --accent-foreground: oklch(0.12 0.01 60);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.88 0.01 90);
  --input: oklch(0.92 0.01 90);
  --ring: oklch(0.12 0.01 60);
  --radius: 0.25rem;

  --font-sans: 'Instrument Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-display: 'Instrument Serif', Georgia, serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  overflow-x: hidden;
}

/* ---------- Typography helpers ---------- */
.font-display { font-family: var(--font-display); }
.font-mono    { font-family: var(--font-mono); }
.font-sans    { font-family: var(--font-sans); }

/* ---------- Noise Overlay ---------- */
.noise-overlay { position: relative; }
.noise-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 1;
}

/* ---------- Text Stroke ---------- */
.text-stroke {
  -webkit-text-stroke: 1.5px currentColor;
  -webkit-text-fill-color: transparent;
}

/* ---------- Marquee ---------- */
.marquee { animation: marquee 30s linear infinite; }
.marquee-reverse { animation: marquee-reverse 25s linear infinite; }

@keyframes marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
@keyframes marquee-reverse {
  0%   { transform: translateX(-50%); }
  100% { transform: translateX(0); }
}

/* ---------- Char-in animation (hero rotating words) ---------- */
.animate-char-in {
  animation: char-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  opacity: 0;
  filter: blur(40px);
  transform: translateY(100%);
}
@keyframes char-in {
  0%   { opacity: 0; filter: blur(40px); transform: translateY(100%); }
  100% { opacity: 1; filter: blur(0);    transform: translateY(0); }
}

/* ---------- Hover Lift ---------- */
.hover-lift { transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.hover-lift:hover { transform: translateY(-4px); }

/* ---------- Scroll-reveal (IntersectionObserver) ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

.reveal-left  { opacity: 0; transform: translateX(-32px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal-left.visible { opacity: 1; transform: translateX(0); }

.reveal-right { opacity: 0; transform: translateX(32px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal-right.visible { opacity: 1; transform: translateX(0); }

/* ---------- How-It-Works progress bar ---------- */
@keyframes progress {
  from { width: 0%; }
  to   { width: 100%; }
}
.progress-bar { animation: progress 5s linear forwards; }

/* ---------- Code reveal animations ---------- */
.code-line-reveal {
  opacity: 0;
  transform: translateX(-8px);
  animation: lineReveal 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes lineReveal {
  to { opacity: 1; transform: translateX(0); }
}

.code-char-reveal {
  opacity: 0;
  filter: blur(8px);
  animation: charReveal 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes charReveal {
  to { opacity: 1; filter: blur(0); }
}

/* Dev section code animations */
.dev-code-line {
  opacity: 0;
  transform: translateX(-8px);
  animation: lineReveal 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.dev-code-char {
  opacity: 0;
  filter: blur(8px);
  animation: charReveal 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ---------- Tailwind color overrides (custom properties) ---------- */
/* These map Tailwind's arbitrary-value syntax we use in classes: */
/* bg-foreground, text-background, border-foreground/10, etc. */

/* We use Tailwind CDN play which supports arbitrary values out of the box */

/* ---------- Custom Button Styles ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
  border: none;
  outline: none;
}
.btn:disabled { pointer-events: none; opacity: 0.5; }

.btn-primary {
  background: var(--foreground);
  color: var(--background);
}
.btn-primary:hover { opacity: 0.9; }

.btn-outline {
  background: transparent;
  border: 1px solid;
  border-color: color-mix(in oklch, var(--foreground) 20%, transparent);
  color: var(--foreground);
}
.btn-outline:hover {
  background: color-mix(in oklch, var(--foreground) 5%, transparent);
}

.btn-sm  { height: 2rem;   padding: 0 1rem;   font-size: 0.75rem; }
.btn-md  { height: 2.25rem; padding: 0 1rem;  }
.btn-lg  { height: 2.5rem;  padding: 0 1.5rem; }
.btn-xl  { height: 3.5rem;  padding: 0 2rem;   font-size: 1rem; }

.btn-rounded { border-radius: 9999px; }

/* ---------- Responsive clamp for hero ---------- */
.hero-title {
  font-size: clamp(3rem, 12vw, 10rem);
  line-height: 0.9;
  letter-spacing: -0.02em;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in oklch, var(--foreground) 15%, transparent); border-radius: 3px; }

/* ============================================
   DARK MODE
   ============================================ */
html.dark {
  --background: oklch(0.13 0.01 60);
  --foreground: oklch(0.93 0.005 90);
  --card: oklch(0.17 0.01 60);
  --card-foreground: oklch(0.93 0.005 90);
  --primary: oklch(0.93 0.005 90);
  --primary-foreground: oklch(0.13 0.01 60);
  --secondary: oklch(0.19 0.01 60);
  --secondary-foreground: oklch(0.93 0.005 90);
  --muted: oklch(0.22 0.01 60);
  --muted-foreground: oklch(0.60 0.02 60);
  --accent: oklch(0.20 0.01 60);
  --accent-foreground: oklch(0.93 0.005 90);
  --border: oklch(0.26 0.01 60);
  --input: oklch(0.20 0.01 60);
}

html.dark body { background: var(--background); color: var(--foreground); }
html.dark .noise-overlay::after { opacity: 0.02; }

/* ============================================
   PRINTFLOW APP STYLES
   ============================================ */

/* ---------- File Item ---------- */
.pf-file-item {
  border-bottom: 1px solid color-mix(in oklch, var(--foreground) 6%, transparent);
  transition: background 0.15s ease;
}
.pf-file-item:last-child { border-bottom: none; }
.pf-file-item:hover { background: color-mix(in oklch, var(--foreground) 2%, transparent); }
.pf-file-item.pf-drag-over { background: color-mix(in oklch, var(--foreground) 5%, transparent); }
.pf-file-item.pf-status-active { background: color-mix(in oklch, var(--foreground) 4%, transparent); }
.pf-file-item.pf-status-done { opacity: 0.6; }

/* ---------- Status badges ---------- */
.pf-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 500;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.pf-badge-active {
  background: color-mix(in oklch, var(--foreground) 10%, transparent);
  animation: pf-pulse 1.5s ease-in-out infinite;
}
.pf-badge-done {
  background: #dcfce7;
  color: #166534;
}
html.dark .pf-badge-done { background: #14532d; color: #86efac; }

@keyframes pf-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ---------- Toast ---------- */
.pf-toast {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  padding: 0.625rem 1.25rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  max-width: 90vw;
}
.pf-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.pf-toast-success { background: #166534; color: #fff; }
.pf-toast-error { background: #991b1b; color: #fff; }

/* ---------- Workspace Tabs ---------- */
.pf-tab-active {
  background: var(--background);
  color: var(--foreground);
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.06);
}
.pf-tab-inactive {
  background: transparent;
  color: var(--muted-foreground);
}
.pf-tab-inactive:hover {
  color: var(--foreground);
  background: color-mix(in oklch, var(--foreground) 3%, transparent);
}

/* ---------- Drop zone hover ---------- */
#drop-zone.pf-drag-active {
  border-color: var(--foreground) !important;
  background: color-mix(in oklch, var(--foreground) 3%, transparent);
}

/* ============================================
   AUTH MODAL & UI
   ============================================ */

/* Tab styles */
.auth-tab {
  background: transparent;
  color: var(--muted-foreground);
  border: none;
  cursor: pointer;
}
.auth-tab:hover {
  background: color-mix(in oklch, var(--foreground) 5%, transparent);
}
.auth-tab-active {
  background: color-mix(in oklch, var(--foreground) 8%, transparent);
  color: var(--foreground);
}

/* Dark mode error styles */
html.dark #auth-error {
  background: #450a0a;
  color: #fca5a5;
}

/* ---------- Android APK — Native App Feel ---------- */
body.device-android {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
body.device-android input,
body.device-android textarea,
body.device-android [contenteditable] {
  -webkit-user-select: text;
  user-select: text;
}

/* ============================================
   BOTTOM NAVIGATION BAR — Mobile Glass UI
   ============================================ */
.pf-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)) 8px;
  background: color-mix(in oklch, var(--background) 72%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid color-mix(in oklch, var(--foreground) 8%, transparent);
  box-shadow: 0 -4px 24px rgba(0,0,0,.06);
}
html.dark .pf-bottom-nav {
  background: color-mix(in oklch, var(--background) 65%, transparent);
  border-top-color: color-mix(in oklch, var(--foreground) 12%, transparent);
  box-shadow: 0 -4px 24px rgba(0,0,0,.2);
}

/* Nav button */
.pf-bnav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  padding: 6px 4px 4px;
  border: none;
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 200ms cubic-bezier(.4,0,.2,1);
  color: var(--muted-foreground);
  position: relative;
}
.pf-bnav-btn:active {
  transform: scale(0.92);
}

/* Icon */
.pf-bnav-icon {
  width: 22px;
  height: 22px;
  transition: all 200ms cubic-bezier(.4,0,.2,1);
  stroke-width: 1.8;
}

/* Label */
.pf-bnav-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
  transition: all 200ms cubic-bezier(.4,0,.2,1);
}

/* Active state */
.pf-bnav-active {
  color: var(--foreground);
}
.pf-bnav-active .pf-bnav-icon {
  stroke-width: 2.2;
  transform: translateY(-1px);
}
.pf-bnav-active .pf-bnav-label {
  font-weight: 600;
}
.pf-bnav-active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--foreground);
  opacity: 0.7;
  transition: all 200ms cubic-bezier(.4,0,.2,1);
}

/* Badge (print count) */
.pf-bnav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 18px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  background: var(--foreground);
  color: var(--background);
  pointer-events: none;
}
