/* GroceryBuddy PWA Design System */

/* ============================================================================
   1. CSS CUSTOM PROPERTIES & DESIGN TOKENS
   ============================================================================ */

:root {
  /* Colors */
  --gb-green: #2D7D46;
  --gb-dark: #1A5C30;
  --gb-light: #E8F5E9;
  --gb-orange: #F5821F;
  --gb-white: #FFFFFF;
  --gb-bg: #F7F9F7;
  --gb-text: #1A1A1A;
  --gb-muted: #666666;
  --gb-border: #D5EDD9;
  --gb-error: #D32F2F;
  --gb-warning: #F57C00;
  --gb-success: #388E3C;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  --font-size-h1: 2rem;
  --font-size-h2: 1.5rem;
  --font-size-h3: 1.25rem;
  --font-size-h4: 1.125rem;
  --font-size-body: 1rem;
  --font-size-small: 0.875rem;
  --font-size-caption: 0.75rem;

  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 50px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* Z-index */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-fab: 900;
}

@media (prefers-color-scheme: dark) {
  :root {
    --gb-bg: #0F1419;
    --gb-text: #F5F5F5;
    --gb-muted: #A0A0A0;
    --gb-border: #2D4A35;
  }
}

/* ============================================================================
   2. RESET & NORMALIZE
   ============================================================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-regular);
  line-height: 1.5;
  color: var(--gb-text);
  background-color: var(--gb-bg);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
}

/* Fix safe area on notched devices */
body {
  padding-top: max(env(safe-area-inset-top), 0);
  padding-bottom: max(env(safe-area-inset-bottom), 0);
  padding-left: max(env(safe-area-inset-left), 0);
  padding-right: max(env(safe-area-inset-right), 0);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  margin-bottom: var(--spacing-md);
}

h1 {
  font-size: var(--font-size-h1);
}

h2 {
  font-size: var(--font-size-h2);
}

h3 {
  font-size: var(--font-size-h3);
}

h4 {
  font-size: var(--font-size-h4);
}

p {
  margin-bottom: var(--spacing-md);
}

a {
  color: var(--gb-green);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--gb-dark);
}

button {
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  cursor: pointer;
  border: none;
  background: none;
}

input,
textarea,
select {
  font-family: var(--font-family);
  font-size: var(--font-size-body);
}

input,
textarea {
  width: 100%;
}

img,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ============================================================================
   3. TYPOGRAPHY
   ============================================================================ */

.text-h1 {
  font-size: var(--font-size-h1);
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
}

.text-h2 {
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
}

.text-h3 {
  font-size: var(--font-size-h3);
  font-weight: var(--font-weight-bold);
  line-height: 1.3;
}

.text-h4 {
  font-size: var(--font-size-h4);
  font-weight: var(--font-weight-semibold);
  line-height: 1.3;
}

.text-body {
  font-size: var(--font-size-body);
  line-height: 1.5;
}

.text-small {
  font-size: var(--font-size-small);
  line-height: 1.5;
}

.text-caption {
  font-size: var(--font-size-caption);
  line-height: 1.4;
  color: var(--gb-muted);
}

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

.font-semibold {
  font-weight: var(--font-weight-semibold);
}

.font-bold {
  font-weight: var(--font-weight-bold);
}

/* ============================================================================
   4. BUTTONS
   ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  min-height: 48px;
  padding: var(--spacing-md) var(--spacing-lg);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  cursor: pointer;
  border: none;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

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

.btn-primary {
  background-color: var(--gb-green);
  color: var(--gb-white);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--gb-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

.btn-secondary {
  background-color: transparent;
  color: var(--gb-green);
  border: 2px solid var(--gb-green);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--gb-light);
  border-color: var(--gb-dark);
  color: var(--gb-dark);
}

.btn-orange {
  background-color: var(--gb-orange);
  color: var(--gb-white);
  box-shadow: var(--shadow-sm);
}

.btn-orange:hover:not(:disabled) {
  background-color: #E67E0E;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.btn-orange:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

.btn-ghost {
  background-color: transparent;
  color: var(--gb-text);
  padding: var(--spacing-sm) var(--spacing-md);
}

.btn-ghost:hover:not(:disabled) {
  background-color: rgba(45, 125, 70, 0.08);
  color: var(--gb-dark);
}

.btn-icon {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-sm {
  min-height: 40px;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: var(--font-size-small);
}

.btn-lg {
  min-height: 56px;
  padding: var(--spacing-lg) var(--spacing-xl);
  font-size: var(--font-size-h4);
}

.btn-block {
  width: 100%;
}

/* ============================================================================
   5. FORMS
   ============================================================================ */

