:root {
  --background-color: #0a041a; /* Deep space blue/purple */
  --text-color: #e0e0e0;
  --primary-color: #00bfff; /* DeepSkyBlue */
  --primary-hover-color: #87cefa; /* LightSkyBlue */
  --card-background: rgba(22, 16, 54, 0.6); /* Translucent dark purple/blue */
  --card-border-color: rgba(0, 191, 255, 0.25);
  --glass-blur: blur(10px);
  --font-family: 'Poppins', sans-serif;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px; /* Adjust for sticky nav height */
}

body {
  font-family: var(--font-family);
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  cursor: none;
  display: flex;
  flex-direction: column;
}

/* Custom Cursor */
#cursor-dot, #cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 9999;
  border-radius: 50%;
  will-change: top, left;
}

#cursor-dot {
  width: 8px;
  height: 8px;
  background-color: var(--primary-color);
}

#cursor-ring {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(0, 191, 255, 0.5);
  transition: top 0.12s ease-out, left 0.12s ease-out, 
              width 0.3s ease, height 0.3s ease, 
              border-color 0.3s ease, border-width 0.3s ease;
}

#cursor-ring.cursor-hover {
  width: 60px;
  height: 60px;
  border-color: var(--primary-hover-color);
  border-width: 3px;
}

/* Ensure interactive elements also hide cursor */
a, button, input, textarea, [class*="-card"], [class*="-tag"], .nav-toggle, .modal-close, .smart-suggestion-item {
    cursor: none;
}


body.no-scroll {
  overflow: hidden;
}

header {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--card-border-color);
  /* Add padding to push content below the now-fixed nav */
  padding-top: 4.5rem;
}

#particle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Navigation Bar */
nav {
  background-color: transparent;
  padding: 0.5rem 1rem;
  position: fixed; /* Changed from sticky to fixed for true viewport stickiness */
  top: 0;
  left: 0; /* Add to ensure it spans full width */
  z-index: 1000;
  width: 100%;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.5rem 1rem;
  background: var(--card-background);
  border: 1px solid var(--card-border-color);
  border-radius: 12px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  z-index: 2; /* Above canvas */
  position: relative;
  margin-top: 1rem;
  transition: border-radius 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  /* Add user-select none to prevent text selection interfering with swipe */
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.nav-container.is-rounded {
    border-radius: 50px;
}

.nav-logo {
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--primary-color);
  text-decoration: none;
  text-shadow: 0 0 5px var(--primary-color);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Mobile Menu Toggle (Hamburger) */
.nav-toggle {
  display: flex; 
  flex-direction: column;
  justify-content: space-around;
  width: 2rem;
  height: 2rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.nav-toggle span {
  width: 2rem;
  height: 0.25rem;
  background: var(--text-color);
  border-radius: 10px;
  transition: all 0.3s linear;
  position: relative;
  transform-origin: 1px;
}

/* Mobile Menu Styles (Hidden by default) */
.nav-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(10, 4, 26, 0.8);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.nav-menu.is-active {
  display: flex;
}

.nav-menu ul {
  list-style: none;
  text-align: center;
}

.nav-menu li {
  margin: 2rem 0;
}

.nav-menu a {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.3s ease, text-shadow 0.3s ease;
  padding: 0.5rem;
}

.nav-menu a:hover {
  color: var(--primary-color);
  text-shadow: 0 0 10px var(--primary-color);
}

/* Hamburger animation */
.nav-toggle.is-active span {
    background: var(--primary-color);
}
.nav-toggle.is-active span:nth-child(1) {
  transform: rotate(45deg);
}
.nav-toggle.is-active span:nth-child(2) {
  opacity: 0;
  transform: translateX(20px);
}
.nav-toggle.is-active span:nth-child(3) {
  transform: rotate(-45deg);
}


/* Header Content */
.header-content {
  position: relative;
  z-index: 2; /* Above canvas */
  text-align: center;
  /* Adjust top padding to account for header's new padding-top */
  padding: 4rem 1rem 10rem;
}

.header-content h1 {
  font-weight: 600;
  font-size: 3rem;
  margin-bottom: 0.5rem;
  color: #fff;
  text-shadow: 0 0 15px rgba(0, 191, 255, 0.7);
}

.header-content p {
  color: #c0c0c0;
  margin-bottom: 2rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  font-size: 1.1rem;
}

main {
  flex-grow: 1;
  padding: 0 1rem 2rem;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.loading-spinner,
#loading-spinner {
  border: 4px solid rgba(0, 191, 255, 0.2);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

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

.initial-message {
  grid-column: 1 / -1;
  text-align: center;
  color: #a0a0a0;
  font-size: 1.1rem;
  padding: 2rem;
}

.search-assist-message {
    grid-column: 1 / -1;
    text-align: center;
    color: #c0c0c0;
    font-size: 1.1rem;
    padding: 1rem 2rem;
    background: var(--card-background);
    border: 1px solid var(--card-border-color);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}
.search-assist-message strong {
    color: var(--primary-hover-color);
}

/* Search Section */
#search-section {
    margin-top: -6rem; /* Pull section up to overlap header a bit */
    margin-bottom: 3rem;
    position: relative;
    z-index: 10;
}

.search-section-wrapper {
    background: var(--card-background);
    border: 1px solid var(--card-border-color);
    border-radius: 16px;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

#search-section h2 {
    font-size: 1.8rem;
    font-weight: 600;
    text-align: center;
    color: var(--primary-hover-color);
    margin-bottom: 1.5rem;
}

.search-container {
    display: flex;
    width: 100%;
    max-width: 700px;
    margin: 0 auto 2rem;
    gap: 0.5rem;
}

#search-input {
    flex-grow: 1;
    padding: 0.85rem 1.25rem;
    font-size: 1.1rem;
    border: 1px solid var(--card-border-color);
    background-color: rgba(0,0,0,0.3);
    color: var(--text-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 191, 255, 0.5);
}

#search-button {
    padding: 0.85rem 1.25rem;
    background-color: var(--primary-color);
    color: var(--background-color);
    border: none;
    border-radius: 8px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}
