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

:root {
  --primary: #1c6ef2;
  --secondary: #f4f6fa;
  --accent: #ffb800;
  --text-primary: #1d1d1d;
  --text-secondary: #4b4b4b;
  --success: #4ad77c;
  --danger: #ff4d4d;
  --border: #e5e7eb;
  --white: #ffffff;
}

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: "Inter", "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--secondary);
  color: var(--text-primary);
  /* Add margin-top to body to prevent navbar overlap on all pages */
  margin-top: 70px;
  /* Make body a column flex container so footer can sit at the bottom when content is short */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Mobile-only elements hidden by default on desktop */
.mobile-only {
  display: none !important;
}

/* Ensure desktop search is visible on large screens */
.search-bar.desktop-search {
  display: flex !important;
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--secondary);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  padding: 12px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.navbar-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.navbar-left {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 700;
  color: var(--primary);
  font-size: 18px;
  width: 144px;
  height: 48px;
  overflow: hidden;
}

.logo-icon {
  font-size: 20px;
  color: var(--accent);
}

/* Logo image sizing */
.logo-image {
  height: 140px; /* larger navbar logo */
  width: auto;
  display: block;
  object-fit: cover;
  object-position: 30% 40%;
}

/* Larger logo for auth pages */
.login-card .logo .logo-image,
.signup-card .logo .logo-image {
  height: 110px;
}

/* Responsive adjustments */
@media (max-width: 800px) {
  .logo-image {
   height: 120px;
    width: 125px;
  }
  .login-card .logo .logo-image,
  .signup-card .logo .logo-image {
    height: 88px;
  }
}

/* Larger mobile logo and prevent cropping on small screens */
@media (max-width: 480px) {
  .logo {
    /* allow the logo container to grow so larger image isn't cropped */
    width: auto;
    height: auto;
    overflow: visible;
  }
  .logo-image {
    height: 51px; 
    object-position: 30% 50%;
    width: 80px;/* larger on phones so it remains visible */
  }
  .login-card .logo .logo-image,
  .signup-card .logo .logo-image {
    height: 100px;
  }
}

.navbar-center {
  flex: 1;
  max-width: 400px;
}

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.3s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
}

.search-icon {
  position: absolute;
  right: 12px;
  font-size: 14px;
  color: var(--text-secondary);
  pointer-events: none;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.navbar-item {
  position: relative;
}

.nav-link,
.nav-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  font-size: 14px;
  transition: color 0.3s ease;
}

.nav-link:hover,
.nav-button:hover {
  color: var(--primary);
}

.badge {
  display: inline-block;
  background: var(--accent);
  color: var(--white);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
}

.wallet-balance {
  font-weight: 600;
  color: white;
}

/* Dropdowns */
.notifications-dropdown,
.profile-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
  margin-top: 8px;
  min-width: 250px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}

.navbar-item.active .notifications-dropdown,
.navbar-item.active .profile-dropdown {
  opacity: 1;
  visibility: visible;
}

.notifications-list {
  max-height: 300px;
  overflow-y: auto;
}

.notifications-item,
.dropdown-item {
  display: block;
  padding: 12px 16px;
  color: var(--text-primary);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.2s ease;
  font-size: 14px;
}

.notifications-item:hover,
.dropdown-item:hover {
  background: var(--secondary);
}

.logout-item {
  color: var(--danger);
}

.empty-notifications {
  padding: 20px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

/* Mobile Menu */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  margin-right: 12px;
  transition: color 0.3s ease;
}

.mobile-menu-btn:hover {
  color: var(--primary);
}

.mobile-menu-dropdown {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 99;
  max-height: 0;
  overflow: hidden;
}

.mobile-menu-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  max-height: 400px;
}

.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s ease;
  font-size: 15px;
}

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

.mobile-menu-item:hover {
  background: var(--secondary);
}

.mobile-menu-item span:first-child {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

.desktop-only {
  display: flex;
}

/* Main Content */
.main-content {
  padding: 40px 0;
  flex: 1;
}

.container {
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* Category Filter */
.category-filter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  flex-wrap: wrap;
  gap: 20px;
}

.filter-container {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 10px 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: 500;
}

.filter-btn.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-btn.active:hover {
  background: var(--primary);
}

.sort-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 14px;
}

.sort-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Products Grid */
.products-section {
  margin-bottom: 60px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}

.product-card {
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: all 0.3s ease;
  /* start hidden so adding .fade-in will animate from invisible -> visible */
  opacity: 0;
}
.product-card.fade-in {
  animation: fadeIn 0.35s ease-out forwards;
}

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


