html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  padding-top: 76px; /* Space for fixed navbar */
}

/* Fixed Navbar Styling */
.navbar.fixed-top {
  z-index: 1030;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* UTS Marketplace Styles */

/* Compact Header */
.compact-header {
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}

.compact-header h2 {
  color: #1a1a1a;
  font-size: 1.75rem;
}

/* Compact Search Bar */
.search-bar-compact {
  background: white;
  border-radius: 24px;
  padding: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #f0f0f0;
}

.search-input {
  border: none;
  border-radius: 20px;
  padding: 12px 20px;
  font-size: 0.95rem;
  background: #f8f9fa;
}

.search-input:focus {
  background: white;
  border: none;
  box-shadow: none;
}


.btn-search {
  background: #ff4757;
  border: none;
  border-radius: 20px;
  color: white;
  padding: 12px 20px;
  transition: all 0.2s ease;
}

.btn-search:hover {
  background: #ff3742;
  transform: scale(1.05);
}

/* Category Chips */
.categories-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.categories-scroll::-webkit-scrollbar {
  display: none;
}

.category-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8f9fa;
  color: #666;
  padding: 10px 16px;
  border-radius: 24px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.category-chip:hover {
  background: #ff4757;
  color: white;
  text-decoration: none;
  transform: translateY(-1px);
}

.category-chip i {
  font-size: 1rem;
}

/* Category Cards */
.category-card {
  transition: all 0.3s ease;
  color: inherit;
}

.category-card:hover {
  transform: translateY(-5px);
  text-decoration: none;
  color: inherit;
}

.category-card .card {
  border: 2px solid transparent;
  border-radius: 15px;
  transition: all 0.3s ease;
  background: #fff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.category-card:hover .card {
  border-color: #ff4757;
  box-shadow: 0 8px 25px rgba(255, 71, 87, 0.15);
}

.category-card .card-body {
  padding: 2rem 1.5rem;
}

.category-card i {
  color: #ff4757;
  margin-bottom: 1rem;
}

.category-card h5 {
  color: #2c3e50;
  font-weight: 600;
}

/* Fixed-Size Card Grid System */
.listings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 2rem;
  align-items: start;
}