.form-group {
  margin-bottom: var(--spacing-lg);
}

label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-weight: var(--font-weight-medium);
  color: var(--gb-text);
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
input[type='tel'],
input[type='date'],
input[type='search'],
textarea,
select {
  width: 100%;
  min-height: 48px;
  padding: var(--spacing-md);
  border: 1.5px solid var(--gb-border);
  border-radius: var(--radius-md);
  background-color: var(--gb-white);
  color: var(--gb-text);
  font-size: var(--font-size-body);
  transition: all var(--transition-base);
}

@media (prefers-color-scheme: dark) {
  input[type='text'],
  input[type='email'],
  input[type='password'],
  input[type='number'],
  input[type='tel'],
  input[type='date'],
  input[type='search'],
  textarea,
  select {
    background-color: #1A1F27;
    border-color: #2D4A35;
  }
}

input[type='text']:focus,
input[type='email']:focus,
input[type='password']:focus,
input[type='number']:focus,
input[type='tel']:focus,
input[type='date']:focus,
input[type='search']:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--gb-green);
  box-shadow: 0 0 0 3px rgba(45, 125, 70, 0.1);
}

/* Prevent iOS zoom on input focus */
input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
input[type='tel'],
input[type='date'],
input[type='search'],
textarea,
select {
  font-size: 16px;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.form-error {
  color: var(--gb-error);
  font-size: var(--font-size-caption);
  margin-top: var(--spacing-xs);
}

input.error,
textarea.error,
select.error {
  border-color: var(--gb-error);
}

input.error:focus,
textarea.error:focus,
select.error:focus {
  box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.form-hint {
  font-size: var(--font-size-small);
  color: var(--gb-muted);
  margin-top: var(--spacing-xs);
}

/* ============================================================================
   6. CARDS
   ============================================================================ */

.card {
  background-color: var(--gb-white);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-base);
  border: 1px solid var(--gb-border);
}

@media (prefers-color-scheme: dark) {
  .card {
    background-color: #1A1F27;
    border-color: #2D4A35;
  }
}

.card-hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.card-header {
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--gb-border);
}

.card-title {
  font-size: var(--font-size-h4);
  font-weight: var(--font-weight-bold);
  margin: 0;
}

.card-subtitle {
  font-size: var(--font-size-small);
  color: var(--gb-muted);
  margin: var(--spacing-xs) 0 0 0;
}

.card-body {
  margin-bottom: var(--spacing-md);
}

.card-footer {
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--gb-border);
  display: flex;
  gap: var(--spacing-md);
}

/* ============================================================================
   7. BADGES & PILLS
   ============================================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-pill);
  background-color: var(--gb-light);
  color: var(--gb-dark);
}

.badge-green {
  background-color: var(--gb-light);
  color: var(--gb-dark);
}

.badge-orange {
  background-color: rgba(245, 130, 31, 0.15);
  color: var(--gb-orange);
}

.badge-gray {
  background-color: #E0E0E0;
  color: var(--gb-muted);
}

.badge-success {
  background-color: rgba(56, 142, 60, 0.15);
  color: var(--gb-success);
}

.badge-error {
  background-color: rgba(211, 47, 47, 0.15);
  color: var(--gb-error);
}

/* ============================================================================
   8. NAVIGATION
   ============================================================================ */

.nav-top {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background-color: var(--gb-white);
  border-bottom: 1px solid var(--gb-border);
  padding: var(--spacing-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  box-shadow: var(--shadow-xs);
}

@media (prefers-color-scheme: dark) {
  .nav-top {
    background-color: #1A1F27;
    border-color: #2D4A35;
  }
}

.nav-top-logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: var(--font-size-h4);
  font-weight: var(--font-weight-bold);
  color: var(--gb-green);
}