.product-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.product-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--secondary);
}

.product-card-body {
  padding: 16px;
}

.product-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.4;
}

.product-card-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.product-card-vendor {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.product-card-location {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Pagination Styles */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 40px;
  padding: 20px 0;
}

.pagination-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(28, 110, 242, 0.2);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--secondary);
}

.pagination-pages {
  display: flex;
  gap: 6px;
  align-items: center;
}

.pagination-page {
  min-width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagination-page:hover {
  background: var(--secondary);
  border-color: var(--primary);
}

.pagination-page.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.pagination-ellipsis {
  padding: 0 8px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: slideInUp 0.3s ease;
}

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

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: var(--secondary);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-primary);
  transition: all 0.3s ease;
  z-index: 10;
}

.modal-close:hover {
  background: var(--border);
}

.product-details-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding: 40px;
}

.product-gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gallery-main {
  width: 100%;
  height: 300px;
  background: var(--secondary);
  border-radius: 12px;
  overflow: hidden;
}

.main-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 4px;
}

.thumbnail {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  cursor: pointer;
  object-fit: cover;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.thumbnail.active {
  border-color: var(--accent);
}

.thumbnail:hover {
  opacity: 0.8;
}

.product-info {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.product-info h1 {
  font-size: 28px;
  color: var(--text-primary);
  line-height: 1.3;
}

.product-price {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}

.product-rating {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stars {
  color: var(--accent);
  font-size: 16px;
}

.review-count {
  font-size: 14px;
  color: var(--text-secondary);
}

.product-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px;
  background: var(--secondary);
  border-radius: 8px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.product-description h3 {
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.product-description p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.product-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
  background: var(--secondary);
  border-radius: 8px;
}

.detail-item {
  display: flex;
  flex-direction: column;
}

.detail-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.detail-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
}

.vendor-section h3 {
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.vendor-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--secondary);
  border-radius: 8px;
}

.vendor-profile {
  display: flex;
  gap: 12px;
  align-items: center;
}

.vendor-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
}

.vendor-info h4 {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.vendor-info p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.vendor-rating {
  display: flex;
  align-items: center;
}

/* Added quantity selector styles */
.quantity-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: var(--secondary);
  border-radius: 8px;
  margin-bottom: 12px;
}

.quantity-selector label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.quantity-input {
  width: 60px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
}

.quantity-input:focus {
  outline: none;
  border-color: var(--primary);
}

.product-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-primary,
.btn-secondary {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--white);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(255, 184, 0, 0.3);
}

.btn-secondary {
  background: var(--primary);
  color: var(--white);
  border: 1px solid var(--primary);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(28, 110, 242, 0.3);
}

/* Added styles for product engagement and reviews sections */
.product-engagement {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px;
  background: var(--secondary);
  border-radius: 8px;
  margin-bottom: 12px;
}

.like-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  border: 2px solid var(--accent);
  color: var(--accent);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  font-size: 14px;
}

.like-btn:hover {
  background: var(--accent);
  color: var(--white);
}

.like-btn.liked {
  background: var(--accent);
  color: var(--white);
}

.engagement-stat {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.reviews-section {
  padding: 16px;
  background: var(--secondary);
  border-radius: 8px;
  margin-top: 20px;
}

.reviews-section h3 {
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.comment-item {
  padding: 12px;
  background: var(--white);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.comment-header strong {
  font-size: 13px;
  color: var(--text-primary);
}

.comment-rating {
  font-size: 12px;
  color: var(--accent);
}

.comment-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 6px;
}

.comment-time {
  font-size: 11px;
  color: var(--text-secondary);
}

.no-comments {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  padding: 20px;
}

/* TikTok-style video viewer styles */
.video-viewer-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85); /* Slightly more transparent */
  backdrop-filter: blur(8px); /* Blur the content behind */
  -webkit-backdrop-filter: blur(8px); /* Safari support */
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overscroll-behavior: contain; /* Prevent scroll chaining */
  touch-action: none; /* Disable default touch actions */
}

body.video-active {
  overflow: hidden; /* Prevent body scroll when video is active */
}

.video-viewer-modal.active {
  display: flex;
}

.video-viewer-container {
  display: flex;
  width: 100%;
  max-width: 1200px;
  height: 90vh;
  gap: 20px;
  position: relative;
}

.video-player-area {
  flex: 1;
  position: relative;
  background: var(--secondary);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.3);
  border: none;
  color: var(--white);
  font-size: 24px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
}

