/* Base Styles */
:root {
  --primary-color: #ff5722; /* Orange for buttons/accents */
  --secondary-color: #333;
  --text-color: #1a1a1a;
  --bg-light: #f4f4f4;
  --font-poppins: "Poppins", sans-serif;
  --stock-low: #ffc107; /* Warning yellow */
  --stock-out: #dc3545; /* Error red */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-poppins);
  line-height: 1.6;
  background-color: white;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Header/Nav Styles */
.header {
  background-color: white;
  border-bottom: 1px solid var(--bg-light);
  padding: 15px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--secondary-color);
}
.logo .ng {
  font-size: 0.8rem;
  color: var(--primary-color);
}

.nav-links {
  display: none; /* Hide full links on mobile */
}

.nav-icons {
  display: flex;
  align-items: center;
}
.nav-icons i,
.nav-icons a {
  font-size: 1.2rem;
  color: var(--secondary-color);
  margin-left: 15px;
  text-decoration: none;
  position: relative;
}

.cart-count {
  position: absolute;
  top: -10px;
  right: -10px;
  background-color: var(--primary-color);
  color: white;
  border-radius: 50%;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 700;
}

/* Hero Section */
.hero-section {
  background-color: #000;
  padding: 20px 0;
  color: white;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-text h2 {
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 5px;
}
.hero-text h1 {
  font-size: 3rem;
  font-weight: 900;
  color: var(--primary-color);
  line-height: 1;
}
.hero-text h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 5px;
  letter-spacing: 1px;
}

.hero-image {
  width: 15rem;
  max-width: 300px;
  height: auto;
  object-fit: cover;
  margin-top: 20px;
  border-radius: 8px;
}

/* .header-img {
  width: 15rem !important;
  height: 10rem !important;
} */

/* Category Cards */
.category-links {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 30px 0;
}

.category-card {
  background-color: var(--bg-light);
  padding: 8px 5px;
  border-radius: 3px;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.category-card img {
  width: 50%;
  height: 50%;
  object-fit: cover;
  margin: 5px 0;
  border-radius: 4px;
}
.category-card h3 {
  font-size: 1.5rem;
  color: var(--secondary-color);
}
.category-card p {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 5px;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
  transition: background-color 0.3s;
  border: none;
}

.primary-btn {
  background-color: var(--primary-color);
  color: white;
}
.primary-btn:hover:not(:disabled) {
  background-color: #e64a19;
}
.primary-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

/* Best Sellers / Product Grid */
.best-sellers {
  padding: 40px 0;
  text-align: center;
}

.best-sellers h2 {
  font-size: 2rem;
  color: var(--secondary-color);
  margin-bottom: 25px;
  border-bottom: 2px solid var(--primary-color);
  display: inline-block;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2 columns on mobile */
  gap: 15px;
}

.product-card {
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  text-align: left;
  padding: 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.product-card img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 10px;
}

.product-card h4 {
  font-size: 0.4rem;
  font-weight: 600;
  margin-bottom: -5px;
  color: var(--secondary-color);
}

.product-card .price-old {
  text-decoration: line-through;
  color: #999;
  font-size: 0.5rem;
  margin-left: 5px;
}
.product-card .price-new {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-top: -5px;
}

.product-card .ratings i {
  color: gold;
  font-size: 0.5rem;
  margin-bottom: -7px;
}

.product-card .add-to-cart-btn {
  width: 100%;
  margin-top: 5px;
  cursor: pointer;
  font-size: 0.6rem;
}

/* --- Collapsible Details (NEW) --- */
.product-details-collapse {
  text-align: left;
  margin: 10px 0;
  border-top: 1px dashed #ddd;
  padding-top: 5px;
}
.product-details-collapse summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: #666;
}
.product-details-collapse summary i {
  transition: transform 0.2s;
  color: var(--primary-color);
}
.product-details-collapse[open] summary i {
  transform: rotate(180deg);
}
.collapse-content {
  margin-top: 5px;
  font-size: 0.8rem;
  line-height: 1.4;
  padding: 5px 0;
}
.collapse-content h5 {
  margin: 5px 0 2px;
  font-size: 0.9rem;
  color: var(--secondary-color);
}
.stock-message {
  font-weight: 700;
  margin: 5px 0;
  font-size: 0.9rem;
}
.low-stock {
  color: var(--stock-low);
}
.out-of-stock {
  color: var(--stock-out);
}