.nav-top-actions {
  display: flex;
  gap: var(--spacing-md);
}

.nav-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-fixed);
  background-color: var(--gb-white);
  border-top: 1px solid var(--gb-border);
  padding: var(--spacing-md) 0;
  padding-bottom: max(var(--spacing-md), env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--spacing-xs);
  box-shadow: var(--shadow-lg);
}

@media (prefers-color-scheme: dark) {
  .nav-bottom {
    background-color: #1A1F27;
    border-color: #2D4A35;
  }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm);
  color: var(--gb-muted);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-medium);
  transition: all var(--transition-base);
  min-height: 60px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  border-radius: var(--radius-md);
}

.nav-item:hover,
.nav-item.active {
  color: var(--gb-green);
}

.nav-item.active {
  background-color: var(--gb-light);
}

.nav-icon {
  font-size: 1.5rem;
}

/* ============================================================================
   9. FLOATING ACTION BUTTON
   ============================================================================ */

.fab {
  position: fixed;
  bottom: 80px;
  right: var(--spacing-lg);
  bottom: calc(80px + max(var(--spacing-lg), env(safe-area-inset-bottom)));
  z-index: var(--z-fab);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--gb-orange);
  color: var(--gb-white);
  border: none;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.5rem;
  transition: all var(--transition-base);
}

.fab:hover {
  box-shadow: var(--shadow-xl);
  transform: scale(1.1);
}

.fab:active {
  transform: scale(0.95);
}

/* ============================================================================
   10. LOADING SPINNER
   ============================================================================ */

.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid var(--gb-light);
  border-top-color: var(--gb-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 24px;
  height: 24px;
  border-width: 2px;
}

.spinner-lg {
  width: 56px;
  height: 56px;
  border-width: 5px;
}

.spinner-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

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

/* ============================================================================
   11. TOAST NOTIFICATIONS
   ============================================================================ */

.toast {
  position: fixed;
  bottom: var(--spacing-lg);
  left: var(--spacing-lg);
  right: var(--spacing-lg);
  z-index: var(--z-tooltip);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-lg);
  background-color: var(--gb-text);
  color: var(--gb-white);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
  bottom: max(var(--spacing-lg), env(safe-area-inset-bottom));
}

.toast.success {
  background-color: var(--gb-success);
}

.toast.error {
  background-color: var(--gb-error);
}

.toast.warning {
  background-color: var(--gb-warning);
}

.toast.info {
  background-color: var(--gb-green);
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ============================================================================
   12. MODALS
   ============================================================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-modal-backdrop);
  background-color: rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.2s ease;
}

.modal-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-modal);
  background-color: var(--gb-white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--spacing-lg);
  padding-bottom: max(var(--spacing-lg), env(safe-area-inset-bottom));
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
  -webkit-overflow-scrolling: touch;
}

@media (prefers-color-scheme: dark) {
  .modal-sheet {
    background-color: #1A1F27;
  }
}

.modal-sheet.top {
  top: 0;
  bottom: auto;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding-top: max(var(--spacing-lg), env(safe-area-inset-top));
  animation: slideDown 0.3s ease;
}

.modal-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background-color: var(--gb-border);
  margin: 0 auto var(--spacing-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
}

