
:root {
  --primary: #4d7c0f;
  --secondary: #fb8b24;
  --accent: #f97316;
  --error: #e53935;
  --font: 16px;
  --font-small: 14px;
  --light: #f8f9fa;
  --dark: #212529;
  --success: #28a745;
  --shadow: rgba(0, 0, 0, 0.1);
}

html {
  scroll-behavior: smooth;
  overscroll-behavior-block: contain;
}

* , *::before, *::after{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  text-decoration: none;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: var(--font);
  color: var(--dark);
  line-height: 1.6;
  background-color: var(--light);
  font-weight: normal;
  overflow-x: hidden;
}

ul {
  list-style: none;
}

img {
  vertical-align: middle;
  width: 100%;
  height: auto;
  object-fit: cover;
  object-position: center;
  cursor: pointer;
}

p {
  font-size: inherit;
  font-weight: 500;
  line-height: 26px;
  margin-block: .5rem;
}

p strong {
  font-size: 19px;
  font-style: italic;
}

.header .header-content {
  background-color: var(--primary);
  color: var(--light);
  padding: 4px 20px;
  display: grid;
  align-items: center;
  justify-content: center;
}

.header-content p {
  font-size: 1.4rem;
  font-weight: 600;
  text-align: center;
}

.navbar {
  padding: 20px 50px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  background-color: #4d7c0f1a;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0 20px;
}

.logo-image {
  width: 120px;
  height: 140px;
}

.logo h1 {
  font-size: 3.5rem;
  font-weight: 600;
  color: var(--primary);
}

.logo h1 span {
  color: var(--accent);
}

/* Base container */
.search-bar {
  display: flex;
  justify-content: center;
  margin: 2rem 1rem;
}

/* Form container */
.search-bar form {
  width: 100%;
}

/* Label wraps the input for accessibility */
.search-container {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
}

/* Input field styling */
.search-container input[type="text"] {
  width: 100%;
  padding: 0.75rem 1.25rem;
  border: 1px solid #ccc;
  border-radius: 999px;
  font-size: 1rem;
  transition: border-color 0.3s, box-shadow 0.3s;
  outline: none;
  background-color: #fff;
  -webkit-border-radius: 999px;
  -moz-border-radius: 999px;
  -ms-border-radius: 999px;
  -o-border-radius: 999px;
}

/* Focus state */
.search-container input[type="text"]:focus {
  border-color: #4d7c0f; /* blue-500 */
  box-shadow: 0 0 0 3px rgba(77, 124, 15, 0.3);
}

/* Optional: Add a magnifying glass icon via background */
.search-container::before {
  content: "🔍";
  position: absolute;
  left: 1rem;
  margin-bottom: 3px;
  font-size: 1.2rem;
  color: #888;
  pointer-events: none;
}

/* Adjust padding to leave space for icon */
.search-container input[type="text"] {
  padding-left: 2.8rem;
}

/* complementary time */
.navbar .time {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 0 20px;
}

.time  i {
  font-size: 2rem;
  color: var(--error);
}

.main-content {
  padding-bottom: 400px;
}

.category-bar {
  width: 100%; 
  padding: 10px 20px;
  background-color: #ccc;
  display: grid;
  align-items: center;
  justify-content: center;
}

.category-btn-wrapper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.category-btn {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: none;
  background: #4d7c0f;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  scroll-snap-align: start;
  transition: background 0.2s, color 0.2s;
  -webkit-border-radius: 8px;
  -moz-border-radius: 8px;
  -ms-border-radius: 8px;
  -o-border-radius: 8px;
}

.category-btn:hover {
  background: #3f6212;
}

.category-btn.active {
  background: #f97316;
  color: #fff;
}


.featured-products {
  padding: 20px;
  margin-top: 0px;
  max-width: 1536px;
  margin: 0 auto;
}

.featured-products h2 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 60px;
  color: var(--primary);
}

.product-grid {
  display: grid;
  gap: 30px;
}

.product-card {
  background: #fff;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: scale(0.95);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  opacity: 0;
  animation: fadeIn 1s forwards;
}