/* Value Proposition */
.value-prop-section {
  background-color: var(--bg-light);
  padding: 40px 0;
  text-align: center;
}
.value-prop-section h2 {
  font-size: 1.5rem;
  margin-bottom: 30px;
  color: var(--secondary-color);
}

.value-prop-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.prop-item {
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.prop-item img {
  border-radius: 50%;
  margin-bottom: 10px;
}
.prop-item i {
  color: var(--primary-color);
  margin-bottom: 10px;
}
.prop-item p {
  font-weight: 600;
  color: var(--secondary-color);
}
.prop-item small {
  display: block;
  color: #666;
  margin-top: 5px;
}

/* --- Modal Styles (NEW) --- */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
}

.modal-content {
  background-color: #fff;
  margin: 15% auto;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.close-btn {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}
.close-btn:hover {
  color: var(--primary-color);
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed #eee;
}

.item-details {
  display: flex;
  flex-direction: column;
  text-align: left;
}
.item-details strong {
  font-size: 1rem;
}

.item-price {
  font-weight: 700;
  color: var(--primary-color);
}

.remove-btn {
  background: none;
  border: none;
  color: #dc3545;
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.cart-total {
  font-size: 1.2rem;
  font-weight: 700;
  text-align: right;
  margin: 15px 0;
  border-top: 2px solid var(--bg-light);
  padding-top: 10px;
}

.online-checkout-btn {
  width: 100%;
  padding: 12px;
}

/* Add this to your CSS for the quantity controls */
.quantity-controls {
  display: flex;
  align-items: center;
  gap: 8px; /* Space between buttons and quantity number */
  margin: 5px 0;
}

.btn-qty {
  background: #f0f0f0;
  color: #333;
  border: 1px solid #ccc;
  padding: 2px 8px;
  cursor: pointer;
  border-radius: 4px;
  font-weight: bold;
  line-height: 1;
}

.btn-qty:hover {
  background: #e0e0e0;
}

/* --- NEW STYLES FOR PDP, SEARCH, SORT, AND MODALS --- */

/* General Modal Content Styling (for PDP and Cart) */
.modal-content {
  padding: 20px;
}

/* Control Panel Layout */
.controls-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap; /* Allows wrapping on smaller screens */
}

.search-box {
  flex: 1 1 50%;
  min-width: 200px;
  margin-bottom: 10px;
}

#product-search,
#product-sort {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.sort-box {
  margin-left: 20px;
  margin-bottom: 10px;
}

.sort-box label {
  margin-right: 10px;
  font-weight: bold;
}

/* Product Detail Page (PDP) Modal Styles */
.pdp-container {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.pdp-image {
  flex: 1 1 300px;
}

.pdp-image img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.pdp-details {
  flex: 2 1 400px;
}

.pdp-details h2 {
  margin-top: 0;
}

.pdp-details .category-info {
  color: #6c757d;
  font-weight: 600;
}

.pdp-details .price-section {
  margin: 15px 0;
}

.pdp-details .price-section .price-new {
  font-size: 1.8em;
  font-weight: bold;
  color: #007bff; /* Primary blue for new price */
}

.pdp-details .price-section .price-old {
  font-size: 1em;
  color: #dc3545; /* Red for old price */
  text-decoration: line-through;
  margin-left: 10px;
}

.pdp-details .shipping-info {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #eee;
}

.pdp-details .add-to-cart-btn {
  width: 100%;
  margin-top: 25px;
  font-size: 1.1em;
}

/* Payment Status Modal Styles */
.payment-status-content {
  text-align: center;
  padding: 20px;
}

.status-icon-success {
  color: #28a745; /* Green */
  font-size: 40px;
  margin-bottom: 15px;
}

.status-icon-failure {
  color: #dc3545; /* Red */
  font-size: 40px;
  margin-bottom: 15px;
}

#status-ok-btn {
  margin-top: 20px;
}

