:root {
  --primary: #2E7D32;
  --primary-light: #4CAF50;
  --primary-dark: #1B5E20;
  --accent1: #FF8F00;
  --accent1-light: #FFB300;
  --accent2: #7CB342;
  --neutral: #3E2723;
  --neutral-light: #6D4C41;
  --bg: #FFFDF7;
  --bg-sec: #F5F5F5;
  --surface: #FFFFFF;
  --text: #1A1A1A;
  --text-sec: #6B7280;
  --text-tri: #9CA3AF;
  --border: rgba(0,0,0,0.06);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.06);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --font: 'Inter', system-ui, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --nav-h: 56px;
  --bnav-h: 68px;
}

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

html { font-size: 16px; -webkit-tap-highlight-color: transparent; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  letter-spacing: -0.011em;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-top: var(--nav-h);
  padding-bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom, 0px));
}

img { max-width: 100%; display: block; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font); font-size: 16px; }
a { text-decoration: none; color: inherit; }

/* TOP BAR */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h); display: flex; align-items: center;
  padding: 0 16px; gap: 12px;
  background: rgba(255,253,247,0.8);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-weight: 600; font-size: 18px; letter-spacing: -0.025em; color: var(--primary-dark); flex: 1; }
.topbar-btn { width: 40px; height: 40px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
.topbar-btn:hover { background: rgba(0,0,0,0.05); }

/* BOTTOM NAV */
.bnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: var(--bnav-h); display: flex; align-items: center; justify-content: space-around;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bnav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10px; font-weight: 500; color: var(--text-sec);
  padding: 6px 12px; border-radius: var(--radius-md);
  transition: all 0.25s var(--ease); position: relative;
}
.bnav-item.active { color: var(--primary); }
.bnav-item.active::before {
  content: ''; position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px; border-radius: 2px; background: var(--primary);
}
.bnav-item svg { width: 22px; height: 22px; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: 15px; letter-spacing: -0.01em;
  border-radius: var(--radius-md); padding: 12px 24px;
  transition: all 0.25s var(--ease); position: relative; overflow: hidden;
}
.btn-primary {
  background: var(--primary); color: white;
  box-shadow: 0 2px 8px rgba(46,125,50,0.3);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(46,125,50,0.35); }
.btn-primary:active { transform: translateY(0) scale(0.98); }

.btn-accent {
  background: var(--accent1); color: white;
  box-shadow: 0 2px 8px rgba(255,143,0,0.3);
}
.btn-accent:hover { transform: translateY(-1px); }

.btn-outline {
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: rgba(46,125,50,0.04); }

.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: var(--radius-full); }

/* CARDS */
.card {
  background: var(--surface); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card); overflow: hidden;
  transition: all 0.3s var(--ease);
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card:active { transform: translateY(0) scale(0.98); }
.card-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: linear-gradient(135deg, #e8f5e9, #c8e6c9); }
.card-body { padding: 16px; }
.card-title { font-weight: 600; font-size: 15px; letter-spacing: -0.02em; margin-bottom: 4px; }
.card-desc { font-size: 13px; color: var(--text-sec); line-height: 1.4; }
.card-price { font-weight: 700; font-size: 16px; color: var(--primary); margin-top: 8px; }

/* BADGE */
.badge {
  display: inline-flex; align-items: center; padding: 4px 10px;
  font-size: 11px; font-weight: 600; border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}
.badge-accent { background: rgba(124,179,66,0.15); color: #558B2F; }
.badge-warn { background: rgba(255,143,0,0.12); color: #E65100; }
.badge-new { background: rgba(46,125,50,0.1); color: var(--primary); }

/* FORM */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-sec); margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 12px 16px;
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s; outline: none;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46,125,50,0.1); }
.form-input::placeholder { color: var(--text-tri); }
textarea.form-input { resize: vertical; min-height: 80px; }

/* DRAWER */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 201;
  background: var(--surface); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  max-height: 85vh; overflow-y: auto;
  transform: translateY(100%); transition: transform 0.4s var(--ease);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
}
.drawer.open { transform: translateY(0); }
.drawer-handle {
  width: 36px; height: 4px; background: var(--text-tri); border-radius: 2px;
  margin: 10px auto 0; display: block;
}
.drawer-content { padding: 20px; }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 300;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface); border-radius: var(--radius-xl);
  width: 100%; max-width: 420px; max-height: 80vh; overflow-y: auto;
  padding: 24px; box-shadow: var(--shadow-lg);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.35s var(--spring);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-title { font-weight: 700; font-size: 20px; letter-spacing: -0.025em; margin-bottom: 8px; }

/* FAB */
.fab-wa {
  position: fixed; bottom: calc(var(--bnav-h) + 16px + env(safe-area-inset-bottom, 0px));
  right: 16px; z-index: 150; width: 56px; height: 56px;
  background: #25D366; color: white; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(37,211,102,0.4);
  transition: transform 0.25s var(--spring);
  animation: fabPulse 3s ease-in-out infinite;
}
.fab-wa:hover { transform: scale(1.1); }
.fab-wa svg { width: 28px; height: 28px; }

