:root {
  --cal-primary: #D8402B;      /* chili red */
  --cal-primary-dark: #B22F1D;
  --cal-secondary: #1E8E5A;    /* fresh green */
  --cal-accent: #FFB020;       /* mango gold */
  --cal-dark: #23262B;
  --cal-bg: #FBF8F5;
  --cal-card-radius: 16px;
  --cal-shadow: 0 2px 12px rgba(35,38,43,0.06);
  --cal-shadow-hover: 0 8px 24px rgba(35,38,43,0.12);
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--cal-bg);
  color: var(--cal-dark);
  padding-bottom: 70px;
}
h1,h2,h3,h4,h5,h6 { font-family: 'Poppins', 'Inter', sans-serif; font-weight: 600; }

a { color: var(--cal-primary); }
.btn-primary {
  background: var(--cal-primary); border-color: var(--cal-primary);
}
.btn-primary:hover, .btn-primary:focus { background: var(--cal-primary-dark); border-color: var(--cal-primary-dark); }
.btn-outline-primary { color: var(--cal-primary); border-color: var(--cal-primary); }
.btn-outline-primary:hover { background: var(--cal-primary); border-color: var(--cal-primary); }
.text-primary-cal { color: var(--cal-primary) !important; }

/* ---- Navbar ---- */
.app-navbar {
  background: #fff;
  box-shadow: var(--cal-shadow);
  padding: .6rem 0;
}
.app-navbar .navbar-brand {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--cal-dark);
}
.app-navbar .navbar-brand span { color: var(--cal-primary); }
.nav-badge {
  position: absolute; top: -4px; right: -8px; font-size: .6rem; padding: .25em .45em;
}
.avatar-sm { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.badge-plan { font-size: .65rem; padding: .25em .5em; border-radius: 20px; margin-left: 4px; }
.badge-pro { background: #FFF4E0; color: #B5750A; }
.badge-proplus { background: #E7F3FF; color: #0B6FCE; }
.notif-dropdown { width: 320px; max-height: 400px; overflow-y: auto; }

/* ---- Hero ---- */
.hero-section {
  background: linear-gradient(135deg, var(--cal-primary) 0%, #E8623F 55%, var(--cal-accent) 130%);
  color: #fff;
  border-radius: 0 0 32px 32px;
  padding: 4rem 0 5rem;
  position: relative;
  overflow: hidden;
}
.hero-section::after {
  content: "🌶️";
  position: absolute; font-size: 12rem; opacity: .08; right: -2rem; top: -3rem; transform: rotate(15deg);
}
.hero-section h1 { font-size: 2.6rem; font-weight: 700; }
.hero-search {
  background: #fff; border-radius: 50px; padding: .4rem; box-shadow: var(--cal-shadow-hover); max-width: 640px;
}
.hero-search input { border: none; }
.hero-search input:focus { box-shadow: none; }

/* ---- Category pills ---- */
.category-scroll { display: flex; gap: .75rem; overflow-x: auto; padding: 1rem 0; scrollbar-width: thin; }
.category-pill {
  flex: 0 0 auto; background: #fff; border-radius: var(--cal-card-radius); box-shadow: var(--cal-shadow);
  padding: 1rem 1.25rem; text-align: center; min-width: 100px; text-decoration: none; color: var(--cal-dark);
  transition: transform .15s, box-shadow .15s;
}
.category-pill:hover { transform: translateY(-3px); box-shadow: var(--cal-shadow-hover); color: var(--cal-primary); }
.category-pill .cat-icon { font-size: 1.8rem; display: block; margin-bottom: .35rem; }

/* ---- Product cards ---- */
.product-card {
  border: none; border-radius: var(--cal-card-radius); box-shadow: var(--cal-shadow);
  overflow: hidden; transition: transform .15s, box-shadow .15s; position: relative;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--cal-shadow-hover); }
.product-img-wrap { position: relative; aspect-ratio: 1/1; overflow: hidden; background: #f0f0f0; }
.product-img { width: 100%; height: 100%; object-fit: cover; }
.product-name { font-size: .92rem; line-height: 1.3; height: 2.4em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.product-price { font-weight: 700; color: var(--cal-primary); font-size: 1.05rem; }
.badge-featured {
  position: absolute; top: 8px; left: 8px; background: var(--cal-accent); color: #4a3200; font-size: .65rem;
  font-weight: 600; padding: .3em .6em; border-radius: 20px;
}
.badge-sold {
  position: absolute; inset: 0; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 1.2rem; letter-spacing: 2px;
}
.btn-fav {
  position: absolute; bottom: 8px; right: 8px; background: #fff; border: none; border-radius: 50%;
  width: 34px; height: 34px; box-shadow: var(--cal-shadow); display: flex; align-items: center; justify-content: center;
  color: #999; z-index: 2;
}
.product-card { padding-bottom: 0; }
.product-card .card-body { position: relative; }
.btn-fav.active, .btn-fav.active i { color: var(--cal-primary); }
.btn-fav i { pointer-events: none; }

/* ---- Seller / plan badges on profile ---- */
.seller-badge-free { color: #888; }

/* ---- Pricing cards ---- */
.pricing-card { border-radius: var(--cal-card-radius); box-shadow: var(--cal-shadow); border: 2px solid transparent; padding: 2rem; height: 100%; }
.pricing-card.featured { border-color: var(--cal-primary); box-shadow: var(--cal-shadow-hover); position: relative; }
.pricing-card.featured::before {
  content: "MOST POPULAR"; position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--cal-primary); color: #fff; font-size: .7rem; padding: .3em 1em; border-radius: 20px; font-weight: 600;
}
.pricing-price { font-size: 2.5rem; font-weight: 700; }
.pricing-feature-list { list-style: none; padding: 0; margin: 1.5rem 0; }
.pricing-feature-list li { padding: .4rem 0; }
.pricing-feature-list li i { color: var(--cal-secondary); margin-right: .5rem; }

/* ---- Dashboard ---- */
.stat-card { border-radius: var(--cal-card-radius); box-shadow: var(--cal-shadow); padding: 1.25rem; background: #fff; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; }
.upgrade-banner {
  background: linear-gradient(135deg, #FFF4E0, #FFE7CC); border-radius: var(--cal-card-radius); padding: 1.25rem;
}
.progress { border-radius: 20px; height: 10px; }

/* ---- Messaging ---- */
.chat-window { height: 60vh; overflow-y: auto; background: #fafafa; border-radius: 12px; padding: 1rem; }
.msg-bubble { max-width: 75%; padding: .6rem 1rem; border-radius: 16px; margin-bottom: .6rem; font-size: .92rem; }
.msg-mine { background: var(--cal-primary); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.msg-theirs { background: #fff; box-shadow: var(--cal-shadow); border-bottom-left-radius: 4px; }
.conv-item { border-radius: 12px; padding: .75rem; transition: background .15s; cursor: pointer; }
.conv-item:hover, .conv-item.active { background: #FFF1EC; }

/* ---- Auth pages ---- */
.auth-card { max-width: 460px; margin: 3rem auto; border-radius: var(--cal-card-radius); box-shadow: var(--cal-shadow-hover); padding: 2.5rem; background: #fff; }

/* ---- Mobile bottom nav ---- */
.mobile-bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; background: #fff; display: flex; justify-content: space-around;
  align-items: center; padding: .5rem 0; box-shadow: 0 -2px 12px rgba(0,0,0,.08); z-index: 1030;
  padding-bottom: calc(.5rem + env(safe-area-inset-bottom));
}
.mobile-bottom-nav a { color: #999; text-decoration: none; text-align: center; font-size: .68rem; flex: 1; }
.mobile-bottom-nav a i { display: block; font-size: 1.3rem; margin-bottom: 2px; }
.mobile-bottom-nav a.active { color: var(--cal-primary); }
.sell-fab {
  background: var(--cal-primary); color: #fff !important; width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin-top: -20px; box-shadow: 0 4px 12px rgba(216,64,43,.4);
  flex: 0 0 48px !important;
}
.sell-fab i { margin: 0 !important; font-size: 1.4rem !important; }

@media (min-width: 992px) { .mobile-bottom-nav { display: none; } }

.app-footer { background: #fff; border-top: 1px solid #eee; margin-top: 3rem; }

/* Utility */
.rating-stars { color: var(--cal-accent); }
.image-upload-preview { width: 90px; height: 90px; object-fit: cover; border-radius: 10px; }
.limit-badge { font-size: .75rem; }
