:root {
  --color-primary: #fff;
  --color-secondary: #222222ff;
  --color-comp: #2851cbff;
  --font-primary: 'Poppins', sans-serif;
  --color-headerhover: #7f7f7fff;
  --text: #333;
  --primary: #ffffff;
  --secondary: #222222;
  --primary-alt: #f7f7f7;
  --primary-soft: #fafafa;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  outline: none;
  border: none;
  text-decoration: none;
  text-transform: capitalize;
  transition: all .2s linear;
  font-family: var(--font-primary);
}

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
  scroll-padding-top: 7rem;
  font-size: 62.5%;
}

body {
  background: whitesmoke;
  overflow-x: hidden;
}

/* Header */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  padding: 3rem;
  background-color: var(--color-primary);
  box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, 0.06);
  height: 8rem;
  gap: 1rem;
  width: 100%;
  z-index: 1000;
  top: 0;
  left: 0;
  right: 0;
}

.main-header .logo img {
  height: 60px;
}

.main-header .nav_links a {
  color: var(--color-secondary);
  font-size: 1.8rem;
  padding: 1.6rem;
  text-decoration: none;
}

.main-header .nav_links a:hover {
  color: var(--color-comp);
}

.main-header .navbar_icons div {
  height: 4.5rem;
  width: 4.5rem;
  line-height: 4.5rem;
  border-radius: .5rem;
  background: #eee;
  color: var(--color-comp);
  font-size: 1.6rem;
  margin-right: .4rem;
  cursor: pointer;
  text-align: center;
}

.main-header .navbar_icons div:hover {
  background-color: var(--color-comp);
  color: #fff;
}

#mobile_menu {
  display: none;
}

.search-form {
  position: absolute;
  top: 110%;
  right: -110%;
  width: 50rem;
  height: 5rem;
  background: #fff;
  border: 2px solid var(--color-comp);
  border-radius: .5rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  box-shadow: 0 .5px 1rem rgba(0, 0, 0, .1);
}

.search-form.active {
  right: 2rem;
  transition: .4s linear;
}

.search-form input {
  height: 100%;
  width: 100%;
  background: none;
  text-transform: none;
  font-size: 1.6rem;
  color: var(--color-comp);
  padding: 0 1.5rem;
}

.search-form button {
  font-size: 2.2rem;
  padding-right: 1.5rem;
  color: var(--color-comp);
  cursor: pointer;
}

.search-form button:hover {
  color: var(--color-secondary);
}

.profile-popup {
  position: absolute;
  top: 110%;
  right: -110%;
  /* hidden by default */
  background: var(--color-primary);
  color: var(--color-secondary);
  width: 260px;
  padding: 1.5rem;
  margin-top: 1rem;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  opacity: 0;
  pointer-events: none;
  transition: right 0.4s linear, opacity 0.3s ease;
}

.profile-popup.active {
  right: 2rem;
  opacity: 1;
  pointer-events: auto;
}

.profile-settings {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  font-size: 1.8rem;
  color: var(--color-comp);
}

.profile-settings:hover {
  color: #fff;
  /* highlight on hover */
}

/* Header */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 1rem;
}

.profile-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--color-secondary);
  flex-shrink: 0;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-info h3 {
  font-size: 2rem;
  margin: 0;
}

.profile-email {
  font-size: 1.5rem;
  color: var(--color-headerhover);
  display: block;
  margin-top: 0.2rem;
  text-transform: none;
}

.profile-status {
  font-size: 1.3rem;
  color: var(--color-comp);
  opacity: 0.7;
}

/* Actions */
.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}

.profile-btn {
  background: var(--color-comp);
  color: var(--color-primary);
  padding: 1rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1.4rem;
  font-weight: 600;
  transition: background 0.3s ease, transform 0.2s ease;
}

.profile-btn:hover {
  background: var(--color-secondary);
  color: var(--color-primary);
  transform: translateY(-2px);
}

.profile-btn.logout {
  background: #e63946;
  color: #fff;
}

.profile-btn.logout:hover {
  background: #ff5c5c;
}