/* HERO */
.hero {
  padding: 32px 20px 40px; text-align: center;
  background: linear-gradient(180deg, rgba(46,125,50,0.06) 0%, transparent 100%);
}
.hero-logo { width: 72px; height: 72px; margin: 0 auto 16px; border-radius: var(--radius-xl); background: var(--primary); display: flex; align-items: center; justify-content: center; color: white; font-size: 28px; font-weight: 700; box-shadow: 0 4px 20px rgba(46,125,50,0.3); }
.hero h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; color: var(--neutral); }
.hero-loc { font-size: 14px; color: var(--text-sec); margin-top: 4px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.hero-tag { font-size: 15px; color: var(--text-sec); margin-top: 8px; font-style: italic; }
.hero-actions { display: flex; gap: 12px; margin-top: 24px; justify-content: center; flex-wrap: wrap; }

/* SECTION */
.section { padding: 24px 16px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-size: 20px; font-weight: 700; letter-spacing: -0.025em; }
.section-link { font-size: 13px; font-weight: 600; color: var(--primary); }

/* HORIZONTAL SCROLL */
.hscroll { display: flex; gap: 12px; overflow-x: auto; padding: 4px 16px 16px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex-shrink: 0; }

/* PLANT GRID */
.plant-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 0 16px; }

/* SEARCH */
.search-wrap { padding: 0 16px 12px; position: sticky; top: var(--nav-h); z-index: 10; background: var(--bg); }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-full); padding: 10px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46,125,50,0.08); }
.search-box input { flex: 1; border: none; outline: none; background: none; font-size: 15px; color: var(--text); }
.search-box svg { width: 18px; height: 18px; color: var(--text-tri); flex-shrink: 0; }

/* CATEGORY TABS */
.cat-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 8px 16px 16px; scrollbar-width: none; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  padding: 8px 16px; border-radius: var(--radius-full); font-size: 13px; font-weight: 500;
  white-space: nowrap; border: 1.5px solid var(--border); color: var(--text-sec);
  background: var(--surface); transition: all 0.2s;
}
.cat-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

/* STARS */
.stars { display: flex; gap: 2px; }
.star { color: #E0E0E0; cursor: pointer; transition: color 0.15s, transform 0.15s; }
.star.filled { color: #FFC107; }
.star:hover { transform: scale(1.2); }

/* GALLERY GRID */
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 0 16px; }
.gallery-item { aspect-ratio: 1; overflow: hidden; border-radius: var(--radius-sm); cursor: pointer; position: relative; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.gallery-item:hover img { transform: scale(1.05); }

/* LIGHTBOX */
.lightbox {
  position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,0.95);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img { max-width: 95vw; max-height: 85vh; object-fit: contain; border-radius: var(--radius-md); }
.lightbox-close { position: absolute; top: 16px; right: 16px; color: white; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.15); border-radius: var(--radius-full); }

/* CALENDAR/TIMESLOTS */
.time-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.time-slot {
  padding: 10px; text-align: center; border: 1.5px solid var(--border);
  border-radius: var(--radius-md); font-size: 13px; font-weight: 500;
  transition: all 0.2s; cursor: pointer; background: var(--surface);
}
.time-slot:hover { border-color: var(--primary); }
.time-slot.active { background: var(--primary); color: white; border-color: var(--primary); }
.time-slot.disabled { opacity: 0.4; pointer-events: none; }

/* BOOKING STEPS */
.steps { display: flex; gap: 0; margin-bottom: 24px; padding: 0 16px; }
.step-dot {
  width: 28px; height: 28px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  background: var(--border); color: var(--text-sec); transition: all 0.3s;
}
.step-dot.active { background: var(--primary); color: white; }
.step-dot.done { background: var(--accent2); color: white; }
.step-line { flex: 1; height: 2px; background: var(--border); align-self: center; }
.step-line.done { background: var(--accent2); }

/* REVIEW CARD */
.review-card { padding: 16px; border-bottom: 1px solid var(--border); }
.review-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.review-avatar { width: 36px; height: 36px; border-radius: var(--radius-full); background: linear-gradient(135deg, var(--primary-light), var(--accent2)); display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 14px; }
.review-name { font-weight: 600; font-size: 14px; }
.review-date { font-size: 12px; color: var(--text-tri); }
.review-text { font-size: 14px; line-height: 1.5; color: var(--text-sec); }

/* CART BAR */
.cart-bar {
  position: fixed; bottom: var(--bnav-h); left: 0; right: 0; z-index: 90;
  background: var(--primary); color: white; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
  transform: translateY(100%); transition: transform 0.35s var(--ease);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.cart-bar.show { transform: translateY(0); }
.cart-count { font-weight: 700; font-size: 15px; }
.cart-total { font-weight: 600; font-size: 14px; opacity: 0.9; }

/* ADMIN */
.admin-card { background: var(--surface); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-sm); margin-bottom: 12px; }
.admin-stat { text-align: center; padding: 16px; }
.admin-stat-num { font-size: 28px; font-weight: 700; color: var(--primary); }
.admin-stat-label { font-size: 12px; color: var(--text-sec); margin-top: 2px; }
.admin-list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.admin-actions { display: flex; gap: 8px; margin-left: auto; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state svg { width: 64px; height: 64px; color: var(--text-tri); margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--text-sec); }

/* TOAST */
.toast-container { position: fixed; top: calc(var(--nav-h) + 8px); left: 16px; right: 16px; z-index: 500; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: var(--neutral); color: white; padding: 12px 16px;
  border-radius: var(--radius-md); font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg); pointer-events: auto;
  animation: toastIn 0.35s var(--spring);
}
.toast-success { background: var(--primary); }
.toast-error { background: #D32F2F; }

/* SKELETON */
.skeleton { background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-md); }

