/* 
 * Main styles for ShopEase ecommerce site
 * A pure HTML/CSS/JS implementation with component-based architecture
 */

/* Base styles and resets */
:root {
  --primary: #0d6efd; /* Header bar blue */
  --primary-dark: #0b5ed7;
  --primary-light: #3b82f6;
  --secondary: #6c757d; /* Neutral gray */
  --dark: #000000; /* Background black */
  --text: #c0c0c0; /* Light gray text */
  --text-light: #ffffff; /* White text */
  --gray: #6b7280; /* Muted gray */
  --light-gray: #222222; /* Light black */
  --danger: #dc3545; /* Red for errors */
  --success: #198754; /* Green for success */
  --border-radius: 0.375rem;
  --transition: all 0.3s ease;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
}

body {
  font-family: "Inter", sans-serif;
  color: var(--text);
  line-height: 1.6;
  background-color: var(--dark);
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

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

a:hover {
  color: var(--primary-light);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-light);
  margin-bottom: 1rem;
}

p {
  color: var(--text);
  margin-bottom: 1rem;
}

/* Button overrides */
.btn {
  border-radius: var(--border-radius);
  transition: var(--transition);
  font-weight: 500;
  padding: 0.5rem 1.25rem;
}

.btn-primary {
  background-color: #333333;
  border-color: #444444;
  color: #c0c0c0;
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: #444444;
  border-color: #555555;
  color: #ffffff;
}

.btn-outline-primary {
  color: #c0c0c0;
  border-color: #444444;
  background-color: transparent;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background-color: #333333;
  border-color: #555555;
  color: #ffffff;
}

/* Cards */
.card {
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  border: 1px solid rgba(192, 192, 192, 0.2);
  background-color: var(--light-gray);
  color: var(--text);
  height: 100%; /* Make the card take up the full height of its container */
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* Space out content evenly */
}

.card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card-img-top {
  width: 100%; /* Make the image take the full width of the container */
  height: 200px; /* Set a fixed height for consistency */
  object-fit: cover; /* Maintain aspect ratio and crop excess */
  border-radius: 0.25rem; /* Optional: Add rounded corners */
  height: 200px; /* Set a fixed height for product images */
  object-fit: cover; /* Ensure the image fits within the box without distortion */
}

.card-body {
  flex-grow: 1; /* Allow the body to grow and fill available space */
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* Space out content evenly */
}

.card-title {
  font-size: 1.25rem; /* Ensure consistent title size */
  margin-bottom: 0.5rem;
  color: var(--text-light);
}

.card-text {
  flex-grow: 1; /* Allow the description to grow and fill available space */
  margin-bottom: 1rem;
  color: var(--text);
}

.price {
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.add-to-cart-btn {
  margin-top: auto; /* Push the button to the bottom of the card */
  background-color: var(--primary);
  color: var(--text-light);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  transition: var(--transition);
}

.add-to-cart-btn:hover {
  background-color: var(--primary-dark);
}

/* Badge overwrites */
.badge {
  font-weight: 500;
  padding: 0.35em 0.65em;
}

/* Form controls */
.form-control,
.form-select {
  border-radius: var(--border-radius);
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(192, 192, 192, 0.3);
  background-color: #111111;
  color: var(--text);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
  background-color: #111111;
}

/* Sections */
.section {
  padding: 5rem 0;
}

.section-sm {
  padding: 3rem 0;
}

.section-title {
  font-weight: 700;
  margin-bottom: 2.5rem;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -10px;
  width: 50px;
  height: 3px;
  background-color: var(--primary);
}

.section_header {
  font-family: "Arial Black", Arial, Helvetica, sans-serif;
  font-size: 1.8rem;
  text-transform: uppercase;
  font-weight: bold;
  color: white;
  letter-spacing: 1px;
}

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.product-card {
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  background-color: #111111;
  border: 1px solid rgba(192, 192, 192, 0.2);
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
  border-color: rgba(192, 192, 192, 0.4);
}

.product-img {
  height: 200px;
  overflow: hidden;
  position: relative;
}

.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.product-card:hover .product-img img {
  transform: scale(1.05);
}

.product-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  font-size: 0.75rem;
}

.product-info {
  padding: 1.25rem;
  color: var(--text);
}

.product-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  color: var(--text);
}

.product-price {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.product-description {
  font-size: 0.875rem;
  color: rgba(192, 192, 192, 0.8);
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Utilities */
.bg-light-gray {
  background-color: var(--light-gray);
}

.text-primary {
  color: var(--primary) !important;
}

.text-secondary {
  color: var(--secondary) !important;
}

.shadow-hover {
  transition: var(--transition);
}

.shadow-hover:hover {
  box-shadow: var(--shadow);
}

/* Responsive adjustments */
@media (max-width: 992px) {
  .section {
    padding: 4rem 0;
  }

  .section-sm {
    padding: 2.5rem 0;
  }
}

@media (max-width: 768px) {
  .section {
    padding: 3rem 0;
  }

  .section-sm {
    padding: 1.5rem 0;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .section_header {
    font-size: 1.5rem; /* Reduce font size for smaller screens */
  }
}

@media (max-width: 576px) {
  .product-grid {
    grid-template-columns: 1fr;
  }

  .section_header {
    font-size: 1.2rem; /* Further reduce font size for very small screens */
  }
}

/* Animation utilities */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.slide-up {
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Toast notification */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}

.toast {
  min-width: 250px;
  max-width: 350px;
  background-color: #111111;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  transform: translateX(100%);
  opacity: 0;
  transition:
    transform 0.3s ease-out,
    opacity 0.3s ease;
  border: 1px solid rgba(192, 192, 192, 0.2);
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  color: var(--text);
  border-bottom: 1px solid rgba(192, 192, 192, 0.1);
  padding-bottom: 0.5rem;
}

.toast-body {
  font-size: 0.875rem;
  color: rgba(192, 192, 192, 0.9);
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-warning {
  border-left: 4px solid var(--warning);
}

.toast-error {
  border-left: 4px solid var(--danger);
}

/* Accessibility utilities */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
