/*
Theme Name: PricedPerLb
Theme URI: https://example.com/pricedperlb
Author: PricedPerLb
Author URI: https://example.com
Description: Mobile-first WordPress theme for comparing local grocery and deli pricing using standardized price-per-pound, per-ounce, and per-unit metrics. Includes Stores, Products and Price Submissions CPTs, REST endpoints under /wp-json/pricedperlb/v1/, a price normalization engine, and a polished mobile shell with bottom nav and floating add button.
Version: 1.0.0
Requires at least: 6.2
Tested up to: 6.6
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: pricedperlb
Tags: mobile-first, custom-post-types, food, grocery, two-columns
*/

/* =========================================================
   Design tokens (mirrors React prototype src/styles.css)
   ========================================================= */
:root {
  --radius: 14px;
  --background: oklch(0.99 0.005 140);
  --foreground: oklch(0.22 0.02 240);
  --card: #ffffff;
  --primary: oklch(0.62 0.17 145);
  --primary-foreground: #ffffff;
  --primary-soft: oklch(0.95 0.05 145);
  --muted: oklch(0.96 0.005 240);
  --muted-foreground: oklch(0.5 0.02 240);
  --accent: oklch(0.95 0.05 145);
  --accent-foreground: oklch(0.35 0.12 145);
  --warning: oklch(0.78 0.15 75);
  --destructive: oklch(0.6 0.22 27);
  --border: oklch(0.92 0.01 240);
  --shadow-card: 0 1px 3px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --shadow-fab: 0 8px 24px -6px color-mix(in oklab, var(--primary) 50%, transparent);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--background); color: var(--foreground); -webkit-font-smoothing: antialiased; }
body { font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; line-height: 1.45; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }

/* App shell */
.ppl-app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--background); position: relative; padding-bottom: 88px; }
@media (min-width: 768px) { .ppl-app { max-width: 720px; } }
@media (min-width: 1024px) { .ppl-app { max-width: 960px; } }

.ppl-header { position: sticky; top: 0; z-index: 30; background: color-mix(in oklab, var(--background) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.ppl-header h1 { font-size: 17px; font-weight: 700; margin: 0; flex: 1; }
.ppl-header .back { width: 32px; height: 32px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); display: inline-flex; align-items: center; justify-content: center; color: var(--foreground); font-size: 16px; }
.ppl-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; color: var(--primary); }
.ppl-brand-dot { width: 22px; height: 22px; border-radius: 8px; background: var(--primary); display: inline-block; box-shadow: var(--shadow-fab); }

.ppl-main { padding: 16px; }

/* Search */
.ppl-search { position: relative; }
.ppl-search input { width: 100%; padding: 12px 16px 12px 40px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s; }
.ppl-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 18%, transparent); }
.ppl-search::before { content: "🔍"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); opacity: .55; font-size: 14px; }

/* Hero */
.ppl-hero { background: linear-gradient(135deg, var(--primary) 0%, color-mix(in oklab, var(--primary) 70%, oklch(0.78 0.15 75)) 100%); color: var(--primary-foreground); border-radius: 20px; padding: 18px 18px 22px; margin-bottom: 18px; box-shadow: var(--shadow-fab); }
.ppl-hero h2 { margin: 0 0 4px; font-size: 22px; line-height: 1.2; }
.ppl-hero p { margin: 0 0 14px; opacity: .9; font-size: 14px; }
.ppl-hero .ppl-search input { background: rgba(255,255,255,.95); }

/* Section */
.ppl-section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 10px; }
.ppl-section-title h3 { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; margin: 0; color: var(--muted-foreground); }
.ppl-section-title a { font-size: 12px; color: var(--primary); font-weight: 600; }

/* Cards */
.ppl-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px; box-shadow: var(--shadow-card); }
.ppl-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

/* Store card */
.ppl-store { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--card); transition: transform .15s, box-shadow .15s; }
.ppl-store:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.ppl-store .ppl-store-emoji { font-size: 24px; }
.ppl-store .ppl-store-name { font-weight: 700; font-size: 14px; line-height: 1.2; }
.ppl-store .ppl-store-meta { font-size: 11px; color: var(--muted-foreground); display: flex; gap: 8px; }
.ppl-store .ppl-tag { display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-foreground); font-weight: 600; align-self: flex-start; text-transform: capitalize; }

/* Price row (comparison) */
.ppl-price-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--card); margin-bottom: 8px; }
.ppl-price-row.is-best { border-color: color-mix(in oklab, var(--primary) 50%, var(--border)); background: var(--primary-soft); }
.ppl-price-row .ppl-store-line { font-weight: 600; font-size: 14px; }
.ppl-price-row .ppl-meta { font-size: 11px; color: var(--muted-foreground); }
.ppl-price-row .ppl-display { font-size: 17px; font-weight: 800; color: var(--foreground); }
.ppl-price-row.is-best .ppl-display { color: var(--primary); }
.ppl-best-badge { display: inline-block; font-size: 9px; font-weight: 800; letter-spacing: .08em; padding: 2px 6px; border-radius: 6px; background: var(--primary); color: var(--primary-foreground); margin-right: 6px; vertical-align: middle; }