#search-button:hover {
    background-color: var(--primary-hover-color);
    box-shadow: 0 0 10px var(--primary-color);
    animation: wobble 0.7s ease-in-out;
}

#search-button span {
    display: none; /* Hidden on mobile */
}

/* Addons Section (Suggestions + Recent) */
.search-addons-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--card-border-color);
}

#suggestions-section h3,
#recent-searches-section h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--primary-hover-color);
  text-align: left;
}

/* Smart Suggestions */
.smart-suggestions-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.smart-suggestion-item {
    background: rgba(255,255,255, 0.05);
    border: 1px solid var(--card-border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    text-align: left;
}

.smart-suggestion-item:hover,
.smart-suggestion-item:focus {
    transform: translateY(-3px);
    box-shadow: 0 0 10px var(--card-border-color);
    border-color: var(--primary-hover-color);
    outline: none;
}

.suggestion-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    flex-grow: 1;
}

.trend-icon {
    width: 40px;
    height: 20px;
    flex-shrink: 0;
}

.trend-icon svg {
    width: 100%;
    height: 100%;
}

.trend-icon polyline {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: draw-trend 2s ease-in-out forwards;
}

.smart-suggestion-item:hover .trend-icon polyline {
    animation: draw-trend-hover 2s ease-in-out infinite alternate;
}

@keyframes draw-trend {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes draw-trend-hover {
  from {
    stroke-dashoffset: 100;
  }
  to {
    stroke-dashoffset: 0;
  }
}

.suggestion-trend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.trend-score {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color);
    text-shadow: 0 0 5px var(--primary-color);
    animation: pulse-score 2s infinite ease-in-out;
}

@keyframes pulse-score {
    0%, 100% {
        transform: scale(1);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}


/* Recently Searched Section */
.recent-searches {
  /* No special styles needed now, part of the grid */
}

#recent-searches-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.75rem;
}

.recent-search-tag {
  background-color: var(--card-background);
  color: var(--text-color);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid var(--card-border-color);
  transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
  font-family: inherit;
}

.recent-search-tag:hover {
  background-color: var(--primary-color);
  color: #0a041a;
  box-shadow: 0 0 10px var(--primary-color);
}


/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: 1fr; /* Default for mobile */
}