/* Mobile - 1 column with fixed card size */
@media (min-width: 480px) {
  .listings-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

/* Tablet - 3 columns with consistent spacing */
@media (min-width: 768px) {
  .listings-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Desktop - 4 columns with optimal spacing */
@media (min-width: 1024px) {
  .listings-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Large Desktop - maintain 4 columns */
@media (min-width: 1400px) {
  .listings-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    max-width: 1300px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Fixed Card Container */
.masonry-item {
  display: flex;
  width: 100%;
  height: 350px; /* Fixed height for mobile */
}

/* Listing Card Link Wrapper */
.listing-card-link {
  display: flex;
  width: 100%;
  height: 100%;
  text-decoration: none !important;
  color: inherit;
}

.listing-card-link:hover {
  text-decoration: none !important;
  color: inherit;
}

.listing-card-link:focus {
  text-decoration: none !important;
  outline: none;
}

/* Listing Card - Fixed Size Design */
.listing-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.listing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Fixed Image Container */
.listing-image-container {
  position: relative;
  overflow: hidden;
  height: 200px; /* Fixed height for mobile */
  flex-shrink: 0;
}

.listing-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.3s ease;
}

.listing-card:hover .listing-image {
  transform: scale(1.05);
}

.listing-image-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #adb5bd;
  font-size: 2.5rem;
}

/* Overlay Tags */
.listing-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

.price-tag {
  background: rgba(0, 0, 0, 0.75);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

.category-tag {
  background: rgba(255, 71, 87, 0.9);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  backdrop-filter: blur(10px);
}

/* Fixed Content Area */
.listing-content {
  padding: 12px 16px 16px 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  height: 150px; /* Fixed content height for mobile */
  justify-content: space-between;
}

.listing-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 6px 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.6rem; /* Fixed height for exactly 2 lines */
  text-overflow: ellipsis;
}

.listing-description {
  font-size: 0.8rem;
  color: #666;
  margin: 0 0 12px 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.6rem; /* Fixed height for exactly 2 lines */
  text-overflow: ellipsis;
  flex-grow: 1;
}

/* Fixed Footer */
.listing-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  height: 2.5rem; /* Fixed footer height */
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.user-avatar {
  color: #ff4757;
  font-size: 1.25rem;
}

.user-name {
  font-size: 0.8rem;
  color: #666;
  font-weight: 500;
}

.listing-actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f8f9fa;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  text-decoration: none;
}

.action-btn:hover {
  background: #ff4757;
  color: white;
  transform: scale(1.1);
}


.view-btn:hover {
  background: #007bff;
  color: white;
}

/* Custom Button Styles */
.btn-primary {
  background: linear-gradient(135deg, #ff4757 0%, #ff3742 100%);
  border: none;
  border-radius: 10px;
  padding: 12px 30px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #ff3742 0%, #ff2f3a 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 71, 87, 0.3);
}

.btn-outline-primary {
  border: 2px solid #ff4757;
  color: #ff4757;
  border-radius: 10px;
  padding: 12px 30px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-outline-primary:hover {
  background: #ff4757;
  border-color: #ff4757;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 71, 87, 0.3);
}

/* Form Controls */
.form-control-lg, .form-select-lg {
  border-radius: 10px;
  border: 2px solid #e9ecef;
  padding: 15px 20px;
  transition: all 0.3s ease;
}

.form-control-lg:focus, .form-select-lg:focus {
  border-color: #ff4757;
  box-shadow: 0 0 0 0.2rem rgba(255, 71, 87, 0.25);
}

/* Why Choose Section */
.why-choose {
  background: #f8f9fa;
  padding: 80px 0;
}

/* Authentication Cards */
.auth-card {
  background: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.1);
  margin: 60px 0;
  border: 1px solid rgba(255, 71, 87, 0.1);
}

.auth-icon {
  font-size: 3rem;
  color: #ff4757;
  margin-bottom: 1rem;
}

.auth-title {
  color: #2c3e50;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.form-label {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 0.75rem;
}

.form-label i {
  color: #ff4757;
  width: 16px;
}

/* Alert Styling */
.alert-danger {
  background: rgba(255, 71, 87, 0.1);
  border: 1px solid rgba(255, 71, 87, 0.3);
  color: #ff4757;
  border-radius: 10px;
}

/* Authentication Link Styling */
.auth-card a {
  color: #ff4757;
  font-weight: 600;
  transition: all 0.3s ease;
}

.auth-card a:hover {
  color: #ff3742;
  text-decoration: underline !important;
}

/* Form Validation Styling */
.form-control.is-invalid {
  border-color: #dc3545;
  background-image: none;
}

.form-control.is-valid {
  border-color: #28a745;
  background-image: none;
}

.invalid-feedback {
  display: block;
  color: #dc3545;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.valid-feedback {
  display: block;
  color: #28a745;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Form Text Styling */
.form-text {
  color: #6c757d;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Checkbox Styling */
.form-check-input:checked {
  background-color: #ff4757;
  border-color: #ff4757;
}

.form-check-input:focus {
  border-color: #ff4757;
  box-shadow: 0 0 0 0.2rem rgba(255, 71, 87, 0.25);
}

.form-check-label {
  color: #2c3e50;
  font-size: 0.9rem;
}

/* Responsive Card Dimensions */
/* Mobile devices (480px+) */
@media (min-width: 480px) {
  .masonry-item {
    height: 360px;
  }
  
  .listing-image-container {
    height: 220px;
  }
  
  .listing-content {
    height: 140px;
  }
}

/* Tablet devices (768px+) */
@media (min-width: 768px) {
  .masonry-item {
    height: 380px;
  }
  
  .listing-image-container {
    height: 240px;
  }
  
  .listing-content {
    height: 140px;
    padding: 14px 16px 16px 16px;
  }
  
  .listing-title {
    font-size: 1rem;
    height: 2.6rem;
  }
  
  .listing-description {
    font-size: 0.85rem;
    height: 2.6rem;
  }
}

/* Desktop devices (1024px+) */
@media (min-width: 1024px) {
  .masonry-item {
    height: 400px;
  }
  
  .listing-image-container {
    height: 250px;
  }
  
  .listing-content {
    height: 150px;
    padding: 16px;
  }
  
  .listing-title {
    font-size: 1rem;
    margin-bottom: 8px;
  }
  
  .listing-description {
    font-size: 0.875rem;
    margin-bottom: 16px;
  }
}

/* Large desktop (1400px+) */
@media (min-width: 1400px) {
  .masonry-item {
    height: 420px;
  }
  
  .listing-image-container {
    height: 260px;
  }
  
  .listing-content {
    height: 160px;
    padding: 18px;
  }
}

/* Mobile-specific adjustments */
@media (max-width: 767px) {
  body {
    padding-top: 70px;
  }
  
  .compact-header h2 {
    font-size: 1.5rem;
  }
  
  .compact-header .col-md-6:last-child {
    text-align: left !important;
    margin-top: 1rem;
  }
  
  .search-bar-compact .d-flex {
    flex-direction: column;
    gap: 8px !important;
  }
  
  .search-input, .category-select, .btn-search {
    width: 100%;
  }
  
  .listings-grid {
    gap: 12px;
  }
  
  .listing-card {
    border-radius: 12px;
  }
  
  .auth-card {
    margin: 30px 0;
    padding: 30px 20px;
  }
  
  .category-chip {
    font-size: 0.85rem;
    padding: 8px 14px;
  }
}

@media (max-width: 479px) {
  .listings-grid {
    gap: 8px;
    margin-top: 1rem;
  }
  
  .compact-header .container {
    padding: 0 16px;
  }
  
  .search-bar-compact {
    margin: 0 16px;
  }
  
  .listing-card {
    border-radius: 8px;
  }
  
  .listing-content {
    padding: 10px;
  }
  
  .listing-title {
    font-size: 0.9rem;
  }
  
  .listing-description {
    font-size: 0.8rem;
  }
}


/* Dark Theme Support */
.dark-theme {
  background-color: #1a1a1a;
  color: #e0e0e0;
}

.dark-theme .navbar.fixed-top {
  background: rgba(26, 26, 26, 0.95) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-theme .compact-header {
  background: #1a1a1a;
  border-bottom: 1px solid #333;
}

.dark-theme .compact-header h2 {
  color: #f5f5f5;
}

.dark-theme .compact-header p {
  color: #d0d0d0 !important;
}

/* Dark theme text elements */
.dark-theme .text-muted {
  color: #d0d0d0 !important;
}

.dark-theme .text-primary {
  color: #ff6b7a !important;
}

.dark-theme h1,
.dark-theme h2,
.dark-theme h3,
.dark-theme h4,
.dark-theme h5,
.dark-theme h6 {
  color: #f5f5f5 !important;
}

.dark-theme p {
  color: #d0d0d0;
}

.dark-theme strong {
  color: #ffffff;
}

.dark-theme small {
  color: #c0c0c0;
}

.dark-theme .d-inline-flex span {
  color: #d0d0d0;
}

.dark-theme .d-inline-flex strong {
  color: #ffffff;
}

.dark-theme .search-bar-compact {
  background: #2d2d2d;
  border: 1px solid #444;
}

.dark-theme .search-input {
  background: #333;
  color: #e0e0e0;
  border: none;
}

.dark-theme .search-input:focus {
  background: #2d2d2d;
  color: #e0e0e0;
}

.dark-theme .search-input::placeholder {
  color: #888;
}

.dark-theme .category-chip {
  background: #2d2d2d;
  color: #f0f0f0;
  border: 1px solid #444;
}

.dark-theme .category-chip:hover,
.dark-theme .category-chip.active {
  background: #ff4757;
  color: white;
}

.dark-theme .listing-card {
  background: #2d2d2d;
  border: 1px solid #444;
}

.dark-theme .listing-card:hover {
  box-shadow: 0 8px 25px rgba(255, 71, 87, 0.2);
}

.dark-theme .listing-title {
  color: #f5f5f5;
}

.dark-theme .listing-description {
  color: #d0d0d0;
}

.dark-theme .user-name {
  color: #e8e8e8;
}

.dark-theme .action-btn {
  background: #333;
  color: #e0e0e0;
}

.dark-theme .action-btn:hover {
  background: #ff4757;
  color: white;
}

.dark-theme .listing-details-card {
  background: #2d2d2d;
  border: 1px solid #444;
}

.dark-theme .seller-card {
  background: #333;
  border: 1px solid #444;
}

.dark-theme .form-control,
.dark-theme .form-select {
  background: #333;
  border: 1px solid #444;
  color: #e0e0e0;
}

.dark-theme .form-control:focus,
.dark-theme .form-select:focus {
  background: #2d2d2d;
  border-color: #ff4757;
  color: #e0e0e0;
}

.dark-theme .form-control::placeholder {
  color: #888;
}

.dark-theme .search-filters-card {
  background: #2d2d2d;
  border: 1px solid #444;
}

.dark-theme .auth-card {
  background: #2d2d2d;
  border: 1px solid #444;
}

.dark-theme .auth-title {
  color: #f5f5f5;
}

.dark-theme .form-label {
  color: #f0f0f0;
}

.dark-theme .navbar-brand,
.dark-theme .nav-link {
  color: #f5f5f5 !important;
}

.dark-theme .nav-link:hover {
  color: #ff4757 !important;
}

/* Dark theme: Create Listing page */
.dark-theme .create-listing-card {
  background: #2d2d2d !important;
  border: 1px solid #444;
}

.dark-theme .create-listing-card .card-header h3 {
  color: #f5f5f5;
}

.dark-theme .create-listing-card .card-header p {
  color: #d0d0d0 !important;
}

.dark-theme .fw-semibold {
  color: #f0f0f0;
}

.dark-theme .form-text {
  color: #aaa !important;
}

.dark-theme .form-check-label {
  color: #d0d0d0;
}

.dark-theme .form-check-label a {
  color: #ff6b7a !important;
}

.dark-theme .tips-card {
  background: #333 !important;
  border: 1px solid #444;
}

.dark-theme .tips-list li {
  color: #d0d0d0 !important;
}

.dark-theme .input-group-text {
  background: #444;
  border: 1px solid #555;
  color: #e0e0e0;
}

.dark-theme textarea.form-control::placeholder,
.dark-theme input.form-control::placeholder {
  color: #888 !important;
}

.dark-theme .text-success {
  color: #4caf50 !important;
}

.dark-theme .text-danger {
  color: #ff6b7a !important;
}

/* Dark theme: Profile page */
.dark-theme .card {
  background: #2d2d2d !important;
  border-color: #444 !important;
}

.dark-theme .card-body {
  background: transparent;
}

.dark-theme .card-title {
  color: #f5f5f5 !important;
}

.dark-theme .card-text {
  color: #d0d0d0 !important;
}

.dark-theme .card-text strong {
  color: #ff6b7a !important;
}

.dark-theme .card .bg-light {
  background: #333 !important;
}

.dark-theme .text-success {
  color: #4caf50 !important;
}

/* Dark theme: My Listings table */
.dark-theme .table {
  color: #e0e0e0;
  border-color: #444;
  background-color: transparent;
}

.dark-theme .table tbody tr {
  background-color: transparent;
}

.dark-theme .table-hover tbody tr:hover {
  background-color: #3a3a3a !important;
}

.dark-theme .table-light,
.dark-theme .table thead {
  background-color: #333 !important;
  color: #f5f5f5 !important;
  border-color: #444 !important;
}

.dark-theme .table thead th {
  color: #f5f5f5 !important;
  border-bottom-color: #444 !important;
}

.dark-theme .table td,
.dark-theme .table th {
  border-color: #444;
  background-color: transparent;
}

.dark-theme .table tbody td {
  color: #e0e0e0;
}

.dark-theme .table td strong {
  color: #f0f0f0 !important;
}

.dark-theme .table td .text-primary {
  color: #ff6b7a !important;
}

.dark-theme .table .bg-light {
  background: #333 !important;
}

.dark-theme .table .text-muted,
.dark-theme .table td small.text-muted {
  color: #aaa !important;
}

.dark-theme .text-info {
  color: #5bc0de !important;
}

.dark-theme .text-warning {
  color: #ffc107 !important;
}

.dark-theme .badge.bg-info {
  background-color: #17a2b8 !important;
  color: white !important;
}

.dark-theme .badge.bg-success {
  background-color: #28a745 !important;
  color: white !important;
}

.dark-theme .badge.bg-primary {
  background-color: #007bff !important;
  color: white !important;
}

/* Dark theme: Messages List page */
.dark-theme .conversation-item {
  border-bottom-color: #444 !important;
  transition: background-color 0.3s ease;
}

.dark-theme .conversation-item:hover {
  background-color: #3a3a3a !important;
}

.dark-theme .conversation-item .text-dark {
  color: #f5f5f5 !important;
}

.dark-theme .conversation-item .bg-light {
  background: #333 !important;
}

.dark-theme .conversation-item .text-muted {
  color: #aaa !important;
}

.dark-theme .conversation-item strong {
  color: #e0e0e0 !important;
}

.dark-theme .conversation-item .price-tag {
  background: rgba(255, 71, 87, 0.2);
  color: #ff6b7a;
}

/* Dark theme: Conversation/Messages page */
.dark-theme .message-bubble.bg-light {
  background: #3a3a3a !important;
  color: #e0e0e0;
  transition: all 0.3s ease;
}

.dark-theme .message-bubble.bg-light:hover {
  background: #454545 !important;
  box-shadow: 0 4px 12px rgba(255, 71, 87, 0.15);
}

.dark-theme .message-bubble.bg-primary {
  background: #ff4757 !important;
  color: white;
  transition: all 0.3s ease;
}

.dark-theme .message-bubble.bg-primary:hover {
  background: #ff5868 !important;
  box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

.dark-theme .message-bubble .text-muted {
  color: #aaa !important;
}

.dark-theme .translated-message {
  border-top-color: rgba(255, 255, 255, 0.2) !important;
}

.dark-theme .text-white-50 {
  color: rgba(255, 255, 255, 0.7) !important;
}

.dark-theme .btn-link {
  color: #ff6b7a !important;
  transition: all 0.2s ease;
}

.dark-theme .btn-link:hover {
  color: #ff4757 !important;
  opacity: 1 !important;
  text-decoration: underline !important;
}

.dark-theme .translate-btn {
  opacity: 0.7;
}

.dark-theme .translate-btn:hover {
  opacity: 1 !important;
  transform: scale(1.05);
}

.dark-theme .messages-container {
  background: transparent;
}

.dark-theme .message:hover .translate-btn {
  opacity: 0.9;
}

.dark-theme .english-message {
  color: #aaa !important;
}

/* Enhanced Animations and Micro-interactions */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes bounce {
  0%, 20%, 53%, 80%, 100% { transform: translateY(0); }
  40%, 43% { transform: translateY(-15px); }
  70% { transform: translateY(-7px); }
  90% { transform: translateY(-3px); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px rgba(255, 71, 87, 0.5); }
  50% { box-shadow: 0 0 20px rgba(255, 71, 87, 0.8), 0 0 30px rgba(255, 71, 87, 0.6); }
}

/* Staggered animations for grid items */
.masonry-item {
  animation: fadeInUp 0.6s ease forwards;
}

.masonry-item:nth-child(1) { animation-delay: 0.1s; }
.masonry-item:nth-child(2) { animation-delay: 0.2s; }
.masonry-item:nth-child(3) { animation-delay: 0.3s; }
.masonry-item:nth-child(4) { animation-delay: 0.4s; }
.masonry-item:nth-child(5) { animation-delay: 0.5s; }
.masonry-item:nth-child(6) { animation-delay: 0.6s; }

/* Enhanced button interactions */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
  width: 300px;
  height: 300px;
}

/* Enhanced listing card interactions */
.listing-card {
  will-change: transform;
}

.listing-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255, 71, 87, 0.1) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.listing-card:hover::before {
  opacity: 1;
}

/* Category chip hover effects */
.category-chip {
  position: relative;
  overflow: hidden;
}

.category-chip::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.category-chip:hover::before {
  left: 100%;
}

/* Search input focus effects */
.search-input {
  transition: all 0.3s ease;
}

.search-input:focus {
  animation: glow 2s ease-in-out infinite;
}

/* Action button enhanced animations */
.action-btn {
  position: relative;
  overflow: hidden;
}

.action-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
}

.action-btn:active::after {
  width: 40px;
  height: 40px;
}

/* Navbar scroll effect */
.navbar.fixed-top {
  transition: all 0.3s ease;
}

.navbar.scrolled {
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

/* Form validation animations */
.form-control.is-invalid {
  animation: shake 0.5s ease-in-out;
}

.form-control.is-valid {
  animation: pulse 0.5s ease-in-out;
}

/* Loading spinner enhancement */
@keyframes spinEnhanced {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

.loading-spinner {
  animation: spinEnhanced 1s ease-in-out infinite !important;
}

/* Theme toggle enhanced animation */
.theme-toggle {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: 0 6px 20px rgba(255, 71, 87, 0.4);
}

.theme-toggle:active {
  transform: scale(0.95) rotate(-15deg);
}


/* Skeleton loading enhanced effect */
.skeleton {
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Enhanced image lazy loading */
.listing-image.lazy {
  filter: blur(5px);
  transition: all 0.3s ease;
}

.listing-image.loaded {
  filter: blur(0);
}

/* Mobile-specific enhancements */
@media (max-width: 767px) {
  .listing-card {
    transform: scale(1);
    transition: transform 0.2s ease;
  }
  
  .listing-card:active {
    transform: scale(0.98);
  }
  
  .action-btn:active {
    transform: scale(0.9);
  }
  
  .category-chip:active {
    transform: scale(0.95);
  }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .listing-card:hover {
    transform: none;
  }
  
  .action-btn:hover {
    transform: none;
  }
}

/* Search Filters Card */
.search-filters-card {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #f0f0f0;
  margin-bottom: 1rem;
}

/* Category Chip Active State */
.category-chip.active {
  background: #ff4757;
  color: white;
  border-color: #ff4757;
}

/* Listing Details Styles */
.listing-detail-image {
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  max-height: 500px;
  object-fit: cover;
}

.thumbnail-gallery {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem 0;
}

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

.thumbnail:hover,
.thumbnail.active {
  opacity: 1;
  border-color: #ff4757;
}

.listing-details-card {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  height: fit-content;
  position: sticky;
  top: 100px;
}

.price-main {
  font-size: 2rem;
  font-weight: 700;
  color: #ff4757;
}

.seller-card {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid #e9ecef;
}

.seller-avatar {
  font-size: 2.5rem;
  color: #ff4757;
}

.seller-rating .bi-star-fill {
  color: #ffc107;
}

.seller-rating .bi-star {
  color: #dee2e6;
}

.no-image-placeholder {
  background: #f8f9fa;
  border-radius: 16px;
  height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #6c757d;
}

/* Empty State */
.empty-state {
  padding: 3rem 1rem;
}

.empty-state i {
  opacity: 0.5;
}

/* Pagination */
.pagination .page-link {
  border-radius: 8px;
  margin: 0 2px;
  border: 1px solid #dee2e6;
  color: #6c757d;
  transition: all 0.2s ease;
}

.pagination .page-link:hover {
  background-color: #ff4757;
  border-color: #ff4757;
  color: white;
}

.pagination .page-item.active .page-link {
  background-color: #ff4757;
  border-color: #ff4757;
  color: white;
}

/* Form Styling Enhancements */
.form-control,
.form-select {
  border-radius: 10px;
  border: 1px solid #dee2e6;
  padding: 0.75rem 1rem;
  transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: #ff4757;
  box-shadow: 0 0 0 0.2rem rgba(255, 71, 87, 0.25);
}

/* Responsive adjustments for new components */
@media (max-width: 767px) {
  .listing-details-card {
    position: static;
    margin-top: 1rem;
    padding: 1.5rem;
  }
  
  .price-main {
    font-size: 1.5rem;
  }
  
  .search-filters-card {
    padding: 1rem;
  }
  
  .search-filters-card .row > .col-md-2,
  .search-filters-card .row > .col-md-4 {
    margin-bottom: 1rem;
  }
  
  .thumbnail-gallery {
    justify-content: center;
  }
  
  .seller-card {
    text-align: center;
  }
}