/**
 * Shawna's Gilded Keep - Gilded Age Aesthetic
 * Elegant, sophisticated design with subtle luxury touches
 */

/* ============================================================================
   CSS CUSTOM PROPERTIES (Brand-aware)
   ============================================================================ */

:root {
  /* Colors - Gilded Age Luxury Palette */
  --color-primary: #1B1B1D;           /* Rich black */
  --color-secondary: #2A2A2D;         /* Charcoal */

  /* Gold Family - REDUCED USAGE */
  --color-accent: #D4AF37;            /* Antique gold - primary accent */
  --color-accent-bright: #FFD700;     /* Bright gold */
  --color-accent-dark: #B8941E;       /* Dark gold */

  /* Victorian Jewel Tones - PRIMARY PALETTE */
  --color-emerald: #2E7D32;           /* Deep emerald green - velvet */
  --color-emerald-dark: #1B5E20;      /* Dark emerald */
  --color-emerald-light: #4CAF50;     /* Light emerald */

  --color-sapphire: #1565C0;          /* Sapphire blue - regal */
  --color-sapphire-dark: #0D47A1;     /* Dark sapphire */
  --color-sapphire-light: #1976D2;    /* Light sapphire */

  --color-amethyst: #6A1B9A;          /* Amethyst purple - luxury */
  --color-amethyst-dark: #4A148C;     /* Dark amethyst */
  --color-amethyst-light: #7B1FA2;    /* Light amethyst */

  --color-teal: #00838F;              /* Peacock teal - Art Nouveau */
  --color-teal-dark: #006064;         /* Dark teal */
  --color-teal-light: #00ACC1;        /* Light teal */

  /* Earth Tones */
  --color-sienna: #A0522D;            /* Burnt sienna - wood/leather */
  --color-sienna-dark: #8B4513;       /* Dark sienna */

  /* Metallic Accents */
  --color-silver: #E5E4E2;            /* Platinum silver */
  --color-bronze: #CD7F32;            /* Bronze metallic */

  /* Backgrounds */
  --color-bg: #F5F0E8;                /* Darker cream for contrast */
  --color-bg-light: #FAF7F2;          /* Light cream */
  --color-bg-ivory: #FFFEF0;          /* Ivory */

  /* Text */
  --color-text: #1B1B1D;              /* Rich black */
  --color-text-muted: #6C6157;        /* Warm gray */

  /* Borders */
  --color-border: #D4AF37;            /* Gold borders */
  --color-border-light: #F5F1E8;      /* Cream borders */

  /* Real Mode colors (same as default now) */
  --color-primary-real: #1B1B1D;
  --color-secondary-real: #2A2A2D;
  --color-accent-real: #D4AF37;
  --color-bg-real: #FAF7F2;
  --color-text-real: #1B1B1D;
  --color-accent-muted-real: #8B7355;
  --color-border-real: #D4AF37;

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

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

  /* Shadows - Jewel tone glows for variety */
  --shadow-sm: 0 1px 2px rgba(212, 175, 55, 0.1), 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(212, 175, 55, 0.15), 0 2px 4px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(212, 175, 55, 0.2), 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(212, 175, 55, 0.25), 0 8px 10px rgba(0, 0, 0, 0.15);
  --shadow-gold: 0 0 20px rgba(212, 175, 55, 0.3), 0 0 40px rgba(212, 175, 55, 0.1);
  --shadow-emerald: 0 4px 12px rgba(46, 125, 50, 0.25), 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-sapphire: 0 4px 12px rgba(21, 101, 192, 0.25), 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-amethyst: 0 4px 12px rgba(106, 27, 154, 0.25), 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-teal: 0 4px 12px rgba(0, 131, 143, 0.25), 0 2px 4px rgba(0, 0, 0, 0.1);

  /* Borders */
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;

  /* Transitions */
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --header-height: 80px;
  --bottom-nav-height: 65px;
  --max-width: 1200px;
}

/* ============================================================================
   RESET & BASE
   ============================================================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* Mobile touch optimizations - emerald glow */
  -webkit-tap-highlight-color: rgba(46, 125, 50, 0.15);
  tap-highlight-color: rgba(46, 125, 50, 0.15);
}

/* Touch action for interactive elements - prevents 300ms delay */
button,
a,
.item-card,
.nav-item,
.chip,
.btn,
.icon-btn,
.fab {
  touch-action: manipulation;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  overflow-x: hidden;
  position: relative;
}

/* Ornate Damask Wallpaper Background - Jewel Tones (MORE PROMINENT) */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  background-color: #F5F0E8;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(212, 175, 55, 0.15) 0%, transparent 45%),
    radial-gradient(circle at 80% 30%, rgba(0, 131, 143, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 40% 70%, rgba(106, 27, 154, 0.10) 0%, transparent 55%),
    radial-gradient(circle at 70% 80%, rgba(46, 125, 50, 0.08) 0%, transparent 50%),
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 2px,
      rgba(212, 175, 55, 0.03) 2px,
      rgba(212, 175, 55, 0.03) 4px
    ),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 3 Q18 15 30 27 Q42 15 30 3 M30 33 Q18 45 30 57 Q42 45 30 33 M3 30 Q15 18 27 30 Q15 42 3 30 M33 30 Q45 18 57 30 Q45 42 33 30' fill='none' stroke='rgba(0,131,143,0.15)' stroke-width='1'/%3E%3Ccircle cx='30' cy='30' r='5' fill='rgba(212,175,55,0.12)'/%3E%3Cpath d='M30 21 L33 27 L30 30 L27 27 Z M30 39 L27 33 L30 30 L33 33 Z M21 30 L27 27 L30 30 L27 33 Z M39 30 L33 33 L30 30 L33 27 Z' fill='rgba(106,27,154,0.14)'/%3E%3C/svg%3E");
  background-size: auto, auto, auto, auto, auto, 60px 60px;
  opacity: 0.8;
}

/* Velvet fabric texture overlay - emerald and teal */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-image:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 1px,
      rgba(46, 125, 50, 0.015) 1px,
      rgba(46, 125, 50, 0.015) 2px
    ),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 1px,
      rgba(0, 131, 143, 0.015) 1px,
      rgba(0, 131, 143, 0.015) 2px
    );
  pointer-events: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

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

/* ============================================================================
   APP LAYOUT
   ============================================================================ */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--bottom-nav-height);
}

