/* === Global Styles & Variables === */
:root {
    --primary-color: #007BFF;
    --primary-hover: #0056b3;
    --success-color: #28a745;
    --success-hover: #218838;
    --danger-color: #dc3545;
    --danger-hover: #c82333;
    --warning-color: #ff1010;
    --warning-hover: #c00;
    --overlay-bg: rgba(0, 0, 0, 0.5);
    --border-radius: 8px;
    --spacing: 1rem;
    --font-size: 16px;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;

    /* Remove flex layout from body unless you're intentionally doing this */
    display: block;
    overflow-x: hidden; /* Prevents horizontal scrolling */
}



.content-wrapper {
    flex: 1;
}

/* === Product Grid === */
.products {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 1rem;
    gap: 1rem; /* optional: adds spacing between items */
}

.product {
    display: flex;
    flex-direction: column; /* Arrange items vertically */
    align-items: flex-start; /* Align items to the left */
    justify-content: flex-start; /* Align items to the top */
    flex: 1 1 calc(33.333% - 2rem); /* roughly 3 per row with some gap */
    max-width: 300px; /* optional: limits max width per item */
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    text-align: left; /* Set the text alignment to left */
}

.product img {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius);
}

/* Adjusting product header spacing */
.product h3 {
    margin: 0.5rem 0;
    margin-bottom: -5px; /* Reduce the space between header and stars */
}

/* Adjusting star rating container */
.product .rating {
    margin-top: 0; /* Remove any space before the stars */
    padding-top: 0; /* Remove top padding if any */
}

/* === Rating and Star Styles === */
.rating {
    display: flex; /* Use flexbox to align stars horizontally */
    margin-top: 5px; /* Small gap between the product name and stars */
    font-size: 20px;
}

/* Full stars */
.rating .full {
    color: gold; /* Yellow color for full stars */
}

/* Empty stars */
.rating .empty {
    color: lightgray; /* Light gray for empty stars */
}

/* Half stars */
.rating .half {
    color: gold; /* Yellow for half stars */
}

/* === Description & Price === */
.description {
    font-size: 0.9rem;
    color: #666;
    
}

/* Price styling */
.product-price {
    font-size: 1.1rem;
    color: #e00000;
    margin-top: 0px; /* Space between the description and price */
    text-align: left; /* Ensure the price is left-aligned */
    width: 100%; /* Ensure it takes up the full width of its parent */
    box-sizing: border-box; /* Include padding in width calculation */
    font-weight: bold; /* Makes the price text bold */
}

/* Optional: Adjusting margin between description and price */
.product-description {
    margin-bottom: 3.5px;
    margin-top: -3.5px;
}


/* === Button Styles === */
/* Only apply to product-related buttons */
.products button button:not(.carousel-btn),
.reset-btn,
.view-item-btn,
.add-to-cart-btn,
.checkout-btn,
#shipping-btn,
#payment-btn,
#purchase-btn,
#close-confirmation-btn {
    display: block;
    margin-top: var(--spacing);
    width: 100%;
    padding: 0.5rem;
    font-size: var(--font-size);
    border-radius: 5px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}


button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.products .product button:hover {
    background-color: var(--success-hover);
}

/* Reset Button */
.reset-btn {
  background-color: var(--danger-color);
  color: white;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  display: block;
  margin: 1rem auto; /* This centers it horizontally */
  width: fit-content;
}



.reset-btn:hover {
    background-color: var(--danger-hover);
}

/* View Item Button */
.view-item-btn {
    background-color: var(--primary-color);
    color: white;
    margin-top: 0; /* Remove any space between the price and the button */
    padding: 0.5rem;
    width: 100%;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.view-item-btn:hover {
    background-color: var(--primary-hover);
}

/* Add to Cart Button */
.add-to-cart-btn {
    background-color: var(--success-color);
    color: white;
    margin-bottom: 1rem;
}

.add-to-cart-btn:hover {
    background-color: var(--warning-hover);
}


/* === Cart Sidebar === */
/* Cart Toggle Button */
.cart-toggle-btn {
    position: fixed;
    top: 3rem !important;;
    right: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0.5rem 1rem;
    font-size: 16px;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Slide-Out Cart Drawer */
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 300px;
  height: 100vh;
  background: white;
  box-shadow: -2px 0 5px rgba(0,0,0,0.2);

  transform: translateX(100%); /* start hidden off-screen */
  transition: transform 0.3s ease-in-out;
  z-index: 1000;
  /* remove display:none here */
}

/* Show drawer */
.cart-drawer.open {
  transform: translateX(0);
}

/* Cart Header */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    font-weight: bold;
}