.product-card:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.product-image-container {
  position: relative;
  isolation: isolate;
}

.product-image {
  width: 100%;
  height: 400px;
  object-fit: cover;
}

.product-weight {
  position: absolute;
  top: 10px;
  left: 10px;
  display: grid;
  align-items: center;
  justify-content: center;
  background-color: var(--primary);
  color: var(--light);
  font-size: var(--font-small);
  border-radius: 50%;
  font-weight: bold;
  padding: 10px;
  -webkit-border-radius: 50%;
  -moz-border-radius: 50%;
  -ms-border-radius: 50%;
  -o-border-radius: 50%;
}

.product-agelimit {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: grid;
  align-items: center;
  justify-content: center;
  background-color: var(--error);
  color: var(--light);
  font-size: var(--font);
  border-radius: 20%;
  font-weight: bold;
  padding: 8px;
  -webkit-border-radius: 20%;
  -moz-border-radius: 20%;
  -ms-border-radius: 20%;
  -o-border-radius: 20%;
}

.product-info {
  padding: 15px;
  text-align: left;
}

.product-title {
  font-size: 1.5rem;
  margin-bottom: 8px;
  text-transform: capitalize;
  color: #333;
}

.product-korean {
  font-size: 1.2rem;
  margin-bottom: 8px;
  color: #666;
}

.product-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0px 10px;
  margin-top: 10px;
}

.stock-info {
  font-size: 1.2rem;
  text-wrap: nowrap;
  white-space: nowrap;
  color: var(--error);
  font-weight: bold;
}

.stock-info.in-stock {
  color: var(--success);
}

.stock-sold {
  font-size: 1rem;
  text-wrap: nowrap;
  white-space: nowrap;
  color: var(--dark);
  font-weight: 500;
}

.product-price-container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.product-prices {
  display: flex;
  align-items: center;
  gap: 10px;
}

.product-sale-price {
  text-wrap: nowrap;
  white-space: nowrap;
  font-size: 1.5rem;
  color: var(--accent);
  font-weight: bold;
}

.product-original-price {
  font-size: 1.2rem;
  text-wrap: nowrap;
  white-space: nowrap;
  color: #999;
  text-decoration: line-through;
}

.rating {
  font-size: 0.9rem;
  text-wrap: nowrap;
  white-space: nowrap;
  color: var(--dark);
  padding: 5px 10px;
  border-radius: 5px;
  font-weight: 600;
}