.modal-title {
  font-size: var(--font-size-h3);
  font-weight: var(--font-weight-bold);
  margin: 0;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--gb-text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.modal-close:hover {
  background-color: var(--gb-light);
  color: var(--gb-dark);
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

/* ============================================================================
   13. PRICE DISPLAY
   ============================================================================ */

.price-big {
  font-size: 2.5rem;
  font-weight: var(--font-weight-bold);
  color: var(--gb-green);
  line-height: 1;
}

.price-tag {
  display: inline-flex;
  align-items: baseline;
  gap: var(--spacing-xs);
}

.price-currency {
  font-size: 0.8em;
  font-weight: var(--font-weight-semibold);
}

.price-amount {
  font-size: 1.8rem;
  font-weight: var(--font-weight-bold);
  color: var(--gb-green);
}

.price-cents {
  font-size: 0.8em;
}

.price-old {
  text-decoration: line-through;
  color: var(--gb-muted);
  font-size: 0.9em;
}

.price-savings {
  color: var(--gb-success);
  font-weight: var(--font-weight-semibold);
}

/* ============================================================================
   14. STORE CHIP
   ============================================================================ */

.store-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background-color: var(--gb-white);
  border: 1px solid var(--gb-border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  cursor: pointer;
}

@media (prefers-color-scheme: dark) {
  .store-chip {
    background-color: #1A1F27;
    border-color: #2D4A35;
  }
}

.store-chip:hover {
  border-color: var(--gb-green);
  box-shadow: var(--shadow-sm);
}

.store-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background-color: var(--gb-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: var(--font-weight-bold);
  color: var(--gb-dark);
  font-size: var(--font-size-small);
}

.store-info {
  flex: 1;
}

.store-name {
  font-weight: var(--font-weight-semibold);
  display: block;
}

.store-distance {
  font-size: var(--font-size-small);
  color: var(--gb-muted);
  display: block;
}

/* ============================================================================
   15. STREAK COUNTER
   ============================================================================ */

.streak-counter {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: linear-gradient(135deg, #FFB84D 0%, #F5821F 100%);
  color: var(--gb-white);
  border-radius: var(--radius-pill);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-h4);
  box-shadow: var(--shadow-md);
}

.streak-emoji {
  font-size: 1.5rem;
}

.streak-number {
  font-variant-numeric: tabular-nums;
}

/* ============================================================================
   16. LEADERBOARD ROW
   ============================================================================ */

.lb-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--gb-border);
  transition: all var(--transition-base);
}

.lb-row:hover {
  background-color: var(--gb-light);
}

.lb-rank {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--gb-green);
  color: var(--gb-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-small);
}

.lb-rank.top {
  font-size: 1.5rem;
}

.lb-user {
  flex: 1;
}

.lb-username {
  font-weight: var(--font-weight-semibold);
  display: block;
}

.lb-subtitle {
  font-size: var(--font-size-small);
  color: var(--gb-muted);
  display: block;
}

.lb-score {
  font-size: var(--font-size-h4);
  font-weight: var(--font-weight-bold);
  color: var(--gb-green);
}

.lb-badge {
  font-size: 1.25rem;
}

/* ============================================================================
   17. UTILITY CLASSES
   ============================================================================ */

.container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

.container-lg {
  max-width: 1200px;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-center {
  align-items: center;
  justify-content: center;
}

.gap-sm {
  gap: var(--spacing-sm);
}

.gap-md {
  gap: var(--spacing-md);
}

.gap-lg {
  gap: var(--spacing-lg);
}

.p-sm {
  padding: var(--spacing-sm);
}

.p-md {
  padding: var(--spacing-md);
}

.p-lg {
  padding: var(--spacing-lg);
}

.mt-sm {
  margin-top: var(--spacing-sm);
}

.mt-md {
  margin-top: var(--spacing-md);
}

.mt-lg {
  margin-top: var(--spacing-lg);
}

.mb-sm {
  margin-bottom: var(--spacing-sm);
}

.mb-md {
  margin-bottom: var(--spacing-md);
}

.mb-lg {
  margin-bottom: var(--spacing-lg);
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.hidden {
  display: none !important;
}

.visible {
  display: block !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================================================
   18. RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 640px) {
  :root {
    --font-size-h1: 1.75rem;
    --font-size-h2: 1.25rem;
  }

  .container {
    padding: 0 var(--spacing-md);
  }

  .btn {
    width: 100%;
  }

  .modal-sheet {
    max-height: 95vh;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .nav-bottom {
    max-width: 500px;
    margin: 0 auto;
  }
}

@media (min-width: 1025px) {
  body {
    display: flex;
  }

  .nav-bottom {
    position: static;
    flex-direction: column;
    width: 200px;
    max-height: 100vh;
    border-left: 1px solid var(--gb-border);
    border-top: none;
    padding: var(--spacing-lg) 0;
  }

  .nav-item {
    justify-content: flex-start;
    padding-left: var(--spacing-lg);
    min-height: auto;
  }

  #app {
    flex: 1;
  }

  .modal-sheet {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    bottom: auto;
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    max-height: 90vh;
    animation: popIn 0.3s ease;
  }

  @keyframes popIn {
    from {
      opacity: 0;
      transform: translate(-50%, -50%) scale(0.9);
    }
    to {
      opacity: 1;
      transform: translate(-50%, -50%) scale(1);
    }
  }
}

/* ============================================================================
   19. FOCUS VISIBLE
   ============================================================================ */

:focus-visible {
  outline: 3px solid var(--gb-green);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--gb-green);
  outline-offset: 2px;
}

/* ============================================================================
   20. PRINT
   ============================================================================ */

@media print {
  .nav-top,
  .nav-bottom,
  .fab,
  .toast {
    display: none;
  }

  body {
    background-color: var(--gb-white);
  }
}

/* ============================================================================
   ADDITIONAL PAGE-SPECIFIC STYLES FOR CORE APP UI
   ============================================================================ */

/* Page Container */
.page { display: none; }
.page.active { display: block; }

/* Main Content Area */
.main-content {
  padding: 1rem;
  padding-bottom: 6rem; /* Space for bottom navbar */
  max-width: 100%;
}

/* Location Section */
.location-section {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  color: white;
}

.location-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: space-between;
}