.filter-sort-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--color-primary);
  border-bottom: 1px solid #ddd;
  margin-top: 9rem;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.filter-sort-bar select {
  padding: 0.6rem 1rem;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 1.4rem;
}

.filter-btn {
  background: var(--color-comp);
  color: var(--primary);
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.3s;
}

.filter-btn:hover {
  background: #1f3c99;
}

/* ---------- FILTER PANEL ---------- */
.filter-panel {
  position: fixed;
  top: 0;
  left: -320px;
  width: 300px;
  height: 100%;
  background: var(--primary);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
  overflow-y: auto;
  transition: left 0.4s ease;
  z-index: 2000;
  padding: 2rem 1rem;
}

.filter-panel.active {
  left: 0;
}

.filter-panel h3 {
  margin-bottom: 1.2rem;
  font-size: 1.6rem;
  color: var(--secondary);
}

.filter-section {
  margin-bottom: 1.5rem;
}

.filter-section button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-size: 1.4rem;
  font-weight: bold;
  cursor: pointer;
  padding: 0.5rem;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-section .options {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  padding-left: 0.5rem;
}

.filter-section.active .options {
  max-height: 300px;
  margin-top: 0.5rem;
}

.filter-section .options label {
  display: block;
  margin-bottom: 0.6rem;
  font-size: 1.6rem;
}

/* Close Button */
.filter-panel .close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--secondary);
}

/* Trending Now Carousel */
.trending-carousel {
  margin: 2rem 0;
  padding: 1rem 2rem;
}

.carousel-title {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-secondary);
}

.carousel-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  display: flex;
  gap: 1rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #aaa transparent;
}

.carousel-wrapper::-webkit-scrollbar {
  height: 8px;
}

.carousel-wrapper::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.carousel-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.carousel-track {
  display: flex;
  gap: 1rem;
  transition: transform 0.5s ease-in-out;
}

.carousel-card {
  flex: 0 0 200px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 1rem;
  text-align: center;
  transition: transform 0.3s ease;
}

.carousel-card .img-container {
  height: 28rem;
}

.carousel-card img {
  width: 100%;
  max-height: 27rem;
  border-radius: 8px;
  margin-bottom: 0.8rem;
}

.carousel-card:hover {
  transform: translateY(-5px);
}

.carousel-card h4 {
  font-size: 1.6rem;
  margin-bottom: 0.4rem;
  color: var(--color-secondary);
}

.carousel-card span {
  color: var(--color-comp);
  font-size: 1.2rem;
  font-weight: 500;
}

.carousel-card p {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 12px;
}

.carousel-btn {
  background: var(--color-comp);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.3s;
}

.carousel-btn:hover {
  background: #e6554a;
}

/* Product Grid */
.product-grid,
.search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2.5rem;
  padding: 4rem 2rem;
  max-width: 1200px;
  margin: auto;
}

.product-card,
.search-card {
  background: #fffaf8;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(30px);
  opacity: 0;
  transition: all 0.6s ease, transform 0.3s ease;
  position: relative;
  padding: .6rem;

}

.product-card.visible,
.search-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.product-card:hover,
.search-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.product-image,
.search-image {
  position: relative;
  overflow: hidden;
}

.product-image img,
.search-image img {
  width: 100%;
  object-fit: contain;
  height: auto;
  border-radius: 0.3rem;
  height: 35rem;
  padding-top: 1.5rem;
  display: block;
  transition: transform 0.4s ease;
}

.product-card:hover img,
.search-card:hover img {
  transform: scale(1.05);
}

