/* ========================================
   🌗 Modern Vendor Detail + Theme System
   - Enhanced animations, shadows & gradients
======================================== */

/* =========================
   THEME VARIABLES
========================= */
:root {
  --accent-color: #007aff;
  --accent-secondary: #00bcd4;

  /* Vendor detail theme */
  --vd-bg: #ffffff;
  --vd-card-bg: #ffffff;
  --vd-text: #222222;
  --vd-muted: #6c757d;
  --vd-accent: var(--accent-color);
  --vd-shadow: 0 8px 24px rgba(17, 17, 17, 0.08);

  /* Badge text (theme aware) */
  --badge-text-color: #000000; /* default (light theme) */

  /* Loader colors */
  --loader-primary: #000;
  --loader-accent: var(--accent-color);

  /* Global theme */
  --theme-bg: #ffffff;
  --theme-bg-secondary: #f8f9fa;
  --theme-text: #2c3e50;
  --theme-text-muted: #6c757d;
  --theme-border: rgba(0, 0, 0, 0.1);
  --theme-shadow: rgba(0, 0, 0, 0.1);
  --theme-card-bg: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,248,248,0.98));
}

/* Header card entrance and hover lift */
.vendor-header-card {
  transform: translateY(0);
  transition: transform 220ms ease, box-shadow 220ms ease;
  will-change: transform;
}
.modern-vendor-header[data-aos] .vendor-header-card {
  transform: translateY(-6px);
  opacity: 0;
  animation: vendorHeaderIn 420ms ease forwards;
}

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

.vendor-header-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 30px rgba(15,20,35,0.08);
}

/* compact vendor badges */
.vendor-badges .vendor-badge {
  display: inline-flex;
  align-items: center;
  background: var(--vd-badge-bg, rgba(0,0,0,0.04));
  color: var(--vd-badge-color, #222);
  padding: 6px 8px;
  border-radius: 999px;
  font-size: 0.85rem;
}
.vendor-badges .vendor-badge .material-icons {
  font-size: 18px;
  line-height: 1;
}

/* Description clamp on small screens */
.vendor-description-wrapper .vendor-description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.vendor-description-wrapper .readmore-btn {
  padding-left: 0;
  padding-right: 0;
  font-weight: 500;
}
.vendor-description-wrapper.expanded .vendor-description {
  -webkit-line-clamp: unset;
  line-clamp: unset;
}
.vendor-description-wrapper.expanded .readmore-btn::after {
  content: ' ▼';
}
.vendor-description-wrapper .readmore-btn::after {
  content: ' ▶';
}

/* Ensure header right aligns nicely on small widths */
.vendor-header-right { gap: 8px; }


/* =========================
   DARK THEME
========================= */
[data-theme="dark"],
body.dark-mode {
  --vd-bg: #0f1114;
  --vd-card-bg: #111317;
  --vd-text: #e6e6e6;
  --vd-muted: #9aa0a6;
  --vd-accent: var(--accent-color);
  --vd-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);

  /* Badge text in dark theme */
  --badge-text-color: #ffffff;

  --loader-primary: #fff;
  --loader-accent: var(--accent-color);

  --theme-bg: #1a1a1a;
  --theme-bg-secondary: #2d2d2d;
  --theme-text: #e0e0e0;
  --theme-text-muted: #a0a0a0;
  --theme-border: rgba(255, 255, 255, 0.1);
  --theme-shadow: rgba(0, 0, 0, 0.6);
  --theme-card-bg: linear-gradient(180deg, rgba(30,30,30,0.98), rgba(20,20,20,0.98));
}

/* =========================
   LOADER SPINNER
========================= */
.loading-spinner {
  border: 4px solid var(--loader-primary);
  border-top: 4px solid var(--loader-accent);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================
   VENDOR SECTION
========================= */
.modern-vendor-section {
  background: var(--vd-bg);
  color: var(--vd-text);
  padding: 40px 0;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Header + Avatar */
.modern-vendor-header .vendor-avatar .material-icons.storefront {
  font-size: 3.2rem;
  color: var(--vd-accent);
  display: block;
  animation: fadeInScale 1s ease forwards;
}

.vendor-header-inner .vendor-name {
  font-size: 1.6rem;
  margin: 0;
  font-weight: 600;
}

/* Cards */
.vendor-summary-card .modern-card {
  background: var(--vd-card-bg);
  border: none;
  box-shadow: var(--vd-shadow);
  border-radius: 14px;
  transition: all 0.25s ease-in-out;
  position: relative;
  overflow: hidden;
}
.vendor-summary-card .modern-card::after {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(145deg, transparent 60%, rgba(0, 122, 255, 0.05));
  opacity: 0;
  transition: opacity 0.3s ease;
}
.vendor-summary-card .modern-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.18);
}
.vendor-summary-card .modern-card:hover::after {
  opacity: 1;
}