.video-nav-btn:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: translateY(-50%) scale(1.1);
}

.prev-btn {
  left: 20px;
}

.next-btn {
  right: 20px;
}

.video-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: var(--white);
  font-size: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
}

.video-close-btn:hover {
  background: rgba(0, 0, 0, 0.8);
}

.video-sidebar {
  width: 320px;
  background: var(--white);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.video-header h3 {
  font-size: 16px;
  color: var(--text-primary);
  margin: 0;
}

.video-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  background: var(--secondary);
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 18px;
}

.video-action-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.video-action-btn.liked {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
}

.action-icon {
  font-size: 20px;
}

.action-count {
  font-weight: 600;
  font-size: 16px;
}

.comments-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comments-area h4 {
  font-size: 14px;
  color: var(--text-primary);
  margin: 0;
}

.comments-list {
  /* Increased height to show more comments before scrolling */
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment-item-video {
  padding: 10px;
  background: var(--secondary);
  border-radius: 8px;
  font-size: 13px;
}

.comment-author {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.comment-text {
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 4px;
}

.comment-time {
  font-size: 11px;
  color: var(--text-secondary);
}

.no-comments {
  text-align: center;
  color: var(--text-secondary);
  padding: 20px 0;
  font-size: 13px;
}

.comment-input-area {
  display: flex;
  gap: 8px;
  /* Align start so taller textarea doesn't center the button vertically */
  align-items: flex-start;
}

.video-comment-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  /* Make the comment input taller and resizable vertically */
  min-height: 66px;
  resize: vertical;
}

.video-comment-input:focus {
  outline: none;
  border-color: var(--primary);
}

.comment-submit-btn {
  padding: 10px 16px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  transition: all 0.3s ease;
}

.comment-submit-btn:hover {
  background: #1555d0;
}

.video-stats-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--secondary);
  border-radius: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}

.stat-row span:last-child {
  font-weight: 600;
  color: var(--text-primary);
}

.video-add-to-cart-btn {
  padding: 12px;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.video-add-to-cart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(255, 184, 0, 0.3);
}

.video-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: var(--white);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
}

/* Chat Bubble */
.chat-bubble {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 150;
}

.chat-bubble-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: var(--white);
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 184, 0, 0.3);
  transition: all 0.3s ease;
}

.chat-bubble-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 20px rgba(255, 184, 0, 0.4);
}

.chat-widget {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 320px;
  height: 400px;
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slideInUp 0.3s ease;
}

.chat-widget.active {
  display: flex;
}