.app-main {
  flex: 1;
  padding: var(--space-lg);
  padding-bottom: calc(var(--bottom-nav-height) + var(--space-xl)); /* Clear bottom nav */
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

/* ============================================================================
   HEADER
   ============================================================================ */

.app-header {
  min-height: 140px;
  background-image: url('assets/header-banner.png');
  background-size: cover;
  background-position: left center;
  background-repeat: no-repeat;
  border-bottom: 3px solid var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

/* No longer need starry background - ChatGPT banner includes it all */
.app-header > * {
  position: relative;
  z-index: 1;
}

/* Ornate Victorian Threshold - Bold & Visible */
.app-header::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 0;
  right: 0;
  height: 40px;
  background:
    /* Middle ornate diamond pattern - MUCH BIGGER */
    radial-gradient(circle 15px at 50% 50%, #d4af37 0%, #b8941f 40%, transparent 70%) center / 30px 30px no-repeat,
    radial-gradient(ellipse 80px 12px at 50% 50%, rgba(212, 175, 55, 0.6) 0%, transparent 70%) center / 160px 24px no-repeat,

    /* Left side ornament */
    radial-gradient(circle 12px at 25% 50%, #d4af37 0%, #b8941f 40%, transparent 70%) left 25% center / 24px 24px no-repeat,
    radial-gradient(ellipse 60px 10px at 25% 50%, rgba(212, 175, 55, 0.5) 0%, transparent 70%) left 25% center / 120px 20px no-repeat,

    /* Right side ornament */
    radial-gradient(circle 12px at 75% 50%, #d4af37 0%, #b8941f 40%, transparent 70%) right 25% center / 24px 24px no-repeat,
    radial-gradient(ellipse 60px 10px at 75% 50%, rgba(212, 175, 55, 0.5) 0%, transparent 70%) right 25% center / 120px 20px no-repeat,

    /* Bold main gold bar */
    linear-gradient(
      90deg,
      transparent 0%,
      rgba(212, 175, 55, 0.4) 10%,
      #d4af37 25%,
      #b8941f 50%,
      #d4af37 75%,
      rgba(212, 175, 55, 0.4) 90%,
      transparent 100%
    ) center / 100% 4px no-repeat,

    /* Bottom decorative scalloped edge */
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 15px,
      #b8941f 15px,
      #b8941f 17px,
      transparent 17px,
      transparent 30px
    ) bottom / 100% 3px no-repeat;
  box-shadow:
    0 6px 20px rgba(212, 175, 55, 0.4),
    inset 0 2px 8px rgba(212, 175, 55, 0.2);
  z-index: 101;
}

.header-content {
  flex: 1;
}

.header-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.app-title {
  font-size: 1.75rem;
  color: var(--color-primary);
  margin-bottom: var(--space-xs);
  text-shadow: 1px 1px 2px rgba(212, 175, 55, 0.2);
  letter-spacing: 0.5px;
}

/* Jewel logo no longer needed - included in banner background */

.lunar-calendar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-left: var(--space-md);
  flex: 1;
  max-width: 500px;
}

.current-date {
  font-family: 'Playfair Display', serif;
  font-size: 0.875rem;
  color: #ffd700;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.4);
  margin-bottom: 6px;
  white-space: nowrap;
}

.moon-phases-strip {
  width: 100%;
  height: 65px;
  max-width: 450px;
}

/* Mobile: Give moons more breathing room */
@media (max-width: 768px) {
  .lunar-calendar {
    max-width: 100%;
  }
  .moon-phases-strip {
    height: 55px;
  }
}

/* Header right wrapper - contains refresh button + version badge */
.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.header-right button {
  line-height: 1;
}

.version-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--color-accent);
  background: linear-gradient(135deg, #FAF7F2 0%, #F4E4C1 100%);
  border: 1px solid var(--color-accent);
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.app-tagline {
  font-family: 'Playfair Display', serif;
  margin-top: 0.5rem;
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.tagline-curated {
  font-size: 1.25rem;
  font-weight: 400;
  font-style: italic;
  color: #e8e8e8;
  letter-spacing: 0.5px;
}

.tagline-by {
  font-size: 0.875rem;
  font-weight: 300;
  color: #b8b8b8;
  font-style: italic;
}

.tagline-your {
  font-size: 1.125rem;
  font-weight: 700;
  color: #d4af37;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.6);
}

.tagline-johnny {
  font-size: 1.375rem;
  font-weight: 600;
  color: #f4f1de;
  font-style: italic;
  letter-spacing: 0.5px;
  text-shadow: 0 0 8px rgba(244, 241, 222, 0.3);
}

/* Mobile: Make tagline fit on ONE line */
@media (max-width: 768px) {
  .tagline-curated {
    font-size: 0.875rem;
  }
  .tagline-by {
    font-size: 0.625rem;
  }
  .tagline-your {
    font-size: 0.75rem;
    letter-spacing: 1px;
  }
  .tagline-johnny {
    font-size: 0.95rem;
  }
  .app-tagline {
    gap: 0.25rem;
  }

  /* Smaller version badge on mobile */
  .version-badge {
    font-size: 0.5rem;
  }
}

.header-refresh-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  color: var(--color-accent);
  transition: all var(--transition);
  cursor: pointer;
}

.header-refresh-btn:hover {
  background: rgba(212, 175, 55, 0.1);
  transform: rotate(15deg);
}

.header-refresh-btn:active {
  transform: rotate(180deg);
  transition: transform 0.5s ease;
}

.header-refresh-btn.spinning {
  animation: spin 0.6s ease-in-out;
}

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

/* ============================================================================
   BOTTOM NAVIGATION
   ============================================================================ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: linear-gradient(135deg, #FFFDF7 0%, #FFF9E8 50%, #FFFDF7 100%);
  border-top: 3px solid var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 var(--space-md);
  z-index: 1000;
  box-shadow: 0 -4px 20px rgba(212, 175, 55, 0.15);
}

/* Decorative gold line below nav border */
.bottom-nav::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-accent-bright), transparent);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  color: var(--color-text-muted);
  transition: color var(--transition);
  border-radius: var(--border-radius-sm);
}

.nav-item svg {
  transition: transform var(--transition);
}

.nav-item span {
  font-size: 0.75rem;
  font-weight: 500;
}

.nav-item-active {
  color: var(--color-accent);
  background: rgba(212, 175, 55, 0.1);
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.2);
}

.nav-item-active svg {
  transform: scale(1.1);
  filter: drop-shadow(0 2px 4px rgba(212, 175, 55, 0.3));
}

.nav-item:active svg {
  transform: scale(0.9);
}

/* ============================================================================
   INSPIRATIONAL QUOTES
   ============================================================================ */

.inspiration-card {
  background: linear-gradient(135deg, #FAF7F2 0%, #F4E4C1 100%);
  border: 2px solid var(--color-accent);
  border-radius: var(--border-radius);
  padding: 0.5rem 1rem;
  margin-bottom: 0.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.inspiration-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 10px,
      rgba(212, 175, 55, 0.03) 10px,
      rgba(212, 175, 55, 0.03) 20px
    );
  pointer-events: none;
  z-index: 0;
}

.inspiration-ornament {
  color: var(--color-accent);
  font-size: 1.25rem;
  opacity: 0.7;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.inspiration-text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.125rem;
  line-height: 1.6;
  color: #2C1810;
  margin: var(--space-md) 0;
  position: relative;
  z-index: 1;
  font-weight: 500;
}

/* Fade transition animation */
.inspiration-card.fade-out {
  animation: fadeOut 0.8s ease-in-out;
}

