/* Reset and basics */
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family: 'Segoe UI', sans-serif; background: #e7fcf1; color:#333; }
body { font-family: 'Segoe UI', sans-serif; background: #f4f7f6; color:#333; display: flex; flex-direction: column; min-height: 100vh; }

/* Navbar */
nav {
  background: #16a34a;
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  position: relative;
  gap: 10px;
}
nav h1 { 
  font-size: 22px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  text-align: center;
  white-space: nowrap;
  z-index: 5;
}
.nav-buttons { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  flex-wrap: wrap;
  flex: 1 1 auto;
  justify-content: flex-end;
}
.cart-btn, #logout-btn {
  background: white; 
  color:#16a34a; 
  border:none; 
  padding:8px 12px; 
  border-radius:8px; 
  font-weight:bold; 
  cursor:pointer;
  transition:0.3s;
  white-space: nowrap;
  flex-shrink: 0;
}
.cart-btn:hover, #logout-btn:hover { background:#f0f0f0; }
#search { 
  padding:8px 12px; 
  border-radius:8px; 
  border:none; 
  outline:none; 
  width:180px;
  min-width: 150px;
}

/* Hero Section */
header {
  text-align: center;
  padding: 60px 20px;
  background-image: url("./res/banner.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #064e3b;
}
header h2 { font-size: 2.2rem; margin-bottom:10px; }
header p { font-size:1.1rem; color:#065f46; }

/* Category Section */
.category-section {
  text-align: center;
  padding: 20px;
  background: #f0f0f0;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.category-btn {
  padding: 10px 20px;
  border: 2px solid #16a34a;
  background: white;
  color: #16a34a;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
}
.category-btn:hover {
  background: #e8f5e9;
}
.category-btn.active {
  background: #16a34a;
  color: white;
}

/* Products Grid */
.product-grid { display:grid; grid-template-columns: repeat(auto-fit,minmax(250px,1fr)); gap:25px; padding:30px; }
.card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
  transition: 0.3s;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 390px; /* fixed height for each card */
  width: 300px; /* fixed width for each card */
  min-height: 300px; /* reduced by additional 15% from 384px */
}
.card:hover { transform: translateY(-5px); box-shadow:0 12px 25px rgba(0,0,0,0.15); }
.card img {
  width: 100%;
  /* keep the product image the same fixed height while card slot increases */
  height: 140px;
  object-fit: cover;
  flex: 0 0 auto;
}
.card-content {
  padding: 20px;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  overflow: hidden;
}
.card-content h3 { font-size:18px; margin-bottom:5px; color:#16a34a; }
.card-content p { font-size:14px; color:#555; margin-bottom:8px; }
.price { font-weight:bold; color:#16a34a; }
.add-btn {
  width:100%;
  padding:8px 10px;
  border:none;
  border-radius:8px;
  background:#16a34a;
  color:white;
  font-weight:700;
  cursor:pointer;
  transition:0.2s;
  margin-top: auto; /* push button to bottom of card-content */
  font-size: 14px;
}
.add-btn:hover { background:#15803d; transform: translateY(-1px); }

/* Cart Page */
.cart-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.cart-item {
  display: grid;
  grid-template-columns: 100px 2fr 1fr 1fr 1fr;
  gap: 20px;
  align-items: center;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #f9f9f9;
}

.item-image {
  width: 100px;
  height: 100px;
  overflow: hidden;
  border-radius: 8px;
}

.item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-details h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
}

.item-price {
  color: #666;
  font-size: 14px;
  margin: 0;
}

.quantity-control {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #27ae60;
  background-color: #fff;
  color: #27ae60;
  font-size: 18px;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.qty-btn:hover {
  background-color: #27ae60;
  color: #fff;
}

.qty-input {
  width: 45px;
  height: 32px;
  text-align: center;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
}

.item-total {
  text-align: center;
  font-weight: bold;
  font-size: 18px;
  color: #27ae60;
}

.remove-btn {
  background-color: #e74c3c;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s ease;
}

.remove-btn:hover {
  background-color: #c0392b;
}

.cart-summary {
  text-align: right;
  padding: 20px;
  font-size: 24px;
  border-top: 2px solid #27ae60;
  margin-top: 20px;
}

.empty-cart {
  text-align: center;
  font-size: 20px;
  padding: 40px;
  color: #666;
}

/* Footer */
footer {
  background: #16a34a;
  color: white;
  text-align: center;
  padding: 20px;
  margin-top: auto;
}

/* Login */
.logo-txt {
  font-size: 55px;
  position: absolute;
  top: 80px;
  left: 120px;
  text-align: center;
  margin-top: 30px;
  margin-bottom: 20px;
  color: #16a34a;
}

.login-wrapper {
  display: flex;
  min-height: 100vh;
  background: #e7fcf1;
  justify-content: center;
  align-items: center;
}
.login-left {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  padding-right: 40px;
}
.logo-text {
  max-width: 400px;
  color: #fff;
}
.logo-text h1 {
  font-size: 4rem;
  font-weight: bold;
  color: #41d81b;
  margin-bottom: 12px;
  text-align: left;
  letter-spacing: -2px;
}
.logo-text p {
  font-size: 1.7rem;
  font-weight: 500;
  color: #0c0707;
  text-align: left;
  margin-top: 0;
}
.login-right {
  flex: 1;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}
.login-container {
  min-width: 350px;
  max-width: 400px;
  margin: 0;
  background: #fff;
  padding: 32px 24px 24px 24px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  text-align: center;
}
.login-container h2 {
  margin-bottom: 20px;
  color: #1877f2;
  font-size: 2rem;
  font-weight: bold;
}
@media (max-width: 900px) {
  .login-wrapper {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
  }
  .login-left, .login-right {
    flex: unset;
    width: 100%;
    align-items: center;
    justify-content: center;
    padding: 0;
  }
  .logo-text {
    margin: 40px auto 0 auto;
    text-align: center;
  }
  .login-container {
    margin: 40px auto;
  }
}
.login-container h2 { margin-bottom:20px; color:#16a34a; }
.login-container form { display:flex; flex-direction:column; gap:15px; }
.login-container input { padding:10px; border-radius:8px; border:1px solid #ccc; font-size:14px; }
.login-container button { padding:10px; background:#16a34a; color:white; border:none; border-radius:8px; cursor:pointer; font-weight:bold; transition:0.3s; }
.login-container button:hover { background:#15803d; }
.login-container a { color:#16a34a; text-decoration:none; }
.login-container a:hover { text-decoration:underline; }

/* Register Page */
.register-container { 
  max-width:450px; 
  margin:50px auto; 
  background:#e7fcf1; 
  padding:40px; 
  border-radius:12px; 
  box-shadow:0 4px 12px rgba(0,0,0,0.15); 
  text-align:center; 
}
.register-container h2 { 
  margin-bottom:30px; 
  color:#16a34a; 
  font-size:1.8rem;
}
.register-container form { 
  display:flex; 
  flex-direction:column; 
  gap:15px; 
}
.form-group { 
  text-align:left; 
}
.form-group label { 
  display:block; 
  margin-bottom:6px; 
  color:#333; 
  font-weight:600; 
  font-size:14px;
}

/* Generic button base */
.btn {
  padding:10px 14px;
  border-radius:8px;
  border:none;
  cursor:pointer;
  font-weight:700;
  background: #ffffff;
  color: #111827;
}

/* Yellow / warning style for prominent actions */
.btn-yellow {
  background: #f59e0b; /* amber-500 */
  color: #fff;
  box-shadow: 0 6px 12px rgba(245,158,11,0.12);
}
.btn-yellow:hover { background: #d97706; }

/* Small utility for ghost buttons used in JS */
.btn-ghost { background: #fff; border:1px solid #d1d5db; color:#111827 }
.form-group input { 
  width:100%; 
  padding:12px; 
  border-radius:8px; 
  border:1px solid #c4f7d3; 
  font-size:14px; 
  transition:0.3s;
}
.form-group input:focus { 
  outline:none; 
  border-color:#16a34a; 
  box-shadow:0 0 5px rgba(22,163,74,0.3);
}
.form-group small { 
  display:block; 
  margin-top:4px; 
  color:#888; 
  font-size:12px;
}
.register-btn { 
  padding:12px; 
  background:#16a34a; 
  color:white; 
  border:none; 
  border-radius:8px; 
  cursor:pointer; 
  font-weight:bold; 
  font-size:16px;
  transition:0.3s; 
  margin-top:10px;
}
.register-btn:hover { 
  background:#15803d; 
  transform: translateY(-2px);
}
.login-link { 
  margin-top:20px; 
  color:#555; 
  font-size:14px;
}
.login-link a { 
  color:#16a34a; 
  text-decoration:none; 
  font-weight:bold;
}
.login-link a:hover { 
  text-decoration:underline; 
}

/* Password Strength Meter */
#password-strength-container {
  margin-top: 6px;
  display: flex;
  gap: 10px;
  align-items: center;
}

#password-strength-meter {
  width: 100px;
  height: 8px;
  background-color: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  transition: width 0.3s ease, background-color 0.3s ease;
}

#password-strength-meter.strength-bad {
  background-color: #dc2626;
}

#password-strength-meter.strength-good {
  background-color: #f59e0b;
}

#password-strength-meter.strength-strong {
  background-color: #10b981;
}

#password-strength-text {
  font-size: 13px;
  font-weight: 600;
  min-width: 70px;
}

.strength-text-bad {
  color: #dc2626;
}

.strength-text-good {
  color: #f59e0b;
}

.strength-text-strong {
  color: #10b981;
}

/* Password Requirements Checklist */
#password-requirements {
  margin-top: 12px;
  padding: 12px;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.requirements-title {
  margin: 0 0 8px 0;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}

.requirement {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  color: #666;
  transition: all 0.3s ease;
}

.requirement:last-child {
  margin-bottom: 0;
}

.req-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-weight: bold;
  font-size: 11px;
  transition: all 0.3s ease;
}

.requirement.unchecked .req-icon {
  background-color: #fee2e2;
  color: #dc2626;
}

.requirement.checked .req-icon {
  background-color: #dcfce7;
  color: #16a34a;
}

.requirement.unchecked {
  color: #6b7280;
}

.requirement.checked {
  color: #16a34a;
  font-weight: 500;
}

/* Disabled Field Message */
.disabled-msg {
  display: none;
  color: #dc2626;
  font-weight: 600;
  margin-top: 6px;
}

/* Responsive */
@media(max-width:768px){
  nav {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  nav h1 {
    /* On small screens let the title participate in normal flow */
    position: static;
    transform: none;
    text-align: center;
    margin-bottom: 10px;
  }
  .nav-buttons { 
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    justify-content: flex-start;
  }
  .cart-btn, #logout-btn {
    width: 100%;
    text-align: center;
  }
  #search { 
    width: 100%;
    min-width: unset;
  }
}

/* SAME SIZE BUTTONS FOR ADD TO CART & BUY NOW */
.card-buttons {
  display: flex;
  gap: 10px;
}

.add-btn,
.buy-now-btn {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;

  padding: 10px;      /* Same padding */
  height: 42px;       /* Same height */
  border-radius: 8px; /* Same radius */
  font-weight: 600;
  font-size: 14px;    /* Same font size */
  border: none;
  cursor: pointer;
}

.add-btn {
  background: #16a34a;
  color: white;
}

.buy-now-btn {
  background: #facc15;
  color: black;
}

/* Styling for "ugly fresh" text */
.logo-txt{
  position: absolute;
  top: 80px; /* Moves the text slightly lower */
  left: 120px;
}

.logo-txt h1 {
margin: 0;
  font-size: 52px;
  font-weight: bold;
  color: green;
}
.logo-txt p {
  margin-top: 6px;
  font-size: 20px;
  color: #065f46;
  padding-left: 25px;
}

/* Page background utility for pages that should match the login background */
.page-blue-bg {
  background: #e7fcf1;
  min-height: 100vh;
}
/* Toast notification */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: rgba(6, 95, 70, 0.95);
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transform: translateY(10px);
  animation: toast-in 0.25s ease forwards, toast-out 0.25s ease forwards 1.25s;
}

@keyframes toast-in {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(10px); }
}