.product-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.product-card, .article-card, .testimonial-card, .contact-form-container {
  background: var(--card-background);
  border: 1px solid var(--card-border-color);
  border-radius: 12px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}

.product-card:hover, .article-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0 20px var(--card-border-color);
}

.product-card {
  display: flex;
  flex-direction: column;
}

.product-image-container {
  position: relative;
  overflow: hidden; /* Clips the image inside */
}

.product-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background-color: rgba(0,0,0,0.3);
  display: block; /* To remove bottom space */
}

.product-type {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background-color: var(--primary-color);
  color: var(--background-color);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: capitalize;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  z-index: 5;
}

.product-status {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  background-color: #5a6268;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: capitalize;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  z-index: 5;
}

.product-status[data-status="còn-hàng"] {
  background-color: #28a745;
  color: white;
}

.product-status[data-status="hết-hàng"] {
  background-color: #dc3545;
  color: white;
}

.product-status[data-status="sắp-về"] {
  background-color: #17a2b8;
  color: white;
}

.product-status[data-status="đặt-trước"] {
  background-color: #ffc107;
  color: var(--background-color);
}

.product-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  min-height: 3.5rem; /* Reserve space for 2 lines of text */
}

.product-card p {
  color: #c0c0c0;
  font-size: 0.9rem;
  flex-grow: 1;
  margin: 0.5rem 0 1rem;
}

.product-price {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-color);
  text-shadow: 0 0 5px var(--primary-color);
}

.product-footer {
  margin-top: auto;
  padding-top: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end; /* Align items to the bottom */
  gap: 1rem;
}

.product-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.product-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap; /* Allow wrapping if space is tight */
}

.product-rating {
    color: #ffc107; /* A nice gold color for stars */
    font-size: 1rem;
    letter-spacing: 2px;
    line-height: 1;
}

.product-clicks {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #a0a0a0;
    font-size: 0.85rem;
    line-height: 1;
}

.product-clicks svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
}


.product-link, .article-link, .cta-button {
  padding: 0.5rem 1rem;
  background-color: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
  white-space: nowrap;
}

.product-link:hover, .article-link:hover, .cta-button:hover {
  background-color: var(--primary-color);
  color: #0a041a;
  box-shadow: 0 0 10px var(--primary-color);
  animation: wobble 0.7s ease-in-out;
}

/* Recently Viewed Section */
.recently-viewed {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--card-border-color);
}

.recently-viewed h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--primary-color);
  text-shadow: 0 0 5px var(--primary-color);
}

#recently-viewed-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.recent-product-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card-background);
  border: 1px solid var(--card-border-color);
  border-radius: 8px;
  padding: 0.5rem;
  width: 240px;
  transition: all 0.3s ease;
}

.recent-product-card:hover,
.recent-product-card:focus {
  transform: translateY(-3px);
  box-shadow: 0 0 15px var(--card-border-color);
  border-color: var(--primary-hover-color);
  outline: none;
}

.recent-product-logo {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background-color: rgba(0,0,0,0.3);
}

.recent-product-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* New Content Sections */
.content-section {
  padding: 3rem 1rem;
  max-width: 900px;
  margin: 2rem auto;
  text-align: center;
}

#blog, #testimonials, #contact {
  background: transparent;
  border: none;
  box-shadow: none;
  max-width: 1200px; /* Wider for grid layouts */
}

.content-section h2 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--primary-color);
  text-shadow: 0 0 8px var(--primary-color);
}

.content-section p {
  font-size: 1.1rem;
  color: #c0c0c0;
  line-height: 1.8;
}

/* About Section Enhancements */
.about-content {
    text-align: left;
    max-width: 800px;
    margin: 0 auto;
}

.about-content h3 {
    font-size: 1.5rem;
    color: var(--primary-hover-color);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--card-border-color);
}

.about-content p {
    text-align: left;
    margin-bottom: 1rem;
}

.values-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.value-card {
    background: rgba(10, 4, 26, 0.4);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid rgba(0, 191, 255, 0.15);
    transition: all 0.3s ease;
}