/* Vendor icons */
.vendor-card-avatar .material-icons {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.03), rgba(0, 0, 0, 0.06));
  padding: 10px;
  border-radius: 10px;
  font-size: 1.4rem;
  color: var(--vd-accent);
  transition: transform 0.2s ease;
}
.vendor-card-avatar .material-icons:hover {
  transform: rotate(-8deg) scale(1.1);
}

.vendor-stats li {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* =========================
   PRODUCT GRID + CARDS
========================= */
.products-grid.modern-grid {
  display: grid;
  /* Desktop: 3 equal columns */
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* Medium screens: 2 columns */
@media (max-width: 992px) {
  .products-grid.modern-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

/* Small screens: single column */
@media (max-width: 576px) {
  .products-grid.modern-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.product-card {
  background: var(--vd-card-bg);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(2, 6, 23, 0.08);
  overflow: hidden;
  transition: all 0.3s ease-in-out;
  position: relative;
}
.product-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 55px rgba(2, 6, 23, 0.15);
}
.product-card::after {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(145deg, rgba(0,122,255,0.06), transparent);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.product-card:hover::after {
  opacity: 1;
}

.product-card .product-card-inner {
  background: transparent;
  transition: transform 0.25s ease;
}
.product-card:hover .product-card-inner {
  transform: scale(1.02);
}

/* =========================
   BUTTONS + ACTIONS
========================= */
.vendor-actions .btn {
  box-shadow: none;
  transition: all 0.2s ease;
}
.vendor-actions .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 122, 255, 0.3);
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 992px) {
  .vendor-summary-card { position: static !important; }
  .products-grid.modern-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
  }
}

/* =========================
   SIDEBAR & STICKY RULES
   Keep the primary card visible on desktop scroll
========================= */
.vendor-sidebar { position: relative; }
.vendor-sidebar-inner { position: relative; }
.vendor-sidebar-card { border-radius: 12px; box-shadow: var(--vd-shadow); overflow: hidden; }
.vendor-sidebar-card .vendor-logo { width: 56px; height: 56px; }

@media (min-width: 992px) {
  /* Make the sidebar card sticky within its column */
  #vendorSidebarSticky {
    position: -webkit-sticky;
    position: sticky;
    top: 88px; /* below header */
  }
}

.sidebar-widget .widget-title { font-weight: 600; font-size: 0.95rem; }
.related-vendors-list .small-avatar { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; background: rgba(0,0,0,0.03); }
.related-vendors-list img { width: 36px; height: 36px; object-fit: cover; }
.vendor-reviews .material-icons { font-size: 1.05rem; color: var(--vd-accent); }


/* =========================
   ANIMATIONS
========================= */
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
.aos-init {
  will-change: transform, opacity;
  transition: all 0.3s ease-in-out;
}

/* =========================
   VENDOR BADGES
========================= */
.vendor-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.vendor-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,248,248,0.98));
  border: 1px solid var(--theme-border, rgba(0,0,0,0.08));
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--vd-text);
  box-shadow: 0 6px 18px rgba(2,6,23,0.04);
}
.vendor-badge .material-icons { font-size: 1rem; color: var(--vd-accent); }
.vendor-badge.vendor-badge-verified { background: linear-gradient(90deg, rgba(0,122,255,0.06), rgba(0,187,211,0.03)); border-color: rgba(0,122,255,0.15); }
.vendor-badge .badge-label { font-weight: 500; color: var(--vd-text); }

/* Badge-text: theme aware (light/dark) with transition and subtle hover lift */
.badge-text {
  color: var(--badge-text-color, #000);
  font-weight: 600;
  transition: color 200ms ease, transform 220ms cubic-bezier(.2,.9,.2,1);
  display: inline-block;
}
.vendor-badge:hover .badge-text {
  transform: translateY(-3px);
  color: var(--vd-accent);
}

/* Light/Dark adjustment: use theme CSS variables already defined above */
.vendor-badge { background: var(--vd-card-bg); border-color: var(--theme-border); box-shadow: 0 6px 18px rgba(2,6,23,0.04); }
.vendor-badge.vendor-badge-verified { background: linear-gradient(90deg, rgba(0,122,255,0.06), rgba(0,187,211,0.03)); }

@media (max-width: 576px) {
  .vendor-badges { gap: 6px; }
  .vendor-badge { padding: 5px 8px; font-size: 0.8rem; }
}

/* =========================
   AVATAR + HEADER ANIMATIONS
========================= */
.vendor-avatar { width: 72px; height: 72px; display: flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, rgba(0,122,255,0.04), rgba(0,187,211,0.02)); }
.vendor-avatar .storefront { font-size: 2.2rem; color: var(--vd-accent); }
.vendor-logo { width: 72px; height: 72px; object-fit: cover; display: block; border-radius: 50%; box-shadow: 0 8px 28px rgba(2,6,23,0.08); transition: transform 0.35s ease, box-shadow 0.35s ease; }
.vendor-logo:hover { transform: translateY(-4px) scale(1.03); box-shadow: 0 20px 50px rgba(2,6,23,0.12); }