/* PLANT PLACEHOLDER */
.plant-placeholder {
  width: 100%; aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  font-size: 40px;
}

/* FOOTER */
.footer { padding: 24px 16px; text-align: center; border-top: 1px solid var(--border); margin-top: 24px; }
.footer-text { font-size: 12px; color: var(--text-tri); }

/* QUANTITY SELECTOR */
.qty-selector { display: flex; align-items: center; gap: 0; border: 1.5px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.qty-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; color: var(--primary); transition: background 0.15s; }
.qty-btn:hover { background: rgba(46,125,50,0.08); }
.qty-val { width: 40px; text-align: center; font-weight: 600; font-size: 15px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }

/* PIN SCREEN */
.pin-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; padding: 24px; }
.pin-dots { display: flex; gap: 12px; margin: 24px 0; }
.pin-dot { width: 14px; height: 14px; border-radius: var(--radius-full); border: 2px solid var(--border); transition: all 0.2s; }
.pin-dot.filled { background: var(--primary); border-color: var(--primary); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 280px; }
.pin-key { width: 64px; height: 64px; border-radius: var(--radius-full); font-size: 24px; font-weight: 500; display: flex; align-items: center; justify-content: center; background: var(--surface); box-shadow: var(--shadow-sm); transition: all 0.15s; }
.pin-key:active { transform: scale(0.92); background: rgba(46,125,50,0.08); }

/* IMAGE UPLOAD */
.img-upload {
  width: 100%; aspect-ratio: 4/3; border: 2px dashed var(--border);
  border-radius: var(--radius-lg); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; transition: border-color 0.2s, background 0.2s;
  color: var(--text-tri); font-size: 14px;
}
.img-upload:hover { border-color: var(--primary); background: rgba(46,125,50,0.03); }
.img-upload svg { width: 32px; height: 32px; }
.img-upload img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }

/* UPLOAD PROGRESS BAR */
.upload-progress-track {
  width: 100%; height: 6px; background: var(--border);
  border-radius: 3px; overflow: hidden;
}
.upload-progress-bar {
  height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), var(--accent2));
  border-radius: 3px; transition: width 0.3s ease;
}

/* ANIMATIONS */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes fabPulse { 0%, 100% { box-shadow: 0 4px 16px rgba(37,211,102,0.4); } 50% { box-shadow: 0 4px 24px rgba(37,211,102,0.6); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

.fade-in { animation: fadeIn 0.4s ease; }
.slide-up { animation: slideUp 0.5s var(--ease); }

/* PAGE TRANSITION */
#app { min-height: calc(100vh - var(--nav-h) - var(--bnav-h)); animation: fadeIn 0.3s ease; }

/* RESPONSIVE */
@media (min-width: 640px) {
  .plant-grid { grid-template-columns: repeat(3, 1fr); }
  .gallery-grid { grid-template-columns: repeat(4, 1fr); }
  .time-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1024px) {
  body { max-width: 480px; margin: 0 auto; box-shadow: var(--shadow-lg); min-height: 100vh; }
  .topbar, .bnav { max-width: 480px; left: 50%; transform: translateX(-50%); }
  .fab-wa { right: calc(50% - 220px); }
  .cart-bar { max-width: 480px; left: 50%; transform: translateX(-50%); }
  .cart-bar.show { transform: translateX(-50%) translateY(0); }
  .modal-overlay { max-width: 480px; left: 50%; transform: translateX(-50%); }
}

/* ===== PRINT STYLES ===== */
@media print {
  /* Hide all app UI */
  body {
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    max-width: 100% !important;
    box-shadow: none !important;
  }
  .topbar, .bnav, .cart-bar, .fab-wa, .toast-container,
  .drawer, .drawer-overlay, .lightbox,
  .no-print, #bnav, #topbar, #cartBar, #fabWA {
    display: none !important;
  }
  .modal-overlay {
    position: static !important;
    background: transparent !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    padding: 0 !important;
    max-width: 100% !important;
    transform: none !important;
    left: auto !important;
    display: block !important;
  }
  .modal {
    max-width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    box-shadow: none !important;
    padding: 0 !important;
    transform: none !important;
    border-radius: 0 !important;
  }
  .invoice-actions {
    display: none !important;
  }
  #invoiceArea {
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 16px !important;
    margin: 0 !important;
    page-break-inside: avoid;
  }
  #invoiceArea * {
    color: #000 !important;
  }
  #app {
    display: none !important;
  }
}
