/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Arial', sans-serif;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header Styles */
header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 2rem;
  font-weight: bold;
  color: #667eea;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-links a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  transition: all 0.3s ease;
  padding: 0.5rem 1rem;
  border-radius: 25px;
}

.nav-links a:hover, 
.nav-links a.active {
  background: #667eea;
  color: white;
  transform: translateY(-2px);
}

/* User Menu (top-right corner) */
.user-menu {
  margin-left: 20px;
}

.user-menu a {
  color: white;
  background: #ff6b6b;
  padding: 0.5rem 1rem;
  border-radius: 25px;
  text-decoration: none;
  font-weight: bold;
  transition: all 0.3s ease;
}

.user-menu a:hover {
  background: #e63946;
  transform: translateY(-2px);
}

/* Main Content */
main {
  flex: 1;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 4rem 0;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  margin: 2rem 0;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  animation: fadeInUp 1s ease-out;
}

.hero p {
  font-size: 1.3rem;
  margin-bottom: 2rem;
  color: rgba(255, 255, 255, 0.9);
  animation: fadeInUp 1s ease-out 0.2s both;
}

/* Universal Search Styles */
.universal-search {
  margin: 2rem 0;
  animation: fadeInUp 1s ease-out 0.4s both;
}

.search-container {
  display: flex;
  max-width: 800px;
  margin: 0 auto;
  gap: 1rem;
  background: white;
  border-radius: 50px;
  padding: 0.5rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.search-container input {
  flex: 1;
  padding: 1rem 1.5rem;
  border: none;
  border-radius: 40px;
  font-size: 1rem;
  outline: none;
}

.search-container select {
  padding: 1rem;
  border: none;
  border-radius: 25px;
  background: #f8f9fa;
  cursor: pointer;
  outline: none;
}

.search-container button {
  padding: 1rem 2rem;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 40px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-container button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Quick Actions */
.quick-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

/* Button Styles */
.btn-primary {
  background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
  color: white;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  font-weight: bold;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
  animation: fadeInUp 1s ease-out 0.6s both;
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

.btn-secondary {
  background: linear-gradient(45deg, #4ecdc4, #44a08d);
  color: white;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  font-weight: bold;
  box-shadow: 0 4px 15px rgba(78, 205, 196, 0.4);
  animation: fadeInUp 1s ease-out 0.8s both;
}

.btn-secondary:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(78, 205, 196, 0.6);
}

/* Search Results */
.search-results {
  padding: 3rem 0;
  background: rgba(255, 255, 255, 0.95);
  margin: 2rem 0;
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.results-grid {
  display: grid;
  /* FIX: prevent single card from stretching full width and center the grid */
  grid-template-columns: repeat(auto-fit, minmax(260px, 320px));
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
}

.search-result-card {
  background: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: transform 0.3s ease;
  /* FIX: make card a column flex container so button can stick to bottom */
  display: flex;
  flex-direction: column;
}

.search-result-card:hover {
  transform: translateY(-5px);
}

.search-result-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  flex: 0 0 auto;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.search-result-card img:hover {
  opacity: 0.8;
}

.seller-avatar {
  width: 100%;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.result-info {
  padding: 1.5rem;
  /* FIX: allow content to grow and let button push to bottom */
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1 1 auto;
}

.result-type {
  display: inline-block;
  background: #667eea;
  color: white;
  padding: 0.3rem 0.8rem;
  border-radius: 15px;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.search-result-card h3 {
  margin: 0.5rem 0;
  color: #2c3e50;
}

.search-result-card .price {
  font-weight: bold;
  color: #27ae60;
  font-size: 1.1rem;
  margin: 0.5rem 0;
}

.view-btn {
  display: inline-block;
  background: linear-gradient(135deg, #ff6b6b, #ff5252);
  color: white;
  padding: 0.7rem 1.5rem;
  border-radius: 25px;
  text-decoration: none;
  font-weight: bold;
  transition: all 0.3s ease;
}

.view-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
}

.loading, .error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  font-size: 1.2rem;
}

/* Preview Sections */
.preview-section {
  padding: 4rem 0;
  background: rgba(255, 255, 255, 0.95);
  margin: 2rem 0;
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.preview-section.alt-bg {
  background: rgba(255, 255, 255, 0.8);
}

.preview-section h2 {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 3rem;
  color: #333;
  position: relative;
}

.preview-section h2::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 4px;
  background: linear-gradient(45deg, #667eea, #764ba2);
  border-radius: 2px;
}

.grid-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.card {
  background: white;
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  text-align: center;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: all 0.5s ease;
}

.card:hover::before {
  left: 100%;
}

.card:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.card-image {
  width: 100%;
  height: 150px;
  background: linear-gradient(45deg, #ff9a9e, #fecfef);
  border-radius: 15px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}

.card h3 {
  font-size: 1.5rem;
  font-weight: bold;
  color: #333;
  margin-bottom: 0.5rem;
}

.card p {
  color: #666;
  margin-bottom: 0.5rem;
}

.center-btn {
  text-align: center;
}

/* Contact Section */
.contact {
  padding: 4rem 0;
  background: rgba(0, 0, 0, 0.1);
  text-align: center;
  color: white;
  margin: 2rem 0;
  border-radius: 20px;
}

.contact h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: white;
}

.contact p {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.9);
}

/* Footer */
footer {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  text-align: center;
  padding: 2rem 0;
  margin-top: auto;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: white;
  margin: 5% auto;
  padding: 0;
  border-radius: 20px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.3s ease;
  overflow: hidden;
}

.modal-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 2rem;
  text-align: center;
  position: relative;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.8rem;
}

.close {
  position: absolute;
  right: 20px;
  top: 20px;
  color: white;
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.close:hover {
  transform: scale(1.2);
}

.modal-body {
  padding: 2rem;
}

.auth-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.auth-tab {
  flex: 1;
  padding: 0.8rem;
  border: none;
  background: #f8f9fa;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.auth-tab.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #333;
}

.form-group input {
  width: 100%;
  padding: 0.8rem;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
}

.submit-btn {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.forgot-password {
  text-align: center;
  margin-top: 1rem;
}

.forgot-password a {
  color: #667eea;
  text-decoration: none;
}

/* Image Modal - Full Picture Only */
#imageModal .modal-content {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  margin: 2% auto;
}

#imageModal .modal-header {
  display: none;
}

#imageModal .modal-body {
  padding: 0 !important;
  background: transparent;
}

#imageModal .close {
  position: fixed;
  top: 20px;
  right: 30px;
  font-size: 40px;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  z-index: 1001;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.5);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

#imageModal .close:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

#imageModal #modalImage {
  border-radius: 0;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

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

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

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

/* Responsive Design */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero p {
    font-size: 1.1rem;
  }

  .grid-preview {
    grid-template-columns: 1fr;
  }

  .search-container {
    flex-direction: column;
    border-radius: 20px;
  }
  
  .search-container input,
  .search-container select,
  .search-container button {
    border-radius: 15px;
  }
  
  .results-grid {
    /* two columns on tablets, still centered */
    grid-template-columns: repeat(2, minmax(0, 320px));
    justify-content: center;
  }

  .quick-actions {
    flex-direction: column;
    align-items: center;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    max-width: 300px;
  }
}

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

  .hero {
    padding: 2rem 0;
    margin: 1rem 0;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .preview-section {
    padding: 2rem 0;
  }

  .preview-section h2 {
    font-size: 2rem;
  }

  .card {
    padding: 1rem;
  }

  .card-image {
    height: 120px;
    font-size: 3rem;
  }

  .results-grid {
    grid-template-columns: 1fr; /* single column on phones */
    justify-content: stretch;
  }
}

/* Seller Banner Styles */
.seller-banner {
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  padding: 1rem 1.5rem;
  border-radius: 15px;
  margin-bottom: 1rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  border: 1px solid rgba(102, 126, 234, 0.3);
}

.seller-icon {
  font-size: 2rem;
  margin-right: 1rem;
  color: #667eea;
}

.seller-name {
  font-size: 1.2rem;
  font-weight: bold;
  margin-right: auto;
  color: #2c3e50;
}

.seller-count {
  background: #667eea;
  color: white;
  padding: 0.3rem 0.8rem;
  border-radius: 25px;
  font-size: 0.9rem;
  margin-right: 1rem;
}

.view-seller-btn {
  background: linear-gradient(135deg, #ff6b6b, #ff5252);
  color: white;
  padding: 0.5rem 1.5rem;
  border-radius: 25px;
  text-decoration: none;
  font-weight: bold;
  transition: all 0.3s ease;
}

.view-seller-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

/* Seller Tabs */
.seller-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 25px;
  background: #f8f9fa;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.tab-btn.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.tab-btn:hover:not(.active) {
  background: #e9ecef;
}

.seller-info {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.seller-info a {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
}

.seller-info a:hover {
  text-decoration: underline;
}

/* Responsive for seller elements */
@media (max-width: 768px) {
  .seller-banner {
    flex-wrap: wrap;
  }
  
  .seller-name {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  .seller-count {
    margin-left: auto;
  }
  
  .view-seller-btn {
    width: 100%;
    margin-top: 0.5rem;
    text-align: center;
  }
  
  .seller-tabs {
    justify-content: center;
  }
}

.add-to-cart-btn {
  display: inline-block;
  background: linear-gradient(135deg, #ff6b6b, #ff5252);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 25px;
  text-decoration: none;
  font-weight: bold;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: center;
  /* FIX: push button to the bottom of the card */
  margin-top: auto;
}

.add-to-cart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

/* Seller Card Styles */
.seller-card {
  display: flex;
  align-items: center;
  background: white;
  border-radius: 15px;
  padding: 1rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  margin-bottom: 0.5rem;
  grid-column: 1 / -1;
  transition: transform 0.3s ease;
}

.seller-card:hover {
  transform: translateY(-3px);
}

.seller-card .seller-icon {
  background: #f1f5f9;
  color: #667eea;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-right: 1rem;
}

.seller-card .seller-info {
  flex-grow: 1;
}

.seller-card .seller-name {
  font-weight: bold;
  color: #2c3e50;
  margin: 0;
}

.seller-items {
  display: inline-block;
  background: #667eea;
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 15px;
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

.view-all-link {
  color: #667eea;
  text-decoration: none;
  font-weight: bold;
  margin-left: auto;
  padding: 0.5rem 1rem;
  border: 1px solid #667eea;
  border-radius: 25px;
  transition: all 0.3s ease;
}

.view-all-link:hover {
  background: #667eea;
  color: white;
}

/* Pagination Styles */
.pagination {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pagination-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 25px;
  background: #f8f9fa;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.pagination-btn.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.pagination-btn:hover:not(.active) {
  background: #e9ecef;
}

.pagination-card {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  background: white;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
  .search-container {
    flex-direction: column;
    border-radius: 20px;
  }
  
  .search-container input,
  .search-container select,
  .search-container button {
    border-radius: 15px;
  }
  
  .results-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .pagination-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }
  
  .seller-card {
    flex-direction: column;
    text-align: center;
  }
  
  .seller-card .seller-icon {
    margin-right: 0;
    margin-bottom: 0.5rem;
  }
  
  .seller-card .seller-info {
    margin-bottom: 0.5rem;
  }
  
  .view-all-link {
    margin-left: 0;
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .results-grid {
    grid-template-columns: 1fr;
  }
  
  #imageModal .close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 30px;
  }
}