.modern-vendor-header { padding: 18px 0; }
.vendor-header-inner { gap: 12px; display: flex; align-items: center; justify-content: space-between; }
/* Responsive vendor name: scale between 0.75rem (small) and 1.6rem (large) based on viewport */
.vendor-name { font-size: 0.75rem; letter-spacing: -0.3px; margin: 0; }
.vendor-subtext { max-width: 320px; }

/* Make header stack on small screens and reduce avatar/action sizes */
@media (max-width: 768px) {
  .vendor-header-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .vendor-header-actions { width: 100%; display: flex; justify-content: flex-start; gap: 8px; }
  .vendor-avatar, .vendor-logo { width: 52px; height: 52px; }
  .vendor-name { font-size: clamp(0.75rem, 2.6vw, 1.1rem); }
  .vendor-subtext { max-width: 240px; }
}

@media (max-width: 420px) {
  .vendor-header-inner { gap: 8px; }
  .vendor-name { font-size: 0.75rem; }
  .vendor-avatar, .vendor-logo { width: 44px; height: 44px; }
  .vendor-header-actions { gap: 6px; }
}

/* Mobile-first adjustments for header stacking and tap targets */
@media (max-width: 768px) {
  .modern-vendor-header { padding: 12px 0; }
  .vendor-header-inner { flex-direction: column; align-items: stretch; text-align: left; }
  .vendor-header-inner > div { width: 100%; }
  .vendor-header-inner .vendor-avatar { margin-bottom: 8px; }
  .vendor-header-inner .vendor-name { font-size: 1.15rem; }
  .vendor-header-inner .vendor-meta { margin-bottom: 8px; }
  .vendor-header-right { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .vendor-header-actions { display: flex; justify-content: flex-end; gap: 8px; }
  /* Make badges wrap and remain visible */
  .vendor-badges { flex-wrap: wrap; gap: 6px; }
  /* Make action buttons slightly larger for touch */
  .vendor-header-actions .btn, .vendor-header-actions .btn-icon { width: 44px; height: 44px; }
}

/* Icon-only action buttons */
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border-radius: 10px; }
.btn-icon .material-icons { font-size: 1.05rem; }
.btn-icon.btn-outline-primary { border: 1px solid rgba(0,122,255,0.12); color: var(--vd-accent); }
.btn-icon.btn-light { background: var(--theme-bg-secondary); }
.btn-icon:hover { transform: translateY(-4px); box-shadow: 0 8px 22px rgba(2,6,23,0.08); }

/* Better focus styles for keyboard users */
.btn-icon:focus, .vendor-header-actions .btn:focus, .collapsible-toggle-btn:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(0,122,255,0.12);
  border-radius: 10px;
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .vendor-header-card, .product-card, .vendor-header-actions .btn { transition: none !important; animation: none !important; }
}

/* Subtle badge pulse for verified */
.vendor-badge-verified { position: relative; }
.vendor-badge-verified::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 12px;
  background: radial-gradient(circle at 30% 30%, rgba(0,122,255,0.06), transparent 40%);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.vendor-badge-verified:hover::after { opacity: 1; }

@keyframes floatUp {
  0% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}
.vendor-header-actions .btn { animation: floatUp 3.5s ease-in-out infinite; }

@media (max-width: 768px) {
  .vendor-header-actions { gap: 8px; }
  .vendor-logo, .vendor-avatar { width: 56px; height: 56px; }
  .vendor-subtext { max-width: 240px; font-size: 0.9rem; }
}

/* Compact vendor card variant to avoid duplication with header */
.vendor-card-compact { padding: 0; border-radius: 12px; }
.vendor-card-compact .card-body { padding: 12px; }
.vendor-card-compact .vendor-card-avatar .material-icons { font-size: 1.4rem; color: var(--vd-accent); }
.vendor-card-compact .vendor-badges { gap: 6px; }
.vendor-card-compact .vendor-badge { padding: 5px 8px; font-size: 0.82rem; }