.inspiration-card.fade-in {
  animation: fadeIn 0.8s ease-in-out;
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Pause animation on hover (accessibility) */
.inspiration-card:hover {
  animation-play-state: paused;
}

/* ============================================================================
   SEARCH & FILTERS
   ============================================================================ */

.search-bar {
  position: relative;
  margin-bottom: var(--space-lg);
}

.search-icon {
  position: absolute;
  left: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
}

.search-input {
  width: 100%;
  padding: var(--space-md) var(--space-md) var(--space-md) 3rem;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: white;
  font-size: 1rem;
  transition: all var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(92, 122, 234, 0.1);
}

.filter-chips {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  padding-bottom: var(--space-sm);
  -webkit-overflow-scrolling: touch;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  padding: var(--space-sm) var(--space-lg);
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: white;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  transition: all var(--transition);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chip:hover,
.chip:active {
  border-color: var(--color-accent);
  background: rgba(212, 175, 55, 0.08);
}

.chip-active {
  background: linear-gradient(135deg, var(--color-gold) 0%, #B8860B 100%);
  color: #2C1810;
  border: 2px solid var(--color-gold);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

/* ============================================================================
   STATS SUMMARY
   ============================================================================ */

.stats-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  padding: var(--space-lg);
  border-radius: var(--border-radius);
  text-align: center;
  border: 2px solid var(--color-accent);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #FFFDF7 0%, #FFF9E8 100%);
}

/* Alternating stat card colors - Gold, Emerald, Sapphire */
.stat-card:nth-child(1) {
  border-color: var(--color-accent);
  background: linear-gradient(135deg, #FFFDF7 0%, #FFF9E8 100%);
  box-shadow: var(--shadow-gold);
}

.stat-card:nth-child(2) {
  border-color: var(--color-emerald);
  background: linear-gradient(135deg, #F1F8F4 0%, #E8F5E9 100%);
  box-shadow: var(--shadow-emerald);
}

.stat-card:nth-child(3) {
  border-color: var(--color-sapphire);
  background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
  box-shadow: var(--shadow-sapphire);
}

/* Decorative corner flourishes - inherit border color */
.stat-card::before,
.stat-card::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 30px;
  border: 2px solid;
  border-color: inherit;
  opacity: 0.4;
}

.stat-card::before {
  top: -2px;
  left: -2px;
  border-right: none;
  border-bottom: none;
  border-top-left-radius: var(--border-radius);
}

.stat-card::after {
  bottom: -2px;
  right: -2px;
  border-left: none;
  border-top: none;
  border-bottom-right-radius: var(--border-radius);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: var(--space-xs);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

/* ============================================================================
   ITEMS GRID
   ============================================================================ */

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-md);
}

.item-card {
  background: linear-gradient(135deg, #FFFFFF 0%, #FFF9E8 100%);
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 2px solid var(--color-accent);
  transition: all var(--transition);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  position: relative;
}

/* Decorative accent bar on card - alternating colors */
.item-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 10;
}

/* Gold accent bar */
.item-card:nth-child(3n+1)::before {
  background: linear-gradient(90deg,
    transparent 0%,
    var(--color-accent) 20%,
    var(--color-accent-bright) 50%,
    var(--color-accent) 80%,
    transparent 100%);
}

/* Peacock teal accent bar */
.item-card:nth-child(3n+2)::before {
  background: linear-gradient(90deg,
    transparent 0%,
    var(--color-teal-dark) 20%,
    var(--color-teal-light) 50%,
    var(--color-teal-dark) 80%,
    transparent 100%);
}

/* Burnt sienna accent bar */
.item-card:nth-child(3n+3)::before {
  background: linear-gradient(90deg,
    transparent 0%,
    var(--color-sienna-dark) 20%,
    var(--color-sienna) 50%,
    var(--color-sienna-dark) 80%,
    transparent 100%);
}

/* Mobile touch feedback + Desktop hover */
.item-card:hover,
.item-card:active {
  transform: translateY(-4px);
  box-shadow: var(--shadow-gold);
  border-color: var(--color-accent-bright);
}

.item-photo-container {
  position: relative;
}

.item-photo {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: var(--color-bg);
}

.card-favorite-btn {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  z-index: 10;
}

.card-favorite-btn:hover,
.card-favorite-btn:active {
  background: white;
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(212, 175, 55, 0.3);
}

.card-favorite-btn svg {
  transition: all var(--transition);
}

.card-favorite-btn.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.card-favorite-btn.active svg {
  stroke: white;
  fill: white;
  animation: heartPop 0.3s ease-in-out;
}

@keyframes heartPop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

.item-content {
  padding: var(--space-lg);
}

.card-stars {
  font-size: 0.875rem;
  color: var(--color-accent);
  margin-top: var(--space-xs);
  letter-spacing: 2px;
}

.item-name {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--color-primary);
}

.item-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin: var(--space-xs) 0;
}

.item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-md);
}

.item-value {
  font-weight: 600;
  color: var(--color-accent);
}

.item-badge {
  padding: var(--space-xs) var(--space-md);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.item-badge-keep {
  background: rgba(40, 167, 69, 0.1);
  color: #28a745;
}

.item-badge-resell {
  background: rgba(255, 193, 7, 0.1);
  color: #ffc107;
}

/* ============================================================================
   EMPTY STATE
   ============================================================================ */

.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  max-width: 400px;
  margin: 0 auto;
}

.empty-icon {
  color: var(--color-text-muted);
  opacity: 0.3;
  margin: 0 auto var(--space-lg);
}

.empty-title {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
  color: var(--color-text);
}

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

/* ============================================================================
   FAB (Floating Action Button)
   ============================================================================ */

.fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--space-lg));
  right: var(--space-lg);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xl);
  transition: all var(--transition);
  z-index: 999;
}

.fab:hover {
  transform: scale(1.1);
}

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

/* ============================================================================
   FORMS
   ============================================================================ */

.item-form {
  max-width: 600px;
  margin: 0 auto;
}

.form-section {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 500;
  color: var(--color-text);
  font-size: 0.875rem;
}

.label-optional {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  background: white;
  transition: all var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(92, 122, 234, 0.1);
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
}

.form-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.form-actions button {
  flex: 1;
}

/* Form Rating Components */
.form-favorite-toggle {
  margin-bottom: var(--space-md);
}

.favorite-checkbox {
  display: none;
}

.favorite-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  background: white;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.875rem;
  color: var(--color-text);
}

.favorite-checkbox-label:hover {
  border-color: var(--color-accent);
  background: rgba(212, 175, 55, 0.05);
}

.favorite-checkbox:checked + .favorite-checkbox-label {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: white;
}

.favorite-checkbox:checked + .favorite-checkbox-label svg {
  stroke: white;
  fill: white;
}

.dimension-details {
  margin-top: var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
}

.dimension-summary {
  padding: var(--space-md);
  background: var(--color-bg);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--color-text);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dimension-summary::-webkit-details-marker {
  display: none;
}

.dimension-summary::after {
  content: '▼';
  font-size: 0.75rem;
  color: var(--color-text-muted);
  transition: transform var(--transition);
}

details[open] .dimension-summary::after {
  transform: rotate(180deg);
}

.dimension-details .dimension-ratings {
  padding: var(--space-md);
  background: white;
}