.close-cart {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 24px;
  width: 32px;
  height: 32px;
  line-height: 32px;
  text-align: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #333;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.close-cart:hover {
  background-color: #eee;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  background-color: #f9f9f9;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: background-color 0.3s;
}

.cart-item:hover {
  background-color: #f1f1f1;
}


.cart-item-price {
  font-weight: bold;
  margin-left: 1rem;
}

.cart-item-remove-btn {
  background-color: transparent;
  border: none;
  color: var(--danger-color);
  cursor: pointer;
  margin-left: 1rem;
  font-size: 0.9rem;
}

.cart-item-remove-btn:hover {
  text-decoration: underline;
}

#cart-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 10px 16px;
  font-size: 18px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: background-color 0.3s ease;

  display: inline-block;
  width: auto;
  max-width: 200px;
  white-space: nowrap;
}

#cart-toggle:hover {
  background-color: #0056b3;
}

/* Cart Footer */
.cart-footer {
    padding: 1rem;
    border-top: 1px solid #eee;
}


.checkout-btn {
    background-color: var(--success-color);
    color: white;
    padding: 0.75rem;
    width: 100%;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
}
.checkout-btn:hover {
    background-color: var(--success-hover);
}


/* === Checkout and Payment Sections === */
.checkout,
.payment {
    display: none;
    padding: var(--spacing);
}



.checkout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  margin: 40px auto;
  padding: 30px;
  width: 100%;
  max-width: 500px;

  background-color: #fafafa;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
}

.checkout h3 {
  width: 100%;
  text-align: left;
  margin-bottom: 20px;
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

#cart-summary {
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

#cart-summary li {
  padding: 10px 0;
  border-bottom: 1px solid #ddd;
  font-size: 15px;
  color: #444;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#cart-summary li:last-child {
  border-bottom: none;
}

.checkout p {
  width: 100%;
  font-weight: 600;
  font-size: 18px;
  margin-top: 25px;
  color: #222;
  display: flex;
  justify-content: space-between;
}

/* Shipping Info Button (Checkout Step) */
#shipping-btn {
  background-color: var(--primary-color);
  color: white;
  padding: 10px 20px;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#shipping-btn:hover {
  background-color: #218838;
}

.shipping {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  margin: 40px auto;
  padding: 30px;
  width: 100%;
  max-width: 500px;

  background-color: #fafafa;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.shipping input[type="text"] {
  width: 100%;
  margin-bottom: 12px;
  padding: 12px;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
}


#payment-btn {
  background-color: var(--primary-color);
  color: white;
  padding: 10px 20px;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#payment-btn:disabled {
  background-color: #aaa;
  cursor: not-allowed;
}

#payment-btn:not(:disabled):hover {
  background-color: #0056b3;
}

/* Style the payment section container */
.payment {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  margin: 40px auto;
  padding: 30px;
  width: 100%;
  max-width: 500px;

  background-color: #fefefe;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

/* Style the section heading */
.payment h3 {
  font-size: 22px;
  margin-bottom: 20px;
  color: #333;
}

/* Style the input fields */
.payment input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 15px;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.payment input[type="text"]:focus {
  border-color: #007bff;
  outline: none;
}

/* Style the purchase button */
#purchase-btn {
  background-color: var(--success-color);
  color: white;
  padding: 10px 20px;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}


#purchase-btn:hover:not(:disabled) {
  background-color: #0056b3;
}

#purchase-btn:disabled {
  background-color: #a9a9a9;
  cursor: not-allowed;
}

/* Overlay container */
.purchase-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.purchase-box {
  background: white;
  padding: 20px 24px;
  border-radius: 8px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  /* Center the box itself */
  margin: 0 auto;
}

.purchase-box h2 {
  text-align: left; /* Center the heading */
  margin-bottom: 16px; /* some spacing below the heading */
}

.purchase-box p,
.purchase-box ul,
.purchase-box button {
  text-align: left; /* Left align the rest of the content */
}



/* Summary list styling */
#purchase-summary-list {
  list-style-type: none;
  padding-left: 0;
  margin: 15px 0;
}

#purchase-summary-list li {
  padding: 4px 0;
  font-size: 15px;
}

/* Close button */
#close-confirmation-btn {
  margin-top: 15px;
  padding: 10px 20px;
  font-size: 15px;
  border: none;
  background-color: var(--primary-color);
  color: white;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  text-align: center;
}

#close-confirmation-btn:hover {
  background-color: #0056b3;
}


/* Footer */
.footer, .footer * {
    background-color: #111;
    color: white !important;
    text-align: center;
    padding: 10px;
    width: 100%;
}



@media (max-width: 768px) {
  .products {
    justify-content: center;
  }

  .product {
    flex: 1 1 100%;
    max-width: 100%;
  }
}


