/* Styles for the responsive product carousel */

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Arial", sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #fff;
}

/* Loading indicator styles */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  margin-top: 4rem;
  opacity: 1;
  transition: opacity 0.5s ease-out;
}

.loading-container.fade-out {
  opacity: 0;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e0e0e0;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 1.2rem;
  color: #666;
  font-weight: 500;
  margin: 0;
}

/* Carousel fade-in animation */
.carousel-container.fade-in {
  opacity: 1 !important;
  animation: fadeInUp 0.8s ease-out forwards;
}

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

/* Main container styles */
.main-container {
  padding: 2rem 1rem;
}

.carousel-container {
  max-width: 1200px;
  margin: 0 auto;
  margin-top: 4rem;
}

/* Carousel heading styles */
.carousel-heading {
  font-size: 2rem;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 1.5rem;
  text-align: left;
  margin-left: 0;
}

/* Screen reader only class for live regions */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Carousel component styles */
.c-carousel {
  position: relative;
  overflow: hidden;
  padding: 0 32px;
}

.c-carousel__track {
  display: flex;
  flex-wrap: nowrap;
  list-style: none;
  transition: transform 0.3s ease;
}

/* Product card styles */
.c-carousel__slide {
  flex: 0 0 calc(33.33% - 10px);
  max-width: 380px;
  margin: 0 5px;
  padding: 0;
  background-color: transparent;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  justify-content: stretch;
  min-height: 500px;
  position: relative;
  transition: all 0.3s ease;
}

/* Product Card Component */
.product-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #f5f5f5;
  border-radius: 8px;
  border: 1px solid #ddd;
  gap: 1rem;
  padding: 1rem;
}

.product-card__placeholder {
  font-size: 1.2rem;
  color: #666;
  font-weight: 500;
}

.product-card__btn {
  background-color: #3498db;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.product-card__btn:hover {
  background-color: #2980b9;
}

.product-card__btn:focus {
  outline: 2px solid #f39c12;
  outline-offset: 2px;
  background-color: #2980b9;
}

/* Navigation button styles */
.c-carousel__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: #3498db;
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.c-carousel__btn:hover {
  background-color: #2980b9;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.c-carousel__btn:active {
  transform: translateY(-50%) scale(0.95);
}

.c-carousel__btn--prev {
  left: 10px;
}

.c-carousel__btn--prev::before {
  content: "❮";
  display: block;
  line-height: 1;
}

.c-carousel__btn--next {
  right: 10px;
}

.c-carousel__btn--next::before {
  content: "❯";
  display: block;
  line-height: 1;
}

/* Ensure buttons are accessible */
.c-carousel__btn:focus {
  outline: 3px solid #f39c12;
  outline-offset: 2px;
}

/* Disabled button state */
.c-carousel__btn:disabled {
  cursor: not-allowed;
  background-color: #bdc3c7;
}

.c-carousel__btn:disabled:hover {
  background-color: #bdc3c7;
  transform: translateY(-50%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Off-screen content indicators */
.c-carousel::before,
.c-carousel::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 60px;
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.c-carousel::before {
  left: 0;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.8), transparent);
}

.c-carousel::after {
  right: 0;
  background: linear-gradient(to left, rgba(255, 255, 255, 0.8), transparent);
}

/* Hide indicators when not needed */
.c-carousel--at-start::before {
  opacity: 0;
}

.c-carousel--at-end::after {
  opacity: 0;
}

/* Pagination info styles */
.c-carousel__pagination-info {
  text-align: right;
  margin-bottom: 1rem;
}

.pagination-info__text {
  font-size: 0.9rem;
  color: #666;
  font-weight: 500;
}

.pagination-info__label,
.pagination-info__of {
  font-weight: 500;
  color: #333;
}

.pagination-info__range,
.pagination-info__total {
  font-weight: 500;
  color: #3498db;
}

/* Tablet breakpoint */
@media (max-width: 1199px) {
  .c-carousel__slide {
    flex: 0 0 calc(50% - 8px);
    max-width: 500px;
    margin: 0 4px;
    min-height: 480px;
  }

  .carousel-container {
    max-width: 900px;
  }

  .c-carousel {
    padding: 0 32px;
  }

  .c-carousel__btn {
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
  }

  .pagination-info__text {
    font-size: 0.85rem;
  }

  .c-carousel__pagination-info {
    padding-right: 50px;
  }

  .carousel-heading {
    font-size: 1.8rem;
  }

  .loading-container {
    min-height: 300px;
    margin-top: 3rem;
  }

  .loading-spinner {
    width: 45px;
    height: 45px;
  }

  .loading-text {
    font-size: 1.1rem;
  }
}

/* Mobile breakpoint */
@media (max-width: 799px) {
  .c-carousel__slide {
    flex: 0 0 calc(100% - 6px);
    max-width: 100%;
    margin: 0 3px;
    min-height: 450px;
  }

  .carousel-container {
    max-width: 100%;
  }

  .c-carousel {
    padding: 0 32px;
  }

  .c-carousel__btn {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .c-carousel__btn--prev {
    left: 5px;
  }

  .c-carousel__btn--next {
    right: 5px;
  }

  .c-carousel__slide h3 {
    font-size: 1.3rem;
  }

  .c-carousel__slide p {
    font-size: 0.95rem;
  }

  .product-btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }

  .main-container {
    padding: 1rem 0.5rem;
  }

  /* Adjust gradient indicators for mobile */
  .c-carousel::before,
  .c-carousel::after {
    width: 40px;
  }

  .pagination-info__text {
    font-size: 0.8rem;
  }

  .c-carousel__pagination-info {
    padding-right: 40px;
  }

  .carousel-heading {
    font-size: 1.6rem;
    margin-bottom: 1rem;
  }

  .loading-container {
    min-height: 250px;
    margin-top: 2rem;
  }

  .loading-spinner {
    width: 40px;
    height: 40px;
  }

  .loading-text {
    font-size: 1rem;
  }
}

/* Small mobile breakpoint */
@media (max-width: 479px) {
  .c-carousel {
    padding: 0 16px;
  }

  .c-carousel__btn {
    width: 35px;
    height: 35px;
    font-size: 1rem;
  }

  .c-carousel__slide {
    min-height: 420px;
  }

  .c-carousel__pagination-info {
    padding-right: 35px;
  }

  .carousel-heading {
    font-size: 1.4rem;
    margin-bottom: 0.8rem;
  }

  .loading-container {
    min-height: 200px;
    margin-top: 1.5rem;
  }

  .loading-spinner {
    width: 35px;
    height: 35px;
  }

  .loading-text {
    font-size: 0.9rem;
  }
}