/* Fade-in animation */
@keyframes fadeIn {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.footer {
  background-color: #111;
  color: #eee;
  padding: 40px 20px;
  text-align: center;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
}

.info-text {
  font-size: 1.2rem;
  margin-bottom: 10px;
  line-height: 1.5;
}

.invite-text {
  font-size: 1rem;
  margin-bottom: 20px;
  color: #ccc;
}

.social-media {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}

.social-icon {
  width: 40px;
  height: 40px;
  background-color: #333;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.3s;
}

.social-icon img {
  width: 24px;
  height: 24px;
  filter: invert(1);
}

.social-icon:hover {
  background-color: #555;
}

/* Loading states for images */
.product-image.loading {
  opacity: 0.7;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.product-image.loaded {
  opacity: 1;
  transition: opacity 0.3s ease;
}

.product-image.error {
  opacity: 0.5;
  filter: grayscale(100%);
}

/* Image loading spinner */
.image-loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #333;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: none;
}

.product-image.loading + .image-loading-spinner {
  display: block;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Staggered animation for product cards */
.product-card {
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
  transform: translateY(20px);
}

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

/* Gallery transitioning state */
.gallery-image.transitioning {
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

/* Enhanced hover effects */
.product-card:hover .product-image {
  transform: scale(1.05);
  transition: transform 0.3s ease;
}

/* Error handling styles */
.error-message {
  background: #fee;
  border: 1px solid #fcc;
  color: #c33;
  padding: 20px;
  margin: 20px;
  border-radius: 8px;
  text-align: center;
}

.error-message button {
  background: #c33;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 10px;
}

.error-message button:hover {
  background: #a22;
}

/* Accessibility improvements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus indicators */
.product-card:focus,
.social-icon:focus,
button:focus {
  outline: 2px solid #4d7c0f;
  outline-offset: 2px;
}

/* Notification styles */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
}

.notification {
  background: #333;
  color: white;
  padding: 12px 20px;
  margin-bottom: 10px;
  border-radius: 4px;
  animation: slideIn 0.3s ease;
  max-width: 300px;
}

.notification.success { background: #4caf50; }
.notification.error { background: #f44336; }
.notification.warning { background: #ff9800; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Connection status styles */
.connection-status {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 9999;
  transition: all 0.3s ease;
}

.connection-status.online {
  background: #4caf50;
  color: white;
}

.connection-status.offline {
  background: #f44336;
  color: white;
}

/* Preload indicator */
.preload-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 10px 15px;
  border-radius: 20px;
  font-size: 12px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 8px;
}

.preload-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff33;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Enhanced focus management */
*:focus {
  outline: 2px solid #4d7c0f;
  outline-offset: 2px;
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #000;
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 10001;
}

.skip-link:focus {
  top: 6px;
}

#backToTop {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.75rem 1rem;
  font-size: 1.25rem;
  background-color: rgba(77, 124, 15, 0.5); /* blue-500 */
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none; /* hidden by default */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  transition: opacity 0.3s ease;
}

#backToTop:hover {
  background-color: var(--primary);
}


/* ================== Responsive Design ================== */

@media (max-width: 599px) {
  .navbar {
    grid-template-columns: 1fr;
    gap: 10px;
    text-align: center;
  }

  /* .logo {
    justify-content: center;
    align-items: center;
    display: grid;
  } */

  .logo-image {
    width: 60px;
    height: 80px;
  }
  
  .logo h1 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary);
  }

  .search-bar {
    width: 100%;
    max-width: 350px;
    margin-inline: auto;
  }

  .navbar .time {
    justify-content: center;
  }

  .product-image {
    height: auto;
  }

  .product-title {
    font-size: 1.3rem;
  }

  .product-sale-price {
    font-size: 1.2rem;
  }
}

/* Small devices (phones) */
@media (max-width: 600px) {

  .controls button {
    font-size: 1.5rem;
    padding: 8px 16px;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }

  .product-card {
    height: auto;
  }

  .footer-content {
    padding: 10px;
  }

  .social-media {
    gap: 10px;
  }
}

/* Medium devices (tablets) */
@media (min-width: 1025px) and (max-width: 1440px)  {

  .navbar {
    grid-template-columns: 1fr;
    gap: 10px;
    text-align: center;
  }

  .logo {
    justify-content: center;
    align-items: center;
    display: grid;
  }

  .logo-image {
    margin-inline: auto;
  }
  
  .logo h1 {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--primary);
  }

  .search-bar {
    width: 100%;
    max-width: 90vw;
    margin-inline: auto;
  }

  .navbar .time {
    justify-content: center;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }

  .product-image {
    height: 400px;
  }
}

/* Large devices (small laptops) */
@media (min-width: 1025px) and (max-width: 1440px) {

  .navbar {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    text-align: center;
  }
  
  .logo h1 {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--primary);
  }

  .search-bar {
    width: 100%;
  }

  .category-btn-wrapper  {
   grid-template-columns: repeat(8, 1fr);
  } 

  .navbar .time {
    justify-content: right;
    grid-column: 1/-1;
  }

  .product-grid {
    grid-template-columns: repeat(3, minmax(250px, 1fr));
  }
}

/* Extra large devices (large desktops, TVs) */
@media (min-width: 1441px) {

  .product-grid {
    grid-template-columns: repeat(3, minmax(300px, 1fr));
  }

  .category-btn-wrapper  {
   grid-template-columns: repeat(10, 1fr);
  } 

  .product-image {
    height: 500px;
  }
}
/* ================== End of Responsive Design ================== */