.product-actions,
.search-actions {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  gap: 10px;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.product-card:hover .product-actions,
.search-card:hover .search-actions {
  opacity: 1;
  transform: translateY(0);
}

.product-actions button,
.search-actions button {
  background: var(--color-comp);
  border: none;
  color: #fff;
  padding: 8px 10px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.4rem;
  transition: background 0.3s ease;
}

.product-actions button:hover,
.search-actions button:hover{
  background: var(--color-secondary);
}

.product-info,
.search-info {
  padding: 1.5rem;
  text-align: center;
}

.product-info h3,
.search-info h3 {
  font-size: 2.1rem;
  margin-bottom: 0.5rem;
  color: var(--color-secondary);
}

.product-info p,
.search-info p {
  font-size: 1.8rem;
  color: var(--color-comp);
  font-weight: 600;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 3000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  min-height: 50rem;
  background: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: #fffaf8;
  border-radius: 12px;
  max-width: 800px;
  width: 90%;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
  animation: slideUp 0.4s ease;
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 3rem;
  cursor: pointer;
  color: #555;
}

.modal-body {
  display: flex;
  flex-direction: row;
  gap: 2rem;
}

.modal-image img {
  width: 280px;
  height: auto;
  border-radius: 8px;
  object-fit: cover;
}

.modal-details {
  flex: 1;
}

.modal-details h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.modal-details .modal-price {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--color-comp);
  margin-bottom: 1rem;
}

.modal-details .modal-desc {
  font-size: 1.4rem;
  margin-bottom: 1.2rem;
}

.modal-details p {
  font-size: 1.4rem;
  color: var(--secondary);
  margin-bottom: .8rem;
}

.message-btn {
  background: var(--color-comp);
  color: #fff;
  border: none;
  padding: 0.8rem 1.6rem;
  font-size: 1.4rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s;
}

.message-btn:hover {
  background: var(--color-secondary);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Search Results */
#searchResults {
  display: block;
  /* container itself is block */
}

.no-results {
  text-align: center;
  padding: 4rem 2rem;
  background: #fffdfc;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  animation: fadeIn 0.4s ease;
}

.no-results h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: #444;
}

.no-results p {
  font-size: 1.4rem;
  margin-bottom: 2rem;
  color: #666;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}


footer {
  background: #111827;
  color: #f3f4f6;
  padding: 60px 20px 30px;
  text-align: center;
  transform: translateY(100%);
  opacity: 0;
  transition: all 0.8s ease;
}

footer.visible {
  transform: translateY(0);
  opacity: 1;
}

.footer-container {
  max-width: 1200px;
  margin: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  text-align: left;
}

.footer-logo h2 {
  font-size: 1.5rem;
  margin-bottom: 10px;
  color: #f9fafb;
}

.footer-logo p {
  font-size: 0.95rem;
  color: #d1d5db;
}

.footer-links h3 {
  margin-bottom: 12px;
  font-size: 1.1rem;
  color: #f3f4f6;
}

.footer-links ul {
  list-style: none;
}

.footer-links ul li {
  margin-bottom: 8px;
}

.footer-links ul li a {
  color: #9ca3af;
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.3s;
}

.footer-links ul li a:hover {
  color: #f3f4f6;
}

.social-icons {
  margin-top: 15px;
}

.social-icons a {
  display: inline-block;
  margin-right: 10px;
  color: #9ca3af;
  font-size: 1.2rem;
  transition: color 0.3s;
}

.social-icons a:hover {
  color: #f3f4f6;
}

.footer-bottom {
  margin-top: 40px;
  border-top: 1px solid #374151;
  padding-top: 15px;
  font-size: 0.85rem;
  color: #9ca3af;
  text-align: center;
}

@keyframes popIn {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }

  80% {
    transform: scale(1.1);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@media screen and (max-width: 960px) {
  html {
    font-size: 55%;
  }

  .form-details {
    margin: 1.5rem;
    padding: 3rem;
  }

  .product-grid,
  .search-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    padding: 3rem 1.5rem;
  }

  .product-image img,
  .search-image img {
    height: 28rem;
    object-fit: contain;
    max-width: 100%;
  }

  .product-info h3,
  .search-info h3 {
    font-size: 1.6rem;
  }

  .product-info p,
  .search-info p {
    font-size: 1.4rem;
  }

  .product-actions {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }

  .product-card.visible .product-actions {
    opacity: 1;
    transform: translateY(0);
  }

  .product-card.visible .product-actions button {
    animation: popIn 0.4s ease forwards;
  }

  .product-card.visible .product-actions button:nth-child(1) {
    animation-delay: 0.2s;
  }

  .product-card.visible .product-actions button:nth-child(2) {
    animation-delay: 0.4s;
  }

  .search-actions {
    opacity: 1 !important;
    transform: translateY(0) !important;
    position: static;
    /* keep them inside flow under product */
    margin-top: 1rem;
    justify-content: center;
  }

  /* Buttons a bit larger for touch */
  .search-actions button {
    padding: 10px 12px;
    font-size: 1.6rem;
    border-radius: 50%;
  }
}

@media screen and (max-width: 768px) {
  html {
    font-size: 50%;
  }

  .main-header {
    padding: 2rem;
  }

  .main-header .nav_links {
    position: absolute;
    top: 110%;
    right: -110%;
    width: 30rem;
    border-radius: .5rem;
    background: #e1e1e1;
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .1);
  }

  .main-header .nav_links.active {
    right: 2rem;
    transition: .4s linear;
  }

  #mobile_menu {
    display: inline-block;
  }

  .main-header .nav_links a {
    font-size: 2rem;
    margin: 2rem 2.5rem;
    display: block;
    border: .2rem solid var(--color-comp);
    text-align: center;
    border-radius: .5rem;
  }

  .main-header .nav_links a:hover {
    border: .2rem solid var(--color-comp);
    background: var(--color-comp);
    color: #fff;
  }

  .form-details .form {
    width: 55%;
  }

  .modal-body {
    flex-direction: column;
    align-items: center;
  }

  .product-grid,
  .search-grid {
    gap: 1.5rem;
    padding: 2.5rem 1.2rem;
  }

  .product-image img,
  .search-image img {
    height: 24rem;
  }

  .product-info h3,
  .search-info h3 {
    font-size: 1.4rem;
  }

  .product-info p,
  .search-info p {
    font-size: 1.3rem;
  }

  /* ✅ pop-in animation */
  .product-actions {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }

  .product-card.visible .product-actions {
    opacity: 1;
    transform: translateY(0);
  }

  .product-card.visible .product-actions button {
    animation: popIn 0.4s ease forwards;
  }

  .product-card.visible .product-actions button:nth-child(1) {
    animation-delay: 0.2s;
  }

  .product-card.visible .product-actions button:nth-child(2) {
    animation-delay: 0.4s;
  }
}