.value-card:hover {
    transform: translateY(-3px);
    border-color: rgba(0, 191, 255, 0.4);
    box-shadow: 0 4px 15px rgba(0, 191, 255, 0.1);
}

.value-card h4 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.value-card p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-color);
    margin-bottom: 0;
}


/* Blog Section */
.article-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
}

.article-card {
  display: flex;
  flex-direction: column;
}
.article-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background-color: rgba(0,0,0,0.3);
}
.article-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}
.article-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #fff;
}
.article-content p {
  color: #c0c0c0;
  font-size: 1rem;
  line-height: 1.6;
  flex-grow: 1;
  margin-bottom: 1.5rem;
  text-align: left;
}

/* Testimonials */
.testimonial-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
}

.testimonial-card {
  padding: 2rem;
  background: var(--card-background);
  border: 1px solid var(--card-border-color);
  border-radius: 12px;
}

.testimonial-card blockquote {
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text-color);
  margin-bottom: 1rem;
  border-left: 4px solid var(--primary-color);
  padding-left: 1rem;
  text-align: left;
}

.testimonial-card cite {
  display: block;
  font-weight: 600;
  color: #a0a0a0;
  text-align: right;
}

/* Contact Form Section */
.contact-form {
    padding: 2rem;
    margin-top: 1.5rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
    background: var(--card-background);
    border: 1px solid var(--card-border-color);
    border-radius: 12px;
}
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary-hover-color);
}
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--card-border-color);
    background-color: rgba(0,0,0,0.3);
    color: var(--text-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: inherit;
}
.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px var(--primary-color);
}
.contact-form .cta-button {
    width: 100%;
    margin-top: 1rem;
}
#form-status {
    margin-top: 1rem;
    text-align: center;
    font-weight: 600;
}

/* Footer */
footer {
  background-color: #05020d;
  color: #a0a0a0;
  padding: 3rem 1rem 1rem;
  margin-top: auto;
  border-top: 1px solid var(--card-border-color);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto 2rem;
}

.footer-column h4 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-hover-color);
  margin-bottom: 1rem;
}
.footer-column h4 .nav-logo {
  font-size: 1.2rem;
}

.footer-column p {
  font-size: 0.9rem;
  line-height: 1.7;
}

.footer-column ul {
  list-style: none;
}

.footer-column ul li {
  margin-bottom: 0.75rem;
}

.footer-column ul a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease, padding-left 0.3s ease;
}

.footer-column ul a:hover {
  color: var(--primary-color);
  padding-left: 5px;
}

.footer-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer-tags-container .footer-tag {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--card-border-color);
  color: var(--text-color);
  padding: 0.3rem 0.8rem;
  border-radius: 15px;
  font-size: 0.8rem;
  transition: all 0.3s ease;
  cursor: pointer;
  text-decoration: none;
}

.footer-tags-container .footer-tag:hover {
  background-color: var(--primary-color);
  color: var(--background-color);
  box-shadow: 0 0 8px var(--primary-color);
}

.footer-bottom {
  border-top: 1px solid var(--card-border-color);
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-legal-links {
    margin-top: 1rem;
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.footer-legal-links a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-legal-links a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}


/* Policy Pages */
.policy-page {
    max-width: 800px;
    margin: 4rem auto;
    padding: 2rem 3rem;
    color: var(--text-color);
    background: var(--card-background);
    border: 1px solid var(--card-border-color);
    border-radius: 12px;
    animation: fadeIn 0.5s ease-in-out;
}

.policy-page h1 {
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 2rem;
    text-align: center;
}

.policy-page h2 {
    font-size: 1.6rem;
    color: var(--primary-hover-color);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border-color);
}

.policy-page p, .policy-page li {
    margin-bottom: 1rem;
    line-height: 1.8;
    font-size: 1rem;
}

.policy-page ul {
    list-style: none;
    padding-left: 1rem;
}

.policy-page li {
    padding-left: 1.5rem;
    position: relative;
}

.policy-page li::before {
    content: '›';
    position: absolute;
    left: 0;
    font-size: 1.4rem;
    line-height: 1.8rem;
    color: var(--primary-color);
}


