@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;800&display=swap');

:root {
  --primary: #6c5ce7;
  --secondary: #a29bfe;
  --accent: #fdcb6e;
  --dark: #2d3436;
  --light: #f5f6fa;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

body {
  background-color: #f9f9f9;
  color: var(--dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- NAVIGATION --- */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 5%;
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 1000;
  height: 70px;
}

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

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  font-weight: 600;
  font-size: 0.95rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--dark);
  transition: 0.3s;
}

.nav-links a:hover {
  color: var(--primary);
}

.btn {
  padding: 8px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: 0.3s;
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-block;
  text-align: center;
}

.btn:hover {
  background: #5649c0;
}

/* --- HERO SECTION --- */
.hero {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: white;
  text-align: center;
  padding: 50px 20px 80px;
  border-bottom-left-radius: 50px;
  border-bottom-right-radius: 50px;
}

.hero h2 {
  font-size: 2.5rem;
  margin-bottom: 20px;
}

.search-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  max-width: 500px;
  margin: 0 auto 20px auto;
  position: relative;
}

.search-container input {
  width: 100%;
  padding: 12px 20px;
  border-radius: 30px;
  border: none;
  outline: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.search-container .btn {
  border-radius: 50%;
  padding: 12px 15px;
}

.categories {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.categories button {
  padding: 8px 15px;
  border: 2px solid white;
  background: transparent;
  color: white;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.3s;
}

.categories button:hover {
  background: white;
  color: var(--primary);
}

/* --- PRODUCTS GRID --- */
.products {
  padding: 40px 10%;
  flex: 1;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  /* Adjusted for better fit */
  gap: 20px;
  margin-top: 20px;
}

.product-card {
  background: white;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  text-align: center;
  transition: 0.3s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.product-card img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  margin-bottom: 10px;
}

.price {
  color: var(--primary);
  font-weight: bold;
  font-size: 1.1rem;
}

/* --- MODAL --- */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  /* Fix scrolling on small screens */
  padding: 20px;
  /* Add padding for mobile */
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 10px;
  width: 450px;
  max-width: 100%;
  text-align: center;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  animation: slideDown 0.3s ease;
  margin: auto;
}

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

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

.close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  /* Bigger touch target */
  cursor: pointer;
  color: #999;
  z-index: 10;
}

/* --- TOAST --- */
.toast-box {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #2d3436;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  min-width: 250px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: slideInRight 0.3s ease forwards;
}

.toast.success {
  border-left: 5px solid #00b894;
}

.toast.error {
  border-left: 5px solid #d63031;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* --- AUTH FORMS --- */
.auth-container {
  padding: 10px 10px;
  text-align: center;
}

.auth-container h2 {
  color: var(--dark);
  margin-bottom: 25px;
  font-size: 1.8rem;
}

.input-group {
  position: relative;
  margin-bottom: 15px;
}

.input-group input {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #dfe6e9;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: 0.3s;
  background: #fdfdfd;
}

.input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 5px rgba(108, 92, 231, 0.2);
}

.input-group i {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #b2bec3;
  cursor: pointer;
}

.forgot-pass {
  display: block;
  text-align: right;
  font-size: 0.85rem;
  color: #636e72;
  margin-bottom: 20px;
  text-decoration: none;
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: #ff6b00;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
  text-transform: uppercase;
}

.divider {
  display: flex;
  align-items: center;
  color: #b2bec3;
  margin: 25px 0;
  font-size: 0.9rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #dfe6e9;
}

.divider span {
  padding: 0 10px;
}

.social-login {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 30px;
  border: 1px solid #dfe6e9;
  background: white;
  cursor: pointer;
  transition: 0.3s;
  font-weight: 500;
  color: var(--dark);
  flex: 1;
}

.social-btn:hover {
  background: #f9f9f9;
  transform: translateY(-2px);
}

.switch-auth {
  margin-top: 20px;
  font-size: 0.9rem;
  color: #636e72;
}

.switch-auth a {
  color: #00b894;
  font-weight: bold;
  text-decoration: none;
}

/* --- FOOTER --- */
footer {
  background: #2d3436;
  color: white;
  padding: 40px 10% 20px;
  margin-top: auto;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.footer-col h3 {
  color: var(--accent);
  margin-bottom: 15px;
}

.footer-col p,
.footer-col a {
  color: #b2bec3;
  display: block;
  margin-bottom: 10px;
  text-decoration: none;
  transition: 0.3s;
  font-size: 0.9rem;
}

.footer-col a:hover {
  color: white;
  padding-left: 5px;
}

.footer-bottom {
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
  color: #636e72;
  font-size: 0.85rem;
}

/* =========================================
   ✅ MOBILE RESPONSIVENESS
   ========================================= */

@media (max-width: 768px) {

  /* Nav Fixes */
  nav {
    flex-direction: column;
    height: auto;
    padding: 10px 5%;
  }

  .nav-links {
    margin-top: 15px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
  }

  .nav-links a,
  .nav-links button {
    margin-right: 0 !important;
    font-size: 0.85rem;
  }

  /* Hero Fixes */
  .hero {
    padding: 30px 15px 50px;
    border-bottom-left-radius: 30px;
    border-bottom-right-radius: 30px;
  }

  .hero h2 {
    font-size: 1.8rem;
  }

  .search-container {
    width: 100%;
  }

  /* Modal Fixes */
  .modal-content {
    width: 95% !important;
    padding: 20px;
  }

  /* Override inline styles in JS populated Product Modal */
  #product-modal .modal-content>div {
    flex-direction: column !important;
    gap: 10px !important;
  }

  #pm-img {
    height: 200px;
    object-fit: contain;
  }

  /* Toast Fix */
  .toast-box {
    left: 20px;
    right: 20px;
    width: auto;
  }

  .toast {
    width: 100%;
    min-width: auto;
  }
}