/* Category Card Header */
.category-card__header,
.modal-category-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  gap: 1.5rem;
}

.category-card__header-left,
.modal-category-card__header-left {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
}

.category-card__header-text,
.modal-category-card__header-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

/* When expanded, text only takes content width */
.category-card--expanded .category-card__header-text,
.modal-category-card--expanded .modal-category-card__header-text {
  flex: 0 0 auto;
  width: fit-content;
}

/* Back Button - Hidden by default */
.category-card__back-btn,
.modal-category-card__back-btn {
  display: none;
}

/* Expanded Content - Hidden by default */
.category-card__expanded-content,
.modal-category-card__expanded-content {
  opacity: 0;
  pointer-events: none;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.2s ease-in-out;
  margin-top: 0;
}

.category-card__form,
.modal-category-card__form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 0;
}

.category-card__description,
.modal-category-card__description {
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
  padding: 0 0 0.5rem;
}

.container-wrap input[type=text].category-card__input,
.modal-category-card__input {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
  background: #edf7f4 !important;
  font-size: 0.9rem;
}

.container-wrap input[type=text].category-card__input:focus,
.modal-category-card__input:focus {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
  background: #dff2ec !important;
}

.container-wrap input[type=text].category-card__input::placeholder,
input[type=text].modal-category-card__input::placeholder {
  color: #a7bdb8 !important
}

/* Learn More Button */
.category-card__learn-more-btn,
.modal-category-card__learn-more-btn {
  display: inline-flex;
  text-align: center;
  text-decoration: none;
  margin-top: 0.5rem;
}

/* Expanded State */
.category-card--expanded,
.modal-category-card--expanded {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  min-height: 100% !important;
  height: auto !important;
  cursor: default;
  padding: 3rem;
  border-radius: var(--border-radius-p) !important;
  z-index: 10;
  margin: 0 !important;
  overflow: visible !important;
}

.category-card--expanded {
  width: calc(100% - 2rem) !important;
  height: auto !important;
  min-height: calc(100% - 2rem);
  top: 1rem !important;
  left: 1rem !important;
  bottom: auto !important;
  right: auto !important;
}

.category-card--expanded h3.category-card__title,
.modal-category-card--expanded h3.modal-category-card__title {
  font-size: 2rem !important;
  line-height: 2rem !important;
}

.category-card--expanded .category-card__count,
.modal-category-card--expanded .modal-category-card__count {
  font-size: 0.9rem;
}

.category-card--expanded .category-card__back-btn,
.modal-category-card--expanded .modal-category-card__back-btn {
  display: block;
  min-width: 5rem;
}

.category-card--expanded .category-card__content,
.modal-category-card--expanded .modal-category-card__content {
  height: 100%;
  flex: 1;
}

.category-card--expanded .category-card__expanded-content,
.modal-category-card--expanded .modal-category-card__expanded-content {
  opacity: 1;
  pointer-events: all;
  max-height: none;
  overflow: visible;
  margin-top: 1rem;
  transition: opacity 0.3s ease-in-out 0.2s;
  flex: 1;
}

.all-categories-expanded .category-card.category-card--expanded {
  min-height: auto !important;
}

/* Fading State for Sibling Cards */
.category-card--fading,
.modal-category-card--fading {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
}

/* More Card Styles */
/*
.category-card--more {
background: #f8f8f8;
border-color: #d5d5d5;
}

.category-card--more:hover {
border-color: #999;
background: #efefef;
} */

.category-card--more .category-card__title,
.modal-category-card--more .modal-category-card__title {
  color: var(--text-link);
  font-size: 0.9rem !important;
  margin-bottom: 0.2rem !important;
}

.category-card--more .category-card__count,
.modal-category-card--more .modal-category-card__count {
  font-size: 1.4rem !important;
  color: var(--text-link);
}

/* Hide scroll indicator on desktop */
.category-scroll-indicator {
  display: none;
}

/* Responsive: Single column on mobile */
@media only screen and (max-width: 640px) {

  .home-category-cards.has-expanded-card .all-categories-scrollable {
    overflow: hidden !important;
  }

  .home-category-cards.has-expanded-card .category-scroll-indicator {
    opacity: 0 !important;
  }

  .category-card--expanded h3.category-card__title,
  .modal-category-card--expanded h3.modal-category-card__title {
    font-size: 1.5rem !important;
    line-height: 1.8rem !important;
  }

  .category-card--expanded .category-card__expanded-content,
  .modal-category-card--expanded .modal-category-card__expanded-content {
    margin-top: 0.7rem;
  }

  .home-category-cards {
    display: block !important;
    grid-template-columns: 1fr !important;
    gap: 0 !important;
    position: relative;
    overflow: visible !important;
    min-height: auto !important;
    margin-bottom: 0 !important;
  }


  .all-categories-scrollable {
    display: flex !important;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 60vh;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    width: 100%;
    min-height: auto !important;
    position: relative;
    padding: 0;
  }

  /* Prevent horizontal overflow on category cards */
  .category-card,
  .modal-category-card {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
  }

  /* Custom scrollbar styling for mobile */
  .all-categories-scrollable::-webkit-scrollbar {
    width: 8px;
  }

  .all-categories-scrollable::-webkit-scrollbar-track {
    background: #eaf3ef;
    border-radius: 4px;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
  }

  .all-categories-scrollable::-webkit-scrollbar-thumb {
    background: #7DA79A;
    border-radius: 4px;
  }

  .all-categories-scrollable::-webkit-scrollbar-thumb:hover {
    background: #2F9376;
  }

  /* Scroll for more indicator */
  .category-scroll-indicator {
    display: block;
    text-align: center;
    margin-top: 0;
    padding: 0.5rem 0 0;
    font-size: 0.9rem;
    color: #4b8f7a70;
    font-weight: 600;
    opacity: 1;
    transition: opacity 0.3s ease;
  }

  .category-scroll-indicator.hidden {
    opacity: 0;
    display: block !important;
  }

  .category-card__title,
  .modal-category-card__title {
    font-size: 1rem;
  }

  .category-card__count,
  .modal-category-card__count {
    font-size: 0.85rem;
  }

  /* Mobile expanded state adjustments */
  .category-card--expanded,
  .modal-category-card--expanded {
    padding: 1.5rem;
  }

  .category-card__input,
  .modal-category-card__input {
    font-size: 0.95rem;
  }

  .category-card__create-btn,
  .modal-category-card__create-btn,
  .category-card__learn-more-btn,
  .modal-category-card__learn-more-btn {
    width: 100%;
    align-self: stretch;
  }
}