/* Header-integrated compact presentation (merged into vendor header) */
.vendor-header-inner .vendor-name { font-size: 1.35rem; margin-bottom: 0; }
.vendor-header-inner .vendor-meta { margin-top: 2px; }
.vendor-header-inner .vendor-avatar { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; border-radius: 12px; overflow: hidden; background: linear-gradient(135deg, rgba(0,122,255,0.04), rgba(0,187,211,0.02)); }
.vendor-header-inner .vendor-logo { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; }
.vendor-header-inner .vendor-meta .badge { font-size: 0.72rem; padding: 4px 8px; border-radius: 999px; }

@media (max-width: 768px) {
  .vendor-header-inner .vendor-avatar, .vendor-header-inner .vendor-logo { width: 52px; height: 52px; }
  .vendor-header-inner .vendor-name { font-size: 1.1rem; }
}

/* Header card styling */
.vendor-header-card { background: var(--vd-card-bg); box-shadow: 0 12px 36px rgba(2,6,23,0.08); border-radius: 14px; margin-bottom: 14px; }
.vendor-header-card .card-body { padding: 16px 18px; }
.vendor-avatar .vendor-logo, .vendor-header-inner .vendor-logo { border-radius: 12px; }
.vendor-meta h6 { margin: 0 0 6px 0; }
.vendor-header-actions .btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border-radius: 10px; }
.vendor-header-actions .btn .material-icons { font-size: 1.1rem; }

@media (max-width: 768px) {
  .vendor-header-card { box-shadow: 0 8px 20px rgba(2,6,23,0.06); }
  .vendor-header-card .card-body { padding: 12px; }
}


/* =========================
   HORIZONTAL FILTERS BAR
========================= */
.horizontal-filters-collapsible { margin-bottom: 18px; }
.collapsible-toggle-btn { display: inline-flex; align-items: center; gap: 8px; background: transparent; border: none; font-weight: 600; cursor: pointer; }
.collapsible-toggle-btn .material-icons { vertical-align: middle; }
.collapsible-toggle-btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(0,122,255,0.12); border-radius: 8px; }
.collapsible-toggle-btn .toggle-arrow { transition: transform 220ms cubic-bezier(.2,.9,.2,1); display: inline-block; }
.collapsible-toggle-btn.expanded .toggle-arrow { transform: rotate(180deg); }

/* Smooth panel expand/collapse */
.horizontal-filters-wrapper {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 280ms ease, opacity 220ms ease;
}
.horizontal-filters-wrapper.expanded {
  max-height: 420px; /* enough to show the chips; adjust if necessary */
  opacity: 1;
  overflow: visible;
}
.horizontal-filters .filter-chip-select:focus,
.horizontal-filters .filter-price-input:focus,
.horizontal-filters .filter-flag-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0,122,255,0.08);
  border-radius: 8px;
}
.horizontal-filters-wrapper { padding: 10px 0; }
.horizontal-filters { display: flex; gap: 10px; align-items: center; flex-wrap: nowrap; overflow-x: auto; padding: 6px 6px; }
.horizontal-filters .filter-chip-group { display: inline-flex; align-items: center; gap: 8px; background: var(--theme-bg-secondary); border-radius: 10px; padding: 6px 8px; border: 1px solid var(--theme-border); }
.filter-chip-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 6px; background: rgba(0,0,0,0.02); }
.filter-chip-icon .material-icons { font-size: 1rem; color: var(--vd-accent); }
.filter-chip-select { border: none; background: transparent; min-width: 120px; padding: 4px 6px; }
.filter-price-input { width: 80px; border: none; background: transparent; padding: 4px 6px; }
.price-separator { opacity: 0.6; padding: 0 6px; }
.filter-flags-group { display: inline-flex; gap: 6px; }
.filter-flag-btn { display: inline-flex; gap: 6px; align-items: center; border: 1px solid transparent; padding: 6px 10px; border-radius: 999px; background: transparent; cursor: pointer; }
.filter-flag-btn.active { background: linear-gradient(90deg, rgba(0,122,255,0.06), rgba(0,187,211,0.03)); border-color: rgba(0,122,255,0.12); }
.filter-flag-btn .material-icons { font-size: 1rem; }
.filter-clear-btn { display: inline-flex; align-items: center; gap: 8px; margin-left: 8px; background: transparent; border: none; cursor: pointer; }

/* Make horizontal filters collapse on small screens */
@media (max-width: 768px) {
  .horizontal-filters { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .horizontal-filters .filter-chip-group { min-width: 90px; }
}