/* Color Input Group */
.color-input-group {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.color-select {
  flex: 1;
}

.color-picker {
  width: 60px;
  height: 42px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.color-picker:hover {
  border-color: var(--color-accent);
}

.color-picker::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.color-picker::-webkit-color-swatch {
  border: none;
  border-radius: var(--border-radius-sm);
}

/* Color Swatch in Detail View */
.detail-color-value {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.color-swatch {
  display: none;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 2px solid var(--color-border);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  font-size: 1rem;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  border: none;
  position: relative;
  overflow: hidden;
}

/* Gilded shimmer effect on buttons */
.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before,
.btn:active::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  color: white;
  border: 2px solid var(--color-accent-bright);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover,
.btn-primary:active {
  background: linear-gradient(135deg, var(--color-accent-bright) 0%, var(--color-accent) 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-gold);
  border-color: var(--color-accent-bright);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: linear-gradient(135deg, #FFFFFF 0%, #F1F8F4 100%);
  color: var(--color-text);
  border: 2px solid var(--color-emerald);
}

.btn-secondary:hover,
.btn-secondary:active {
  background: linear-gradient(135deg, #F1F8F4 0%, #E8F5E9 100%);
  border-color: var(--color-emerald);
  color: var(--color-primary);
  box-shadow: var(--shadow-emerald);
}

.btn-danger {
  background: linear-gradient(135deg, #3C3C3C 0%, #2C2C2C 100%);
  color: white;
  border: 2px solid #5C5C5C;
  box-shadow: 0 4px 12px rgba(44, 44, 44, 0.3), 0 2px 4px rgba(0, 0, 0, 0.15);
}

.btn-danger:hover,
.btn-danger:active {
  background: linear-gradient(135deg, #4C4C4C 0%, #3C3C3C 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(44, 44, 44, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
  border-color: #6C6C6C;
}

.btn-danger:active {
  transform: translateY(0);
}

.btn-info {
  background: linear-gradient(135deg, #4ECDC4 0%, #3AB0A8 100%);
  color: white;
  border: 2px solid #5ED8CF;
  box-shadow: 0 4px 12px rgba(78, 205, 196, 0.3), 0 2px 4px rgba(0, 0, 0, 0.15);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-info:hover,
.btn-info:active {
  background: linear-gradient(135deg, #5ED8CF 0%, #4ECDC4 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(78, 205, 196, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
  border-color: #6EE8DF;
}

.btn-info:active {
  transform: translateY(0);
}

/* Overflow Menu */
.overflow-menu {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-overflow {
  min-width: 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  background: linear-gradient(135deg, #FFFFFF 0%, #F1F8F4 100%);
  border: 2px solid var(--color-emerald);
  color: var(--color-text);
}

.btn-overflow:hover,
.btn-overflow:active {
  background: linear-gradient(135deg, #E8F5EF 0%, #D5E8E0 100%);
  transform: translateY(-1px);
  border-color: var(--color-emerald-dark);
}

.overflow-dropdown {
  display: none;
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: var(--space-sm);
  background: white;
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 2001;
  min-width: 160px;
}

.overflow-dropdown.show {
  display: block;
  animation: slideUp 0.2s ease-out;
}

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

.overflow-dropdown .btn {
  width: 100%;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--color-border);
  justify-content: flex-start;
}

.overflow-dropdown .btn:last-child {
  border-bottom: none;
}

.btn-analyze {
  width: 100%;
  margin-bottom: var(--space-lg);
}

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

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-lg);
  color: var(--color-text-muted);
  border-radius: var(--border-radius-sm);
  transition: all var(--transition);
}

.back-btn:hover,
.back-btn:active {
  background: rgba(212, 175, 55, 0.08);
  color: var(--color-text);
}

/* ============================================================================
   TOGGLE GROUP
   ============================================================================ */

.toggle-group {
  display: flex;
  gap: var(--space-sm);
}

.toggle-btn {
  flex: 1;
  padding: var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  background: white;
  font-weight: 500;
  transition: all var(--transition);
}

.toggle-btn.active {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

/* ============================================================================
   PHOTO UPLOAD
   ============================================================================ */

.photo-upload-btn {
  width: 100%;
  padding: var(--space-xl);
  border: 2px dashed var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  color: var(--color-text-muted);
  transition: all var(--transition);
}

.photo-upload-btn:hover {
  border-color: var(--color-accent);
  background: rgba(92, 122, 234, 0.05);
  color: var(--color-accent);
}

.photo-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.photo-preview {
  aspect-ratio: 3/4;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-preview-remove {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-xs);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  border: none;
  z-index: 2;
}

.photo-preview-remove:hover {
  background: rgba(220, 38, 38, 0.9);
}

.photo-preview-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.photo-category-select {
  width: 100%;
  padding: 4px 6px;
  font-size: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  cursor: pointer;
}

.photo-category-select:focus {
  outline: 2px solid var(--color-accent);
  border-color: var(--color-accent);
}

.photo-caption-input {
  width: 100%;
  padding: 4px 6px;
  font-size: 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
}

.photo-caption-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.photo-caption-input:focus {
  outline: 2px solid var(--color-accent);
  border-color: var(--color-accent);
}

.photo-primary-badge {
  position: absolute;
  top: var(--space-xs);
  left: var(--space-xs);
  background: var(--color-accent);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  z-index: 2;
}

/* ============================================================================
   VIEW MANAGEMENT
   ============================================================================ */

.view {
  animation: fadeIn var(--transition-slow);
}

.view-header {
  margin-bottom: var(--space-xl);
}

.view-title {
  font-size: 2rem;
  color: var(--color-primary);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================================
   LOADING & TOAST
   ============================================================================ */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  gap: var(--space-lg);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--color-bg);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  color: var(--color-text-muted);
  font-weight: 500;
}

.toast-container {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--space-lg));
  left: var(--space-lg);
  right: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: var(--color-primary);
  color: white;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-xl);
  pointer-events: all;
  animation: slideInUp var(--transition-slow);
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================================
   UTILITIES
   ============================================================================ */

.hidden {
  display: none !important;
}

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

/* ============================================================================
   RESPONSIVE (Desktop)
   ============================================================================ */

@media (min-width: 768px) {
  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }

  .bottom-nav {
    display: none;
  }

  .app {
    padding-bottom: 0;
  }

  .fab {
    bottom: var(--space-xl);
  }
}

@media (min-width: 1024px) {
  .items-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================================================================
   ANALYTICS DASHBOARD
   ============================================================================ */

.analytics-content {
  padding: var(--space-lg);
  padding-bottom: calc(var(--bottom-nav-height) + var(--space-xl));
}

.analytics-filters {
  background: linear-gradient(135deg, #FAF7F2 0%, #F4E4C1 100%);
  border: 2px solid var(--color-accent);
  border-radius: var(--border-radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  align-items: end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-select {
  width: 100%;
  padding: var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  background: white;
  font-size: 0.875rem;
}

.reset-filters-btn {
  padding: var(--space-sm) var(--space-md);
  white-space: nowrap;
}

.analytics-section {
  margin-bottom: var(--space-2xl);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--color-text);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-border);
}

.refresh-btn {
  padding: var(--space-sm);
  color: var(--color-text);
  transition: var(--transition);
  border-radius: var(--border-radius-sm);
}

.refresh-btn:hover {
  background: var(--color-border);
}

.refresh-btn:active {
  transform: rotate(180deg);
}

/* Financial Summary Cards (Stock Market Style) */
.financial-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.financial-card {
  background: linear-gradient(135deg, #FFFFFF 0%, #F8F9FA 100%);
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

.financial-card-highlight {
  border-color: var(--color-accent);
  background: linear-gradient(135deg, #FAF7F2 0%, #F4E4C1 100%);
}

.financial-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
  font-weight: 600;
}

.financial-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.financial-sublabel {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.financial-roi {
  font-size: 1rem;
  font-weight: 600;
  margin-top: var(--space-xs);
}

.financial-roi.positive {
  color: #2ECC71;
}

.financial-roi.positive::before {
  content: "↑ ";
}

.financial-roi.negative {
  color: #E74C3C;
}

.financial-roi.negative::before {
  content: "↓ ";
}

.financial-value.positive {
  color: #2ECC71;
}

.financial-value.negative {
  color: #E74C3C;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-md);
}

/* Chart Containers */
.chart-container {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  position: relative;
  min-height: 300px;
}

.chart-container-small {
  min-height: 250px;
  max-width: 400px;
  margin: 0 auto;
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

.chart-column {
  flex: 1;
}

/* Best Finds List */
.best-finds-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.best-find-item {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.best-find-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.best-find-photo {
  width: 60px;
  height: 60px;
  border-radius: var(--border-radius-sm);
  object-fit: cover;
  background: var(--color-bg);
  flex-shrink: 0;
}

.best-find-info {
  flex: 1;
}

.best-find-name {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.best-find-values {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.best-find-roi {
  font-weight: 700;
  font-size: 1.25rem;
  color: #2ECC71;
  flex-shrink: 0;
}

/* Location Insights */
.location-insights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
}

.location-insight-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.location-insight-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
}

.location-insight-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.location-insight-sublabel {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.text-muted {
  color: var(--color-text-muted);
  font-style: italic;
  text-align: center;
  padding: var(--space-xl);
}

/* Responsive adjustments */
@media (min-width: 640px) {
  .chart-row {
    grid-template-columns: 1fr 1fr;
  }

  .financial-summary {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  .analytics-content {
    padding-bottom: var(--space-xl);
  }
}

/* ============================================================================
   ITEM DETAIL MODAL
   ============================================================================ */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3000;  /* Higher than overflow dropdown (2001) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(44, 24, 16, 0.75);
  backdrop-filter: blur(4px);
}

.modal-container {
  position: relative;
  background: white;
  border-radius: var(--border-radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 2px solid var(--color-accent);
  background: linear-gradient(135deg, #FAF7F2 0%, #F4E4C1 100%);
}

.modal-title {
  font-size: 1.5rem;
  color: var(--color-primary);
  margin: 0;
}

.modal-header-actions {
  display: flex;
  gap: var(--space-sm);
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-md);
  background: white;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition);
}

.icon-btn:hover,
.icon-btn:active {
  background: rgba(212, 175, 55, 0.1);
  transform: scale(1.05);
}

.favorite-btn svg {
  transition: all var(--transition);
}

.favorite-btn.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}

.favorite-btn.active svg {
  fill: white;
  animation: heartBeat 0.3s ease-in-out;
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.modal-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
}

.modal-footer {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-lg);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
  flex-shrink: 0; /* Prevent footer from shrinking */
}

.modal-footer .btn {
  flex: 1;
}

/* Photo Gallery */
.detail-gallery {
  margin-bottom: var(--space-xl);
}

.detail-photo {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--border-radius-md);
  border: 2px solid var(--color-accent);
  margin-bottom: var(--space-md);
}

.gallery-thumbnails {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: var(--space-sm);
}

.gallery-thumbnail-wrapper {
  position: relative;
  width: 80px;
  height: 60px;
  flex-shrink: 0;
  border-radius: var(--border-radius-sm);
  border: 2px solid var(--color-border);
  cursor: pointer;
  opacity: 0.6;
  transition: all var(--transition);
  overflow: hidden;
}

.gallery-thumbnail-wrapper:hover {
  opacity: 0.8;
  transform: scale(1.05);
}

.gallery-thumbnail-wrapper.active {
  opacity: 1;
  border-color: var(--color-accent);
}

.gallery-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-category-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.7);
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 0.7rem;
  line-height: 1;
}

.detail-photo-caption {
  margin: var(--space-sm) 0 0 0;
  padding: var(--space-sm);
  background: var(--color-bg-secondary, rgba(0, 0, 0, 0.05));
  border-radius: var(--border-radius-sm);
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  font-style: italic;
}

/* Item Information */
.detail-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.detail-section {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-lg);
}

.detail-section:last-child {
  border-bottom: none;
}

.detail-section-title {
  font-size: 1.125rem;
  color: var(--color-primary);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.detail-section-title::before {
  content: '❖';
  color: var(--color-accent);
  font-size: 0.875rem;
}

.detail-description {
  color: var(--color-text);
  line-height: 1.6;
  margin: 0;
}

.detail-grid {
  display: grid;
  gap: var(--space-md);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) 0;
}

.detail-label {
  font-weight: 500;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.detail-value {
  font-weight: 600;
  color: var(--color-text);
  text-align: right;
}

.detail-value.financial-value {
  color: var(--color-accent);
  font-size: 1.125rem;
}

/* Rating Components */
.rating-container {
  margin-bottom: var(--space-lg);
}

.rating-label {
  display: block;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
  font-size: 0.875rem;
}

.star-rating {
  display: flex;
  gap: var(--space-xs);
}

.star-btn {
  background: none;
  border: none;
  font-size: 2rem;
  color: #DDD;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  line-height: 1;
  /* Add visible outline for unfilled stars */
  -webkit-text-stroke: 1px var(--color-text-muted);
  text-stroke: 1px var(--color-text-muted);
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.3));
}

.star-btn:hover {
  color: var(--color-accent);
  transform: scale(1.1);
  -webkit-text-stroke: 1px var(--color-accent);
  text-stroke: 1px var(--color-accent);
}

.star-btn.active {
  color: var(--color-accent);
  -webkit-text-stroke: 0;
  text-stroke: 0;
  filter: drop-shadow(0 2px 4px rgba(212, 175, 55, 0.4));
}

/* Dimension Ratings */
.dimension-ratings {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.dimension-rating {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.dimension-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  color: var(--color-text);
  font-size: 0.875rem;
}

.dimension-value {
  font-size: 1rem;
  color: var(--color-accent);
  font-weight: 600;
  min-width: 30px;
  text-align: right;
}

.rating-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #F4E4C1 0%, var(--color-accent) 100%);
  outline: none;
  cursor: pointer;
}

.rating-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 3px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.2s ease;
}

.rating-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.rating-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 3px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.2s ease;
}

.rating-slider::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Radar Chart */
.radar-chart-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--space-lg);
  background: linear-gradient(135deg, #FAF7F2 0%, #F4E4C1 100%);
  border-radius: var(--border-radius-md);
  border: 2px solid var(--color-accent);
}

.radar-chart-container canvas {
  max-width: 100%;
  height: auto;
}

/* Value Info Modal Styles */
.info-icon-btn {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--color-teal);
  cursor: pointer;
  padding: 0 4px;
  margin-left: 4px;
  opacity: 1;
  transition: all var(--transition);
  vertical-align: middle;
  line-height: 1;
}

.info-icon-btn:hover {
  transform: scale(1.15);
}

.info-icon-btn:active {
  transform: scale(0.9);
  opacity: 0.7;
}

.value-info-modal {
  max-width: 600px;
}

.value-info-section {
  color: var(--color-text);
}

.value-info-subtitle {
  font-size: 1.125rem;
  color: var(--color-primary);
  margin: 0 0 var(--space-md) 0;
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-accent);
}

.value-info-text {
  line-height: 1.6;
  margin: 0 0 var(--space-md) 0;
  color: var(--color-text-secondary);
}

.value-info-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-lg) 0;
}

.value-info-list li {
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-sm);
  background: rgba(244, 228, 193, 0.2);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--border-radius-sm);
  line-height: 1.5;
  transition: all var(--transition);
}

.value-info-list li:hover {
  background: rgba(244, 228, 193, 0.3);
}

.value-info-list li:active {
  background: rgba(244, 228, 193, 0.35);
  transform: scale(0.98);
}

.value-info-list li strong {
  color: var(--color-primary);
  font-weight: 600;
}

.value-details-box {
  margin: var(--space-lg) 0;
  padding: var(--space-md);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.08) 0%, rgba(78, 205, 196, 0.08) 100%);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.value-details-box h4 {
  margin-top: 0;
}