.location-icon {
  color: rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
}

#location-name {
  font-weight: 500;
  flex: 1;
}

.btn-change-location {
  color: white;
  background: rgba(255, 255, 255, 0.2) !important;
}

/* Search Section */
.search-section {
  margin-bottom: 1.5rem;
  position: relative;
}

.search-form {
  display: flex;
  gap: 0.5rem;
  background: white;
  border-radius: 12px;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.75rem;
  font-size: 1rem;
}

.search-input::placeholder {
  color: var(--color-text-light);
}

.btn-icon-search {
  background: transparent;
  border: none;
  padding: 0.75rem;
  cursor: pointer;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 12px 12px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
}

.search-result-item {
  padding: 1rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.product-info {
  flex: 1;
}

.product-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.product-meta {
  font-size: 0.8rem;
  color: var(--color-text-light);
}

/* Gamification Strip */
.gamification-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.streak-card, .score-card, .badge-preview {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.streak-flame {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.streak-label, .score-label, .badge-label {
  font-size: 0.75rem;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.streak-count, .score-count {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
}

.score-icon, .badge-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.badge-name {
  font-size: 0.85rem;
  color: var(--color-text);
  margin-top: 0.25rem;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.action-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.action-card:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  box-shadow: 0 2px 8px rgba(46, 125, 50, 0.1);
}

.action-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.action-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text);
}

/* Section Headers */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--color-text);
}

/* Price List & Cards */
.price-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.price-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.price-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.product-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-text);
}

.price-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
}

.price-meta {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.store-badge {
  background: var(--color-primary-light);
  color: var(--color-primary);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-weight: 500;
}

.distance-badge {
  background: var(--color-bg-light);
  color: var(--color-text-light);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
}

.price-footer {
  display: flex;
  gap: 0.5rem;
}

.btn-xs {
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
}

/* Map Page */
#map-container {
  margin-bottom: 2rem;
  border: 1px solid var(--color-border);
}

.map-store-list {
  margin-top: 2rem;
}

.map-store-list h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.store-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Search Page */
.search-filters {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 2rem;
  border: 1px solid var(--color-border);
}

.filter-group {
  margin-bottom: 1.5rem;
}

.filter-group:last-child {
  margin-bottom: 0;
}

