/* --- Global Styles & Variables --- */
:root {
  --brand-color: #000000;
  --background-color: #ffffff;
  --text-color: #000000;
  --text-light-gray: #444547;
  --border-color: #e5e7eb;
  --font-family: "Inter", sans-serif;
}

body {
  font-family: var(--font-family);
  background-color: var(--background-color);
  color: var(--text-color);
  margin: 0;
  padding: 40px 20px;
}

/* --- Main Layout Containers --- */
.main-container {
  max-width: 1400px;
  margin: 0 auto;
}

.main-heading {
  text-align: center;
  font-size: 2.25rem;
  font-weight: 600;
  margin-bottom: 40px;
}

.bundle-builder-container {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
}

/* --- Product Grid --- */
.product-grid {
  flex: 2.5;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.product-card {
  display: flex;
  flex-direction: column;
}

.product-image {
  width: 100%;
  aspect-ratio: 1 / 1.2;
  object-fit: cover;
  margin-bottom: 15px;
}

.product-title {
  font-size: 1rem;
  font-weight: 500;
  margin: 0 0 8px 0;
}

.product-price {
  font-size: 1rem;
  color: var(--text-light-gray);
  margin: 0 0 15px 0;
}

.add-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #fff;
  border: 1px solid var(--brand-color);
  padding: 12px 16px;
  width: 100%;
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.add-button .icon-check {
  display: none;
}

.add-button:hover {
  background-color: var(--brand-color);
  color: #fff;
  border-color: var(--brand-color);
}
.add-button.added {
  background-color: var(--text-light-gray);
  color: #fff;
  border: none;
}

.add-button.added .icon-plus {
  display: none;
}
.add-button.added .icon-check {
  display: block;
}

/* --- Sidebar --- */
.sidebar {
  flex: 0.8;
  border: 1px solid var(--brand-color);
  padding: 24px;
  display: flex;
  flex-direction: column;
  max-width: 400px;
  max-height: max-content;
}

.sidebar-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 8px 0;
}

.sidebar-subtitle {
  font-size: 0.875rem;
  color: var(--text-light-gray);
  margin: 0 0 16px 0;
}

.progress-bar-container {
  width: 100%;
  height: 4px;
  background-color: var(--border-color);
  border-radius: 2px;
}

.progress-bar-fill {
  width: 0;
  height: 100%;
  background-color: var(--brand-color);
  border-radius: 2px;
  transition: width 0.4s ease-in-out;
}

.selected-items-list {
  flex-grow: 1;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* --- Skeleton Styles --- */
.item-placeholder {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  width: 100%;
}

.skeleton {
  background-color: #e5e7eb;
  border-radius: 4px;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.skeleton-image {
  width: 90px;
  height: 90px;
  flex-shrink: 0;
}

.skeleton-info {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-text {
  height: 1rem;
  width: 85%;
}

.skeleton-text-short {
  width: 55%;
}

/* --- Selected Item Styles --- */
.selected-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.selected-item-img {
  width: 90px;
  height: 90px;
  object-fit: cover;
}

.item-details-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.selected-item-info {
  flex-grow: 1;
  margin-bottom: 12px;
}

.selected-item-title {
  font-weight: 500;
  margin: 0 0 8px 0;
}

.selected-item-price {
  color: var(--text-light-gray);
  margin: 0;
}

.selected-item-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quantity-stepper {
  display: flex;
  align-items: center;
  gap: 25px;
  border: 1px solid var(--border-color);
  padding: 4px;
}

.quantity-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  font-size: larger;
}

.remove-item-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.remove-item-btn svg {
  width: 20px;
  height: 20px;
  color: var(--text-light-gray);
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.totals-container {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.total-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.875rem;
}
.subtotal-line span:last-child {
  font-weight: 600;
}
.subtotal-line {
  font-size: 1.125rem;
  font-weight: 600;
}

.cta-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 16px;
  background-color: var(--brand-color);
  color: #fff;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
}

.cta-button:disabled {
  cursor: not-allowed;
}

.cta-button:disabled,
.cta-button.added-to-cart {
  background-color: var(--text-light-gray);
  color: var(--background-color);
}

.cta-button .icon-arrow {
  display: block;
}
.cta-button .icon-check {
  display: none;
}

.cta-button.added-to-cart .icon-arrow {
  display: none;
}
.cta-button.added-to-cart .icon-check {
  display: block;
}

.add-button:hover .icon-plus {
  filter: brightness(0) invert(1);
}

/* --- Responsive Design --- */
@media (max-width: 1200px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .sidebar {
    flex: 100%;
    max-width: 100%;
  }
  .bundle-builder-container {
    flex-direction: column;
  }
}

@media (max-width: 576px) {
  .main-heading {
    font-size: 1.75rem;
  }
  .product-grid {
    grid-template-columns: 1fr;
  }
}
