.modules {
    position: relative;
}

.modules__header{
    background: #E9E9E9;
    height: 30%;
}

.modules__select-list{
    display: flex;
    gap: 15px;
    height: 100%;
}

.modules__select-item{
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px;
    cursor: pointer;
}

.modules__select-item img{
    flex: 1 1 auto;
    height: 85px;
    width: 120px;
    max-height: calc(100% - 20px);
    min-height: 60px;
}

.modules__select-item.active{
    background: #FFFFFF;
}

.modules__select-item span{
    font-weight: 500;
    font-size: 11px;
    line-height: 18px;
}

.modules-list{
    height: 70%;
    overflow: auto;
    display: flex;
    flex-wrap: wrap;
}

.modules-list__item{
    padding: 0 10px 18px 10px;
    display: flex;
    flex-direction: column;
    max-height: 50%;
    max-width: calc(100% / 6);
    flex: 1 1 calc(100% / 6);
    cursor: pointer;
}

/* Disabled state until preview image loads */
.modules-list__item.--disabled{
  pointer-events: none;
  opacity: 0.6;
}

.modules-list__item .title{
  display: block;
  font-weight: 500;
  font-size: 11px;
  line-height: 14px;
  color: #636363;
  width: 100%;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  margin-bottom: 2px;
}
.modules-list__item .price {
  display: block;
  font-weight: 600;
  font-size: 11px;
  line-height: 14px;
  white-space: nowrap;
  margin-top: 4px;
}
.modules-list__size{
  font-weight: 500;
  font-size: 11px;
  line-height: 14px;
  color: #636363;
  margin: 0;
}

.modules-list__thumb{
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    min-height: 50px;
    margin-bottom: 8px;
}
.modules-list__thumb img{
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.25s ease;
}
.modules-list__thumb img.thumb-img.hover{
    opacity: 0;
}
.modules-list__item.--has-hover .modules-list__thumb img.thumb-img.hover{
    pointer-events: none;
}
.modules-list__item.--has-hover:hover .modules-list__thumb img.thumb-img.hover{
    opacity: 1;
}
.modules-list__item.--has-hover:hover .modules-list__thumb img.thumb-img.primary{
    opacity: 0;
}

/* Skeleton loader */
@keyframes modules-skeleton-loading {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.modules__select-item img.is-loading,
.modules-list__thumb img.is-loading{
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
  background-size: 200% 100%;
  animation: modules-skeleton-loading 1.2s ease-in-out infinite;
}

/* Card skeletons for modules-list */
.modules-list__item.--skeleton {
  display: flex;
  flex-direction: column;
  min-height: 50px;
}
.modules-list__item.--skeleton .skeleton-img,
.modules-list__item.--skeleton .skeleton-line{
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
  background-size: 200% 100%;
  animation: modules-skeleton-loading 1.2s ease-in-out infinite;
  border-radius: 6px;
}
.modules-list__item.--skeleton .skeleton-img{
  height: 50px;
  width: 100%;
}
.modules-list__item.--skeleton .skeleton-line{
  height: 12px;
  margin-top: 6px;
}

@media (max-width:709px) {
    .modules__select-list {
        gap: 0;
        overflow-x: auto;
    }

    .modules__select-list::-webkit-scrollbar {
        display: none;
    }   
    .modules__select-list {
        -ms-overflow-style: none; 
        scrollbar-width: none;
    }

    .modules__select-item {
        flex: 0 0 130px;
    }

    .modules-list {
        height: 300px;
    }

    .modules-list__item {
    max-width: calc(100% / 3);
    flex: 1 1 calc(100% / 3);
}

/* Global loader overlay inside .modules */
.modules__loader{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.75);
  z-index: 3;
}
.modules__spinner{
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid #E0E0E0;
  border-top-color: #7A0E30;
  animation: modules-spinner-rotate 0.8s linear infinite;
}
@keyframes modules-spinner-rotate{
  to { transform: rotate(360deg); }
}
}