.filter-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  color: var(--color-text);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-chip {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.filter-chip:hover,
.filter-chip.active {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.slider {
  width: 100%;
  margin-bottom: 0.5rem;
}

.price-display {
  font-size: 0.9rem;
  color: var(--color-text-light);
  text-align: center;
}

.product-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.product-grid .price-card {
  margin-bottom: 0;
}

/* Account Page */
.account-header {
  text-align: center;
  padding: 2rem 1rem;
  background: white;
  border-radius: 12px;
  margin-bottom: 2rem;
  border: 1px solid var(--color-border);
}

.user-avatar {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.account-header h2 {
  margin: 1rem 0 0.5rem;
  color: var(--color-text);
}

.account-header p {
  color: var(--color-text-light);
  margin: 0 0 1.5rem;
}

.user-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.25rem;
}

/* Badges Grid */
.badges-section {
  margin-bottom: 2rem;
}

.badges-section h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--color-text);
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.badge-item {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  transition: all 0.2s;
}

.badge-item.earned {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.badge-emoji {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.badge-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  color: var(--color-text);
}

.badge-desc {
  font-size: 0.75rem;
  color: var(--color-text-light);
  line-height: 1.4;
}

/* Recent Reports */
.recent-reports {
  margin-bottom: 2rem;
}

.recent-reports h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--color-text);
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Account Settings */
.account-settings {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  padding: 1rem;
  margin-bottom: 2rem;
}

.account-settings h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
}

.setting-item:last-child {
  border-bottom: none;
}

.setting-item label {
  font-weight: 500;
  color: var(--color-text);
}

.form-checkbox {
  width: 48px;
  height: 28px;
  cursor: pointer;
}

.form-select {
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.9rem;
  background: white;
  cursor: pointer;
}

/* Modal Styles */
.modal {
  display: none !important;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: flex-end;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 16px 16px 0 0;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1001;
  width: 100%;
  animation: slideUp 0.3s ease-out;
}

.modal-wide {
  max-width: 600px;
  margin: auto;
  border-radius: 16px;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text-light);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-report,
.form-auth {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--color-text);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

/* Leaderboard */
.leaderboard-tabs {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
}

.tab-btn {
  background: none;
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-weight: 500;
  color: var(--color-text-light);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-content {
  padding: 1rem;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.leaderboard-entry {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  transition: all 0.2s;
}

.leaderboard-entry:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.entry-rank {
  font-size: 1.5rem;
  font-weight: 700;
  min-width: 40px;
  text-align: center;
}

.entry-user {
  flex: 1;
}

.entry-name {
  font-weight: 600;
  color: var(--color-text);
}

.entry-city {
  font-size: 0.8rem;
  color: var(--color-text-light);
}

.entry-score {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
  min-width: 60px;
  text-align: right;
}

/* Floating Action Button */
.fab {
  position: fixed;
  bottom: 80px;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-orange);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 111, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: all 0.2s;
  z-index: 100;
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(255, 111, 0, 0.4);
}

.fab:active {
  transform: scale(0.95);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s;
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  border-color: var(--color-success);
  background: var(--color-success-light);
  color: var(--color-success);
}

.toast-error {
  border-color: var(--color-error);
  background: var(--color-error-light);
  color: var(--color-error);
}

.toast-warning {
  border-color: var(--color-warning);
  background: var(--color-warning-light);
  color: var(--color-warning);
}

.toast-info {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* Responsive Design */
@media (max-width: 600px) {
  .user-stats {
    grid-template-columns: 1fr;
  }

  .badges-grid {
    grid-template-columns: 1fr;
  }

  .product-grid {
    grid-template-columns: 1fr;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .gamification-strip {
    grid-template-columns: 1fr;
  }

  .modal-content {
    max-height: 95vh;
  }

  .modal-wide {
    max-width: calc(100vw - 2rem);
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .search-form,
  .location-section,
  .price-card,
  .badge-item,
  .modal-content,
  .account-settings,
  .search-filters,
  .account-header {
    background: var(--color-dark);
    border-color: var(--color-border-dark);
    color: var(--color-text-dark);
  }

  .modal-overlay {
    background: rgba(0, 0, 0, 0.7);
  }

  .search-input,
  .form-group input,
  .form-group select,
  .form-group textarea {
    background: var(--color-dark);
    color: var(--color-text-dark);
    border-color: var(--color-border-dark);
  }

  .search-result-item,
  .setting-item {
    border-color: var(--color-border-dark);
  }
}