/* Product Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 4, 26, 0.85);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out;
  padding: 1rem;
}

.modal-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--card-background);
  border: 1px solid var(--card-border-color);
  border-radius: 16px;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  position: relative;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.3s ease-in-out;
}

.modal-overlay.is-visible .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 2.5rem;
    line-height: 1;
    padding: 0;
    z-index: 10;
    transition: color 0.3s, transform 0.3s;
}

.modal-close:hover {
    color: var(--primary-color);
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.modal-visual-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal-image-container {
    width: 100%;
    text-align: center;
}

#modal-product-image {
    max-width: 100%;
    max-height: 40vh;
    object-fit: contain;
    border-radius: 8px;
    background: rgba(0,0,0,0.2);
}

.modal-details {
    display: flex;
    flex-direction: column;
}

#modal-product-name {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

#modal-product-price {
    font-size: 1.5rem;
    margin-bottom: 0;
}

.modal-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-hover-color);
    margin-top: 1rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border-color);
}

#modal-product-description {
    font-size: 0.95rem;
    line-height: 1.7;
    flex-grow: 1;
    white-space: pre-wrap;
    padding-left: 0.5rem;
    border-left: 2px solid var(--primary-color);
    opacity: 0.9;
}

.modal-meta-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.modal-price-status-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

#modal-product-type {
    background-color: var(--primary-color);
    color: var(--background-color);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    display: none; /* Hidden by default */
    margin-top: 0.75rem;
}

#modal-product-status {
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: capitalize;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    line-height: 1;
    display: none; /* Hidden by default, shown by JS */
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

#modal-product-status[data-status="còn-hàng"] { background-color: #3ddc84; }
#modal-product-status[data-status="hết-hàng"] { background-color: #ff4d4f; }
#modal-product-status[data-status="sắp-về"] { background-color: #1890ff; }
#modal-product-status[data-status="đặt-trước"] { background-color: #ffc107; color: var(--background-color); }

#modal-product-rating-stars {
    color: #ffc107;
    font-size: 1.2rem;
    letter-spacing: 2px;
    line-height: 1;
    display: none; /* Hidden by default, shown by JS */
}

.modal-actions-container {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

#modal-product-link {
    width: 100%;
    text-align: center;
    margin-top: 0;
}

.modal-social-share {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-social-share span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
}

.modal-social-share a {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.modal-social-share a:hover {
    background-color: var(--primary-color);
    color: var(--background-color);
    transform: translateY(-2px);
}

.modal-social-share svg {
    width: 20px;
    height: 20px;
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  gap: 0.25rem; /* Tighter gap for more tabs */
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--card-border-color);
  flex-wrap: wrap; /* Allow tabs to wrap on small screens */
}

.modal-tab-button {
  padding: 0.75rem 0.5rem; /* Adjust padding */
  font-size: 0.9rem; /* Slightly smaller font */
  font-weight: 600;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-color);
  transition: color 0.3s ease, border-color 0.3s ease;
  position: relative;
  top: 1px;
}

.modal-tab-button:hover {
  color: var(--primary-color);
}

.modal-tab-button.is-active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.modal-tab-panel {
  display: none;
  animation: fadeIn 0.4s ease-in-out;
}

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

@keyframes wobble {
  0%, 100% {
    transform: translateX(0%);
  }
  15% {
    transform: translateX(-6px) rotate(-4deg);
  }
  30% {
    transform: translateX(4px) rotate(4deg);
  }
  45% {
    transform: translateX(-4px) rotate(-2.4deg);
  }
  60% {
    transform: translateX(2px) rotate(1.6deg);
  }
  75% {
    transform: translateX(-1px) rotate(-0.8deg);
  }
}

.modal-tab-panel.is-active {
  display: block;
}

/* AI Consultant Panel */
#tab-panel-consultant {
    padding: 1rem 0;
    color: var(--text-color);
    min-height: 280px; /* Match comment panel height */
    display: flex;
    flex-direction: column;
}

.consultant-initial-message {
    text-align: center;
    padding: 2rem;
    margin: auto 0; /* Center vertically */
}

.consultant-initial-message p {
    color: #c0c0c0;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    line-height: 1.7;
}

.consultant-initial-message .cta-button {
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
}

#consultant-result-container {
    animation: fadeIn 0.5s ease;
}