.chat-header {
  background: var(--accent);
  color: var(--white);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h3 {
  font-size: 14px;
  margin: 0;
}

.close-chat {
  background: none;
  border: none;
  color: var(--white);
  font-size: 20px;
  cursor: pointer;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  display: flex;
  max-width: 80%;
  animation: fadeIn 0.3s ease;
}

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

.bot-message {
  justify-content: flex-start;
}

.bot-message p {
  background: var(--secondary);
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.user-message {
  justify-content: flex-end;
}

.user-message p {
  background: var(--primary);
  color: var(--white);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.chat-input-area {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
}

.chat-input:focus {
  outline: none;
  border-color: var(--primary);
}

.chat-send-btn {
  background: var(--accent);
  border: none;
  color: var(--white);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
}

.chat-send-btn:hover {
  background: #e6a700;
}

/* Footer */
.footer {
  background: var(--secondary);
  border-top: 1px solid var(--border);
  padding: 40px 20px 20px;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 40px;
  margin-bottom: 30px;
}

.footer-section h4 {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 12px;
  font-weight: 600;
}

.footer-section a {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 8px;
  transition: color 0.3s ease;
}

.footer-section a:hover {
  color: var(--primary);
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

/* Mobile Search Container (Hidden on Desktop) */
.mobile-search-container {
  display: none;
}

/* Responsive */
@media (max-width: 800px) {
  .navbar {
    padding: 10px 15px;
  }

  /* Mobile Search Styles */
  .mobile-search-container {
    display: none;
    width: 100%;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--secondary);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 99;
    animation: slideDown 0.2s ease-out;
  }

  .mobile-search-container.active {
    display: block;
  }

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

  .mobile-only {
    display: block !important;
  }

  .nav-button.search-toggle-btn {
    font-size: 18px;
    padding: 6px;
    background: none;
    border: none;
    cursor: pointer;
  }

  .navbar-content {
    gap: 12px;
  }

  .navbar-center {
    display: none;
  }

  .navbar-right {
    gap: 8px;
  }

  /* Show mobile menu button, hide desktop nav items */
  .mobile-menu-btn {
    display: block;
    margin-right: 8px;
  }

  .desktop-only {
    display: none !important;
  }

  .nav-link,
  .nav-button {
    padding: 6px 8px;
    font-size: 14px;
  }

  /* Hide text labels on mobile, show only icons */
  .nav-text {
    display: none;
  }

  .wallet-item .nav-link {
    font-size: 16px;
  }

  .logo-text {
    font-size: 16px;
  }

  .logo-icon {
    font-size: 18px;
  }

  /* Adjust dropdowns for mobile */
  .notifications-dropdown,
  .profile-dropdown {
    min-width: 200px;
    right: -10px;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
  }

  /* Ensure products section sizing works on tablets/phones */
  .products-section {
    /* reset desktop min-width to prevent mobile overflow */
    min-width: 0;
    max-width: 100%;
    margin-bottom: 40px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .product-details-container {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
  }

  .category-filter {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Pagination tablet responsive */
  .pagination-container {
    gap: 10px;
  }

  .pagination-btn {
    padding: 9px 14px;
    font-size: 13px;
  }

  .pagination-page {
    min-width: 36px;
    height: 36px;
    font-size: 13px;
  }

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

  .chat-widget {
    width: 100%;
    height: 300px;
    bottom: 0;
    right: 0;
    border-radius: 12px 12px 0 0;
  }

  .footer-content {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  .video-viewer-container {
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    margin: 0;
    gap: 0;
  }

  .video-viewer-modal {
    padding: 0;
  }

  .video-player-area {
    min-height: auto;
    height: 55%;
    flex: none;
    border-radius: 0;
    width: 100%;
  }

  .video-player {
    object-fit: contain;
    background: #000;
  }

  .video-sidebar {
    width: 100%;
    height: 45%;
    flex: 1;
    border-radius: 20px 20px 0 0;
    margin-top: -20px;
    z-index: 5;
    background: var(--white);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
  }

  .comments-area {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 70px; /* Space for input area */
  }

  .comment-input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    padding: 10px;
    border-top: 1px solid var(--border);
    z-index: 10;
  }

  .video-close-btn {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.5);
    z-index: 20;
  }

  .video-nav-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
    background: rgba(0, 0, 0, 0.4);
  }

  .prev-btn { left: 10px; }
  .next-btn { right: 10px; }
}

@media (max-width: 480px) {
  .navbar {
    padding: 8px 10px;
  }

  .navbar-content {
    gap: 8px;
  }

  .navbar-right {
    gap: 6px;
  }

  .nav-link,
  .nav-button {
    padding: 4px 6px;
    font-size: 18px;
  }

  .logo {
    font-size: 14px;
    gap: 6px;
  }

  .logo-icon {
    font-size: 16px;
  }

  .badge {
    width: 16px;
    height: 16px;
    font-size: 9px;
    margin-left: 2px;
  }

  /* Make wallet balance smaller on very small screens */
  .wallet-balance {
    font-size: 13px;
  }

  /* Optimize dropdowns for small screens */
  .notifications-dropdown,
  .profile-dropdown {
    min-width: 180px;
    max-width: 90vw;
    right: -5px;
  }

  .main-content {
    padding: 20px 10px;
    /* keep main content flexible on small screens as well */
    flex: 1;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
  }

  /* Make products section full-width-friendly on small phones */
  .products-section {
    /* reset desktop min-width to prevent mobile overflow */
    min-width: 0;
    max-width: 100%;
    margin-bottom: 32px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .filter-container {
    gap: 8px;
  }

  .filter-btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  /* Pagination responsive styles */
  .pagination-container {
    gap: 8px;
    padding: 15px 0;
  }

  .pagination-btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .pagination-btn span {
    display: none;
  }

  .pagination-page {
    min-width: 32px;
    height: 32px;
    font-size: 12px;
    padding: 0 8px;
  }

  .pagination-pages {
    gap: 4px;
  }

  /* Desktop-only wide layout: apply min-width only on very large viewports so tablets don't overflow */
}

@media (min-width: 1400px) {
  .products-section {
    min-width: 1400px;
    margin-left: auto;
    margin-right: auto;
  }

  /* Mobile video viewer optimizations */
  .video-player-area {
    min-height: 250px;
  }

  .video-close-btn {
    width: 36px;
    height: 36px;
    font-size: 20px;
    top: 10px;
    right: 10px;
  }

  .video-nav-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .prev-btn {
    left: 10px;
  }

  .next-btn {
    right: 10px;
  }
}

