/* 
   Main Stylesheet for Manus E-Commerce Website
   A conversion from Next.js to PHP
*/

/* Global Styles */
:root {
  --primary-color: #3f51b5;
  --secondary-color: #f50057;
  --accent-color: #ff4081;
  --text-color: #333;
  --light-gray: #f5f5f5;
  --medium-gray: #e0e0e0;
  --dark-gray: #757575;
  --white: #ffffff;
  --black: #000000;
  --success: #4caf50;
  --warning: #ff9800;
  --danger: #f44336;
  --info: #2196f3;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
  color: var(--text-color);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Force Inter font on all Bootstrap elements */
* {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

/* Specific Bootstrap overrides */
.container, .container-fluid, .row, .col, [class*="col-"] {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--accent-color);
}

/* Typography Improvements */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.025em;
  margin-bottom: 1rem;
}

h1 { font-size: 2.25rem; font-weight: 700; }
h2 { font-size: 1.875rem; font-weight: 600; }
h3 { font-size: 1.5rem; font-weight: 600; }
h4 { font-size: 1.25rem; font-weight: 500; }
h5 { font-size: 1.125rem; font-weight: 500; }
h6 { font-size: 1rem; font-weight: 500; }

/* Improved button typography */
.btn {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 500;
  letter-spacing: 0.025em;
}

/* Better text readability */
p, .text-muted {
  font-weight: 400;
  line-height: 1.6;
}

.text-muted {
  color: #6b7280 !important;
}

/* Price typography */
.product-price, .product-details-price {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 600;
  letter-spacing: -0.025em;
}

/* Navigation typography */
.navbar-brand h1 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 700;
  letter-spacing: -0.05em;
}

.nav-link {
  font-weight: 500;
}

/* Header Styles */
.navbar {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand h1 {
  margin-bottom: 0;
}

/* Hero Section */
.hero {
  background-color: var(--light-gray);
  padding: 5rem 0;
  margin-bottom: 3rem;
}

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

/* Product Cards */
.product-card {
  border: 1px solid var(--medium-gray);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: 100%;
}

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

.product-img-container {
  position: relative;
  padding-top: 100%; /* 1:1 Aspect Ratio */
  overflow: hidden;
  background-color: var(--light-gray);
}

.product-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Placeholder for missing product images */
.product-img[src$="placeholder.jpg"] {
  object-fit: contain;
  padding: 20%;
  background-color: var(--light-gray);
}

.product-card-body {
  padding: 1.25rem;
}

.product-title {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.product-price {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.product-price .sale-price {
  color: var(--secondary-color);
  margin-right: 0.5rem;
}

.product-price .original-price {
  text-decoration: line-through;
  color: var(--dark-gray);
  font-weight: 400;
  font-size: 0.9rem;
}

/* Product Details Page */
.product-details {
  margin-top: 2rem;
}

.product-details-img {
  width: 100%;
  border-radius: 8px;
}

.product-details-info h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.product-details-price {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
}

.product-details-description {
  margin-bottom: 2rem;
}

.quantity-selector {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
}

.quantity-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--light-gray);
  border: 1px solid var(--medium-gray);
  cursor: pointer;
  font-weight: 600;
  font-size: 18px;
  color: var(--text-color);
  transition: all 0.2s ease;
  user-select: none;
  border-radius: 4px;
}

.quantity-btn:hover {
  background-color: var(--primary-color);
  color: var(--white);
  border-color: var(--primary-color);
}

.quantity-btn:active {
  transform: scale(0.95);
}

.quantity-btn.updating {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.quantity-btn.updating:hover {
  background-color: var(--light-gray);
  color: var(--text-color);
  border-color: var(--medium-gray);
}

.quantity-input {
  width: 60px;
  height: 40px;
  text-align: center;
  border: 1px solid var(--medium-gray);
  border-left: none;
  border-right: none;
  font-weight: 500;
  background-color: var(--white);
  border-radius: 0;
}

.quantity-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(63, 81, 181, 0.2);
}

/* Cart Styles */
.cart-item {
  border-bottom: 1px solid var(--medium-gray);
  padding: 1.5rem 0;
}

.cart-item-img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 4px;
}

.cart-summary {
  background-color: var(--light-gray);
  padding: 1.5rem;
  border-radius: 8px;
}

/* Checkout Styles */
.checkout-form {
  margin-top: 2rem;
}

.checkout-form .form-group {
  margin-bottom: 1.5rem;
}

/* Footer Styles */
footer {
  margin-top: 4rem;
}

.social-links a {
  font-size: 1.2rem;
  margin-right: 1rem;
}

/* === START: CONSOLIDATED & DEFINITIVE MOBILE STYLES === */

@media (max-width: 767.98px) {
  /* --- General Mobile Styles (for Home Page, etc.) --- */

  .hero {
    padding: 3rem 0;
  }
  .hero h2 {
    font-size: 2rem;
  }
  .cart-item-img {
    width: 60px;
    height: 60px;
  }

  /* --- Product Card Styles (for Home Page) --- */

  /*
    This is the original rule for product cards on your home page.
    We are keeping it but making sure it doesn't affect the product details page
    by adding the ':not(.product-details)' selector.
  */
  .product-card:not(.product-details) .product-img-container {
    padding-top: 100%; /* This is the rule that was causing the conflict */
  }

  .product-card {
    margin-bottom: 1.5rem;
  }
  .product-title {
    font-size: 1rem;
  }
  .product-price {
    font-size: 1.1rem;
  }

  /* --- Product Details Page Full-Width Image Styles --- */

  /*
    This is the specific, correct code for making the product page image full-width.
    It will now work because we have resolved the conflict from the rule above.
  */
  .product-details.row {
    margin-left: calc(-1 * var(--bs-gutter-x, 0.75rem));
    margin-right: calc(-1 * var(--bs-gutter-x, 0.75rem));
  }
  .product-details > .col-md-6:first-child {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  .product-details .product-img-container {
    width: 100% !important;
    height: auto !important;
    padding-top: 0 !important; /* This is critical to override the conflicting rule */
    aspect-ratio: 1 / 1;
    border: none !important;
    border-radius: 0 !important;
  }
  .product-details .product-details-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }
  .product-details .product-details-info {
    padding-left: var(--bs-gutter-x, 0.75rem) !important;
    padding-right: var(--bs-gutter-x, 0.75rem) !important;
    margin-top: 20px !important;
  }
}

/* Further overrides for very small screens */
@media (max-width: 480px) {
  .product-card .product-img-container {
    padding-top: 100%;
  }
  .product-card {
    margin-bottom: 1rem;
  }
  .product-title {
    font-size: 0.9rem;
  }
  .product-price {
    font-size: 1rem;
  }
}

/* === END: CONSOLIDATED & DEFINITIVE MOBILE STYLES === */