/* Product chip / list */
.ppl-trend { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.ppl-trend::-webkit-scrollbar { display: none; }
.ppl-trend-item { flex: 0 0 auto; min-width: 140px; padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); }
.ppl-trend-item .name { font-weight: 700; font-size: 13px; }
.ppl-trend-item .cat { font-size: 11px; color: var(--muted-foreground); }
.ppl-trend-item .price { margin-top: 4px; font-weight: 800; color: var(--primary); }

/* Filters */
.ppl-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; margin: 0 -16px 12px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.ppl-chips::-webkit-scrollbar { display: none; }
.ppl-chip { flex: 0 0 auto; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--muted-foreground); font-size: 12px; font-weight: 500; text-transform: capitalize; }
.ppl-chip.is-active { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }

/* Forms */
.ppl-form label { display: block; font-size: 12px; font-weight: 600; color: var(--muted-foreground); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.ppl-form input, .ppl-form select, .ppl-form textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); font-size: 15px; outline: none; }
.ppl-form input:focus, .ppl-form select:focus, .ppl-form textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 18%, transparent); }
.ppl-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ppl-form .field { margin-bottom: 14px; }
.ppl-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 18px; border-radius: 999px; background: var(--primary); color: var(--primary-foreground); font-weight: 700; border: none; box-shadow: var(--shadow-fab); width: 100%; font-size: 15px; }
.ppl-btn.secondary { background: var(--card); color: var(--foreground); border: 1px solid var(--border); box-shadow: none; }

.ppl-preview { margin-top: 8px; padding: 12px 14px; background: var(--primary-soft); color: var(--accent-foreground); border-radius: 12px; font-weight: 700; }

/* Bottom nav */
.ppl-bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; pointer-events: none; }
.ppl-bottom-inner { max-width: 480px; margin: 0 auto; padding: 0 12px 14px; pointer-events: auto; }
@media (min-width: 768px) { .ppl-bottom-inner { max-width: 720px; } }
@media (min-width: 1024px) { .ppl-bottom-inner { max-width: 960px; } }
.ppl-nav { display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; background: color-mix(in oklab, var(--card) 92%, transparent); backdrop-filter: blur(14px); border: 1px solid var(--border); border-radius: 22px; padding: 8px 6px; box-shadow: var(--shadow-card); }
.ppl-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: var(--muted-foreground); padding: 6px 4px; border-radius: 12px; }
.ppl-nav a.is-active { color: var(--primary); }
.ppl-nav a .ico { font-size: 18px; line-height: 1; }
.ppl-nav .fab-slot { display: flex; align-items: center; justify-content: center; }
.ppl-fab { width: 52px; height: 52px; border-radius: 50%; background: var(--primary); color: var(--primary-foreground); display: inline-flex; align-items: center; justify-content: center; font-size: 26px; box-shadow: var(--shadow-fab); margin-top: -22px; border: 4px solid var(--background); }

/* Hero panel for store detail */
.ppl-store-hero { margin: -16px -16px 0; height: 170px; background: radial-gradient(circle at 30% 50%, var(--primary-soft), transparent 60%), linear-gradient(135deg, var(--muted), var(--card)); position: relative; }
.ppl-store-hero .card { position: absolute; left: 16px; right: 16px; bottom: 12px; background: color-mix(in oklab, var(--card) 95%, transparent); border-radius: 16px; padding: 14px; box-shadow: var(--shadow-card); }
.ppl-store-hero .name { font-weight: 700; }
.ppl-store-hero .addr { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }
.ppl-rating { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }

/* Sparkline */
.ppl-spark { width: 100%; height: 120px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 10px; }

/* Scan demo */
.ppl-scan { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px 16px; }
.ppl-scan .frame { width: 100%; max-width: 320px; aspect-ratio: 4/3; border-radius: 22px; background: linear-gradient(135deg, #0b0b0b, #1f1f1f); position: relative; overflow: hidden; }
.ppl-scan .frame::before { content: ""; position: absolute; inset: 24px; border: 2px solid rgba(255,255,255,.7); border-radius: 16px; }
.ppl-scan .laser { position: absolute; left: 24px; right: 24px; height: 2px; background: var(--primary); animation: ppl-scan 1.6s linear infinite; box-shadow: 0 0 12px var(--primary); }
@keyframes ppl-scan { 0%{ top: 28px } 50%{ top: calc(100% - 28px) } 100%{ top: 28px } }