.value-info-note {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background: rgba(78, 205, 196, 0.1);
  border-left: 4px solid var(--color-teal);
  border-radius: var(--border-radius-sm);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
}

.value-info-note strong {
  color: var(--color-teal);
  font-weight: 600;
}

.close-btn {
  background: rgba(212, 175, 55, 0.05);
  border: none;
  font-size: 1.75rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  transition: all var(--transition);
  line-height: 1;
}

.close-btn:hover {
  background: rgba(212, 175, 55, 0.15);
  color: var(--color-primary);
}

.close-btn:active {
  background: rgba(212, 175, 55, 0.25);
  transform: scale(0.9);
}

/* Modal Responsive */
@media (max-width: 640px) {
  .modal {
    padding: 0;
    align-items: flex-end;
  }

  .modal-container {
    max-height: 95vh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .modal-header {
    padding: var(--space-md);
  }

  .modal-title {
    font-size: 1.25rem;
  }

  .modal-content {
    padding: var(--space-md);
  }

  .modal-footer {
    flex-direction: row;
    padding: var(--space-md) var(--space-sm);
    padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom)); /* iOS safe area */
    gap: var(--space-xs);
  }

  .modal-footer .btn {
    flex: 1;
    min-width: 0; /* Allow buttons to shrink below content size */
    padding: 0.6rem 0.5rem;
    font-size: 0.85rem;
    height: 40px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .overflow-menu {
    flex: 0 0 40px; /* Fixed width for menu button */
  }

  .btn-overflow {
    min-width: 40px !important;
    width: 40px !important;
    height: 40px !important;
    font-size: 1.2rem !important;
    padding: 0 !important;
  }

  .star-btn {
    font-size: 1.75rem;
  }

  .dimension-ratings {
    gap: var(--space-md);
  }

  .detail-grid {
    gap: var(--space-sm);
  }
}