/* --- NEW STYLES FOR TOAST NOTIFICATIONS --- */

/* The main container where all toasts stack up */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000; /* Ensure it's above all modals */
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Individual Toast Notification */
.toast {
  background-color: #343a40; /* Dark background */
  color: #fff;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  opacity: 0; /* Start invisible */
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
  transform: translateX(100%); /* Start off-screen */
  min-width: 250px;
  font-size: 1em;
}

/* Toast visible state */
.toast.show {
  opacity: 1;
  transform: translateX(0);
}

/* Specific style for success toast */
.toast.success {
  border-left: 5px solid #28a745; /* Green border */
}

/* --- FOOTER STYLING --- */

footer {
  background-color: #333; /* Dark background */
  color: #fff;
  padding: 30px 0;
  font-size: 0.9em;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap; /* Allows sections to stack on small screens */
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-section {
  flex: 1; /* Makes sections grow */
  min-width: 200px; /* Minimum width before stacking */
  margin-bottom: 20px;
}

.footer-section h4 {
  color: #ffd700; /* Gold/Yellow for headings */
  margin-bottom: 15px;
  font-size: 1.1em;
  border-bottom: 2px solid #555;
  padding-bottom: 5px;
}

.footer-section p,
.footer-section a,
.footer-section ul li {
  margin-bottom: 8px;
  line-height: 1.5;
  color: #ccc;
  text-decoration: none;
}

.footer-section a:hover {
  color: #fff;
  text-decoration: underline;
}

/* Social Media Icons */
.social-icons a {
  color: #fff;
  font-size: 1.5em;
  margin-right: 15px;
  transition: color 0.3s;
}

.social-icons a:hover {
  color: #ffd700; /* Highlight color on hover */
}

/* Quick Links List */
.footer-section ul {
  list-style: none;
  padding: 0;
}

/* --- Receipt Specific Styles for Print/Download --- */
/* --- Corrected CSS for Print/Download Receipt --- */
@media print {
  /* 1. HIDE EVERYTHING ON THE PAGE */
  body * {
    visibility: hidden !important;
  }

  /* 2. SHOW THE RECEIPT AND ITS CONTAINERS ONLY */

  .modal,
  .modal-content,
  .receipt-content {
    visibility: visible !important;
    position: static !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    /* 💥 NEW LINE: Forces the print to start here */
    page-break-before: always !important;
  }

  /* 3. ENSURE ALL TEXT/ITEMS WITHIN THE RECEIPT ARE VISIBLE */
  .receipt-content,
  .receipt-content *,
  .receipt-table,
  .receipt-table th,
  .receipt-table td {
    visibility: visible !important;
    /* Ensure table borders display cleanly for PDF */
    border: 1px solid #ccc !important;
    border-collapse: collapse !important;
  }

  /* 4. HIDE BUTTONS/CONTROLS FROM THE PRINTED OUTPUT */
  .close-btn,
  .receipt-footer {
    display: none !important;
  }
}

/* Responsive adjustment */
@media (max-width: 600px) {
  #toast-container {
    top: auto;
    bottom: 20px;
    right: 10px;
    left: 10px;
    align-items: center;
  }
}

/* Responsive adjustment for small screens */
@media (max-width: 600px) {
  .sort-box {
    margin-left: 0;
  }
}

/* Media Query for Tablet/Desktop */
@media (min-width: 768px) {
  .nav-links {
    display: flex;
    gap: 25px;
  }
  .nav-links a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
  }
  .nav-links a:hover {
    color: var(--primary-color);
  }

  .hero-content {
    flex-direction: row;
    text-align: left;
    padding: 40px 0;
  }
  .hero-text {
    flex: 1;
    padding-right: 30px;
  }
  .hero-image {
    max-width: 400px;
  }

  .category-links {
    flex-direction: row;
    justify-content: space-between;
  }
  .category-card {
    flex: 1;
    max-width: 48%;
  }

  .product-grid {
    grid-template-columns: repeat(4, 1fr); /* 4 columns on desktop */
  }

  .value-prop-grid {
    flex-direction: row;
    justify-content: space-around;
  }
  .prop-item {
    flex: 1;
    max-width: 30%;
  }
}