@media screen and (max-width: 460px) {
  html {
    font-size: 45%;
  }

  .main-header .search-form input {
    width: 90%;
  }

  .form-details {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-direction: column;
  }

  .form-details .form {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .product-grid,
  .search-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 2rem 1rem;
  }

  .product-image img,
  .search-image img {
    height: 20rem;
  }

  .product-info h3,
  .search-info h3 {
    font-size: 1.2rem;
  }

  .product-info p,
  .search-info p {
    font-size: 1.1rem;
  }

  .product-actions {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }

  .product-card.visible .product-actions {
    opacity: 1;
    transform: translateY(0);
  }

  .product-card.visible .product-actions button {
    animation: popIn 0.4s ease forwards;
  }

  .product-card.visible .product-actions button:nth-child(1) {
    animation-delay: 0.2s;
  }

  .product-card.visible .product-actions button:nth-child(2) {
    animation-delay: 0.4s;
  }
}

@media screen and (max-width: 360px) {
  html {
    font-size: 40%;
  }

  .product-grid,
  .search-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    padding: 1.5rem 0.8rem;
  }

  .product-image img,
  .search-image img {
    height: 18rem;
  }

  .product-info h3,
  .search-info h3 {
    font-size: 1rem;
  }

  .product-info p,
  .search-info p {
    font-size: 1rem;
  }

  /* ✅ pop-in animation */
  .product-actions {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }

  .product-card.visible .product-actions {
    opacity: 1;
    transform: translateY(0);
  }

  .product-card.visible .product-actions button {
    animation: popIn 0.4s ease forwards;
  }

  .product-card.visible .product-actions button:nth-child(1) {
    animation-delay: 0.2s;
  }

  .product-card.visible .product-actions button:nth-child(2) {
    animation-delay: 0.4s;
  }
}