@media (min-width: 640px) {
  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }

  .detail-row {
    grid-column: span 1;
  }
}

/* ============================================================================
   MULTI-SELECT FUNCTIONALITY
   ============================================================================ */

/* Multi-select button in chip row */
.chip-multiselect {
  margin-left: auto;
}

.chip-multiselect.active {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

/* Checkbox on item cards */
.item-checkbox {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: 10;
}

.item-checkbox input[type="checkbox"] {
  width: 24px;
  height: 24px;
  cursor: pointer;
  accent-color: var(--color-accent);
}

/* Selected state for item cards */
.item-card.selected {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent);
  background: linear-gradient(135deg, #FFFDF7 0%, #FFF9E8 100%);
}

.item-card.selectable {
  cursor: pointer;
  user-select: none;
}

/* Multi-select action bar */
.multi-select-bar {
  position: fixed;
  bottom: 80px; /* Above nav bar */
  left: 0;
  right: 0;
  background: white;
  border-top: 2px solid var(--color-accent);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  padding: var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  z-index: 999;
  transform: translateY(200px);
  opacity: 0;
  transition: all 0.3s ease;
}

.multi-select-bar.visible {
  transform: translateY(0);
  opacity: 1;
}

.multi-select-info {
  font-weight: 600;
  color: var(--color-text);
}

.multi-select-actions {
  display: flex;
  gap: var(--space-sm);
}

.multi-select-actions button {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
}

.multi-select-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Compare modal */
.modal-wide .modal-content,
.modal-wide.modal-container {
  max-width: 90vw;
  width: 1200px;
}

.compare-table-container {
  overflow-x: auto;
  margin: var(--space-md) 0;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.compare-table th,
.compare-table td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.compare-table th {
  background: linear-gradient(135deg, #F1F8F4 0%, #E8F5E9 100%);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.compare-table thead th:first-child {
  background: linear-gradient(135deg, #FFFDF7 0%, #FFF9E8 100%);
  border-right: 2px solid var(--color-accent);
  min-width: 150px;
}

.compare-field-label {
  font-weight: 600;
  background: #FFFDF7;
  border-right: 2px solid var(--color-accent);
}

.compare-item-header {
  text-align: center;
}

.compare-item-header strong {
  color: var(--color-accent);
}

.compare-item-header small {
  color: var(--color-text-muted);
}

@media (max-width: 768px) {
  .modal-wide .modal-content,
  .modal-wide.modal-container {
    max-width: 95vw;
  }

  .compare-table {
    font-size: 0.75rem;
  }

  .compare-table th,
  .compare-table td {
    padding: var(--space-xs) var(--space-sm);
  }

  .multi-select-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .multi-select-actions {
    width: 100%;
  }

  .multi-select-actions button {
    flex: 1;
  }
}

/* ==================================================================
   AI EDUCATIONAL FEATURES - Learn More & Deeper Dive
   ================================================================== */

/* Learn More Buttons (Manufacturer & Era) */
.learn-more-btn {
  font-size: 0.7rem;
  padding: 2px 8px;
  margin-left: 8px;
  background: linear-gradient(135deg, #d4af37 0%, #f4e4c1 100%);
  color: #1a1a1a;
  border: 1px solid #d4af37;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  opacity: 1;
}

.learn-more-btn:hover {
  background: linear-gradient(135deg, #f4e4c1 0%, #d4af37 100%);
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.learn-more-btn:active {
  transform: scale(0.95);
  opacity: 0.8;
}

/* Deeper Dive Button */
.deeper-dive-row {
  grid-column: 1 / -1;
  padding: 12px 0;
  border-top: 1px solid rgba(212, 175, 55, 0.2);
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  margin: 8px 0;
}

.deeper-dive-btn {
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, #2c5f2d 0%, #4a8f4c 100%);
  color: #f4e4c1;
  border: 2px solid #4a8f4c;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(74, 143, 76, 0.2);
}

.deeper-dive-btn:hover {
  background: linear-gradient(135deg, #4a8f4c 0%, #2c5f2d 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 143, 76, 0.4);
}

.deeper-dive-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 6px rgba(74, 143, 76, 0.3);
}

/* Educational Modals */
.educational-modal {
  max-width: 600px;
  background: #1a1a1a;  /* Dark background like other modals */
}

.deeper-dive-modal {
  max-width: 700px;
  background: #1a1a1a;
}

/* Loading State */
.educational-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.educational-loading .spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(212, 175, 55, 0.2);
  border-top-color: #d4af37;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

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

.educational-loading p {
  color: #f4e4c1;
  font-size: 1rem;
  margin: 4px 0;
}

.loading-subtext {
  font-size: 0.85rem !important;
  color: rgba(244, 228, 193, 0.7) !important;
  font-style: italic;
}

/* Educational Content */
.educational-content {
  padding: 20px;
  line-height: 1.8;
  color: #f4e4c1;
}

.educational-content h3 {
  color: #d4af37;
  font-size: 1.2rem;
  margin: 24px 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(212, 175, 55, 0.3);
}

.educational-content h3:first-child {
  margin-top: 0;
}

.educational-content p {
  margin: 12px 0;
  color: #f4e4c1;
}

.educational-content strong {
  color: #d4af37;
  font-weight: 600;
}

.educational-content ul,
.educational-content ol {
  margin: 12px 0;
  padding-left: 24px;
}

.educational-content li {
  margin: 8px 0;
  color: #f4e4c1;
}

/* Value Analysis Content */
.value-analysis-content {
  background: rgba(212, 175, 55, 0.05);
  border-radius: 8px;
  padding: 24px;
}

.value-analysis-content h3 {
  color: #d4af37;
  font-size: 1.3rem;
}

/* Error State */
.educational-error {
  padding: 40px 20px;
  text-align: center;
  color: #ff6b6b;
}

.educational-error p {
  font-size: 1rem;
}

/* Mobile Optimization */
@media (max-width: 480px) {
  .learn-more-btn {
    font-size: 0.65rem;
    padding: 2px 6px;
    margin-left: 6px;
  }

  .deeper-dive-btn {
    font-size: 0.9rem;
    padding: 10px 16px;
  }

  .educational-modal,
  .deeper-dive-modal {
    max-width: 95%;
    margin: 10px;
  }

  .educational-content {
    padding: 16px;
    font-size: 0.95rem;
  }

  .educational-content h3 {
    font-size: 1.1rem;
  }

  .value-analysis-content {
    padding: 16px;
  }
}

/* ============================================================================
   SORT & FILTER CONTROLS - Mobile-First
   ============================================================================ */

.controls-row {
  position: relative;
  margin: 0 var(--space-md) var(--space-md);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.filter-btn,
.sort-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--gold);
  color: var(--navy);
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px; /* Touch-friendly */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filter-btn.active {
  background: var(--color-teal-dark);
  color: white;
}

.filter-btn:active,
.sort-btn:active {
  transform: scale(0.98);
  background: #c19a6b;
}

.filter-btn svg,
.sort-btn svg {
  flex-shrink: 0;
}

/* Filter Dropdown */
.filter-dropdown,
.sort-dropdown {
  position: absolute;
  top: 52px;
  right: 0;
  background: white;
  border: 2px solid var(--gold);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  min-width: 220px;
  max-height: 80vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.filter-dropdown.hidden,
.sort-dropdown.hidden {
  display: none;
}

.filter-section,
.sort-section {
  padding: 12px 0;
  border-bottom: 1px solid #e5e5e5;
}

.sort-section:last-child {
  border-bottom: none;
}

.filter-section-title,
.sort-section-title {
  padding: 8px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--navy);
  background: white;
  margin: 0 12px;
  width: calc(100% - 24px);
  cursor: pointer;
}

.filter-clear-btn {
  width: calc(100% - 24px);
  margin: 8px 12px;
  padding: 10px;
  background: var(--color-sienna);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-clear-btn:active {
  background: var(--color-sienna-dark);
  transform: scale(0.98);
}

.sort-option {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  text-align: left;
  font-size: 0.95rem;
  color: var(--navy);
  cursor: pointer;
  transition: background 0.15s ease;
  min-height: 44px; /* Touch-friendly */
}

.sort-option:active {
  background: rgba(212, 175, 55, 0.15);
}

/* Desktop hover states (progressive enhancement) */
@media (hover: hover) and (pointer: fine) {
  .sort-btn:hover {
    background: #c19a6b;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  }

  .sort-option:hover {
    background: rgba(212, 175, 55, 0.1);
  }
}

/* Mobile Optimization */
@media (max-width: 480px) {
  .sort-controls {
    margin: 0 var(--space-sm) var(--space-sm);
  }

  .sort-btn {
    font-size: 0.85rem;
    padding: 8px 12px;
  }

  .sort-dropdown {
    right: 0;
    left: 0;
    min-width: auto;
    max-height: 70vh;
  }

  .sort-section-title {
    font-size: 0.7rem;
    padding: 6px 12px;
  }

  .sort-option {
    font-size: 0.9rem;
    padding: 10px 12px;
  }
}

/* ============================================================================
   ITEM CARD ENHANCEMENTS - ROI & Location Display
   ============================================================================ */

.item-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  margin-top: 4px;
}

.item-location {
  font-size: 0.75rem;
  color: var(--color-teal-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-roi {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.item-roi.positive {
  background: rgba(76, 175, 80, 0.1);
  color: #2e7d32;
}

.item-roi.negative {
  background: rgba(244, 67, 54, 0.1);
  color: #c62828;
}

.item-roi.neutral {
  background: rgba(158, 158, 158, 0.1);
  color: #616161;
}

/* Mobile Optimization */
@media (max-width: 480px) {
  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-sm);
  }

  .item-name {
    font-size: 0.9rem;
  }

  .item-info-row {
    font-size: 0.75rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .item-location {
    font-size: 0.7rem;
  }

  .item-roi {
    font-size: 0.75rem;
    padding: 1px 6px;
  }
}

/* ============================================================================
   SET MANAGEMENT MODALS
   ============================================================================ */

/* Sets List */
.sets-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.set-card {
  background: linear-gradient(135deg, var(--color-bg-light) 0%, white 100%);
  border: 2px solid var(--color-accent);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
  cursor: pointer;
}

.set-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-emerald);
}

.set-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md);
}

.set-card-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.set-card-meta {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.set-card-actions {
  display: flex;
  gap: var(--space-xs);
}

.set-card-actions .btn {
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.875rem;
  min-width: auto;
}

.set-progress {
  margin-top: var(--space-md);
}

.set-progress-bar-container {
  background: var(--color-bg);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin: var(--space-sm) 0;
}

.set-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-emerald) 0%, var(--color-emerald-light) 100%);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.set-progress-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.set-progress-percentage {
  font-weight: 700;
  color: var(--color-emerald);
}

.set-piece-types {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

.set-piece-types-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
}

.set-piece-types-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.piece-type-badge {
  display: inline-block;
  padding: 4px 8px;
  background: var(--color-bg-light);
  border: 1px solid var(--color-accent);
  border-radius: 12px;
  font-size: 0.75rem;
  color: var(--color-text);
}

/* Set Detection Modal - Piece List */
.piece-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm);
  background: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  margin-bottom: var(--space-xs);
}

.piece-item .piece-type {
  color: var(--color-text);
  font-size: 0.9rem;
}

.piece-item .piece-quantity {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

/* Assign to Set List */
.assign-set-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.assign-set-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  background: white;
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.assign-set-option:hover {
  border-color: var(--color-emerald);
  background: var(--color-bg-light);
}

.assign-set-option.selected {
  border-color: var(--color-emerald);
  background: rgba(46, 125, 50, 0.05);
}

.assign-set-option-info {
  flex: 1;
}

.assign-set-option-name {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}

.assign-set-option-meta {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.assign-set-option-progress {
  font-size: 0.875rem;
  color: var(--color-emerald);
  font-weight: 600;
}

/* Remove from Set Option */
.remove-set-option {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.remove-set-option:hover {
  background: rgba(244, 67, 54, 0.05);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .set-card {
    padding: var(--space-md);
  }

  .set-card-title {
    font-size: 1.1rem;
  }

  .set-card-header {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .set-card-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ============================================================================
   WISH LIST VIEW
   ============================================================================ */

.view-wishlist {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.wishlist-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  padding-bottom: calc(var(--bottom-nav-height) + var(--space-lg));
}

/* Wish List Controls */
.wishlist-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(212, 175, 55, 0.2);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.control-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.control-select {
  padding: var(--space-sm) var(--space-md);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.control-select:hover {
  border-color: var(--color-gold);
  background: rgba(0, 0, 0, 0.4);
}

.control-select:focus {
  outline: none;
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

/* Empty State */
.wishlist-empty {
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
  max-width: 400px;
  margin: 4rem auto;
}

.wishlist-empty p {
  margin-bottom: var(--space-md);
  color: var(--color-text);
}

.wishlist-empty .text-muted {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

/* Wish List Items Grid */
.wishlist-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
}

/* Wish List Item Card */
.wishlist-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.wishlist-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  border-color: var(--color-gold);
}

.wishlist-card-image {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  background: rgba(0, 0, 0, 0.3);
}

.wishlist-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-sm);
  gap: var(--space-sm);
}

.wishlist-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-gold);
  margin: 0;
  flex: 1;
}

.wishlist-card-set {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
}

.wishlist-card-manufacturer {
  font-size: 0.85rem;
  color: var(--color-emerald);
  margin-bottom: var(--space-md);
}

.wishlist-card-progress {
  margin-bottom: var(--space-md);
}

.progress-label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
  display: flex;
  justify-content: space-between;
}

.progress-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-emerald), var(--color-gold));
  transition: width 0.3s ease;
}

.wishlist-card-quantity {
  font-size: 0.9rem;
  color: var(--color-text);
  margin-bottom: var(--space-md);
}

.wishlist-card-notes {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
  line-height: 1.5;
  max-height: 3em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.wishlist-card-footer {
  display: flex;
  gap: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid rgba(212, 175, 55, 0.2);
}

.wishlist-card-footer .btn {
  flex: 1;
  font-size: 0.85rem;
  padding: var(--space-sm) var(--space-md);
}

/* Priority Badges */
.priority-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.priority-high {
  background: linear-gradient(135deg, rgba(185, 28, 28, 0.9) 0%, rgba(220, 38, 38, 0.8) 100%);
  color: #ffffff;
  border: 2px solid #dc2626;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
}

.priority-medium {
  background: linear-gradient(135deg, rgba(202, 138, 4, 0.9) 0%, rgba(234, 179, 8, 0.8) 100%);
  color: #ffffff;
  border: 2px solid #ca8a04;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 8px rgba(234, 179, 8, 0.4);
}

.priority-low {
  background: linear-gradient(135deg, rgba(21, 128, 61, 0.9) 0%, rgba(34, 197, 94, 0.8) 100%);
  color: #ffffff;
  border: 2px solid #15803d;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
}

/* Priority Selector (in modal) */
.priority-selector {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.priority-option {
  cursor: pointer;
  position: relative;
}

.priority-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.priority-option .priority-badge {
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0.6;
}

.priority-option input[type="radio"]:checked + .priority-badge {
  opacity: 1;
  transform: scale(1.05);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.priority-option:hover .priority-badge {
  opacity: 0.9;
}

/* Mobile Responsiveness for Wish List */
@media (max-width: 768px) {
  .wishlist-controls {
    grid-template-columns: 1fr;
  }

  .wishlist-items {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .wishlist-content {
    padding: var(--space-md);
    padding-bottom: calc(var(--bottom-nav-height) + var(--space-md));
  }

  .wishlist-controls {
    gap: var(--space-sm);
    padding: var(--space-sm);
  }

  .wishlist-card {
    padding: var(--space-sm);
  }

  .wishlist-card-footer {
    flex-direction: column;
  }

  .priority-selector {
    gap: var(--space-sm);
  }
}

/* ============================================================================
   SET RECOMMENDATIONS
   ============================================================================ */

.set-recommendations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.set-recommendation-card {
  background: var(--color-bg-secondary);
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: all 0.2s ease;
  cursor: pointer;
}

.set-recommendation-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  border-color: var(--color-gold);
}

.set-recommendation-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--color-bg-tertiary);
}

.set-recommendation-info {
  padding: 0.75rem;
}

.set-recommendation-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.set-recommendation-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.set-recommendation-actions .btn {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.75rem;
}

@media (max-width: 480px) {
  .set-recommendations-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
  }

  .set-recommendation-image {
    height: 150px;
  }
}

/* ============================================================================
   HELP ACCORDION (Ask Bannister)
   ============================================================================ */

.help-accordion {
  margin-bottom: 0.75rem;
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius);
  overflow: hidden;
  background: var(--color-bg-secondary);
}