#consultant-result-container h4 {
    font-size: 1.1rem;
    color: var(--primary-hover-color);
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border-color);
}
#consultant-result-container h4:first-child {
    margin-top: 0;
}

#consultant-result-container ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

#consultant-result-container li {
    background: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%2300bfff" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M10.854 8.146a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708-.708L9.793 8.5H4.5a.5.5 0 0 1 0-1H9.793L7.146 4.854a.5.5 0 1 1 .708-.708l3 3z"/></svg>') no-repeat left 0.35em;
    padding-left: 1.75em;
    margin-bottom: 0.75em;
    line-height: 1.6;
}

#consultant-result-container .summary {
    font-style: italic;
    background: rgba(0, 191, 255, 0.05);
    padding: 1rem;
    border-left: 3px solid var(--primary-color);
    border-radius: 0 4px 4px 0;
    margin-top: 1rem;
    line-height: 1.7;
}

/* Comments Panel */
#tab-panel-comments {
    padding-top: 1rem;
}

.comments-list-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 280px; /* Adjust as needed for ~5 comments */
}

.comment-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
}

.comment-content {
    flex-grow: 1;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.comment-author {
    font-weight: 600;
    color: var(--primary-hover-color);
}

.comment-date {
    font-size: 0.8rem;
    color: #a0a0a0;
}

.comment-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-color);
    margin: 0;
}

.no-comments-message {
    text-align: center;
    color: #a0a0a0;
    padding: 2rem 0;
    font-style: italic;
    margin: auto;
}

/* Comment Pagination */
.comments-pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--card-border-color);
}

.pagination-button {
    background: transparent;
    border: 1px solid var(--card-border-color);
    color: var(--text-color);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1;
}

.pagination-button:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: var(--background-color);
    border-color: var(--primary-color);
}

.pagination-button.is-active {
    background-color: var(--primary-color);
    color: var(--background-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 8px var(--primary-color);
}

.pagination-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* Related Products in Modal */
.modal-related-products {
    margin-top: 1.5rem;
    grid-column: 1 / -1; /* Span full width in grid layout */
}

.related-products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding-top: 0.5rem;
}

.related-product-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: left;
    display: flex;
    flex-direction: column;
}

.related-product-card:hover,
.related-product-card:focus {
    transform: translateY(-4px);
    box-shadow: 0 0 12px var(--card-border-color);
    outline: none;
    border-color: var(--primary-hover-color);
}

.related-product-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background-color: rgba(0,0,0,0.3);
}

.related-product-details {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.related-product-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    line-height: 1.3;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.2em;
}

.related-product-price {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: auto;
}

/* Featured Products Pagination */
.featured-pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    grid-column: 1 / -1;
}

.featured-pagination-container .pagination-button {
    width: auto;
    height: auto;
    border-radius: 20px;
    padding: 0.5rem 1.25rem;
}

.featured-pagination-container .pagination-info {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}


/* Desktop Styles */
@media (min-width: 769px) {
  #search-button span {
    display: inline;
  }
  .search-addons-container {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
  .nav-toggle {
    display: none;
  }
  .nav-menu {
    display: flex;
    position: static;
    height: auto;
    width: auto;
    background-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .nav-menu ul {
    display: flex;
    gap: 2rem;
  }
  .nav-menu li {
    margin: 0;
  }
  .nav-menu a {
    font-size: 1rem;
    font-weight: 400;
  }
  .nav-actions {
    gap: 0; /* No gap needed if only menu toggle is there on mobile */
  }
  .article-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .testimonial-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .values-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .modal-body {
      grid-template-columns: 2fr 3fr;
      gap: 2rem;
      padding: 2.5rem;
  }
  #modal-product-name {
    font-size: 2rem;
  }
  .related-products-grid {
      grid-template-columns: repeat(4, 1fr);
  }
  .modal-tab-button {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
  }
}

@media (min-width: 992px) {
    .article-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 550px) and (max-width: 768px) {
    .related-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}


@media (max-width: 768px) {
  .header-content h1 {
    font-size: 2.5rem;
  }
  .content-section h2 {
    font-size: 1.8rem;
  }
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  html {
    scroll-padding-top: 60px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
}