.help-accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--color-bg-secondary);
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  text-align: left;
  transition: background 0.2s ease;
}

.help-accordion-header:hover {
  background: var(--color-bg-tertiary);
}

.help-accordion-header span {
  flex: 1;
}

.help-accordion-icon {
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.help-accordion.active .help-accordion-icon {
  transform: rotate(180deg);
}

.help-accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 1rem;
  background: var(--color-bg-primary);
}

.help-accordion.active .help-accordion-content {
  max-height: 5000px;
  padding: 1rem;
}

.help-accordion-content p {
  margin-bottom: 0.75rem;
  color: var(--color-text-secondary);
}

.help-accordion-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.help-accordion-content li {
  padding: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.help-accordion-content li::before {
  content: '•';
  position: absolute;
  left: 0.5rem;
  color: var(--color-gold);
  font-weight: bold;
}


/* ========================================
   HERITAGE MARK LOGO (Home Page)
   ======================================== */

.heritage-mark-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem 0;
  margin-bottom: 1rem;
}

.heritage-mark-logo {
  max-width: 500px;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 20px rgba(212, 175, 105, 0.4));
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .heritage-mark-container {
    padding: 1rem 0;
    margin-bottom: 0.75rem;
  }

  .heritage-mark-logo {
    max-width: 380px;
  }
}
