/* ===== REUSABLE STYLE SELECTOR MODULE CSS ===== */

/* ===== SELECTED STYLE PREVIEW (ALWAYS VISIBLE) ===== */

.selected-style-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
}

.selected-style-preview:hover {
  border-color: rgba(75, 93, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.selected-style-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.selected-style-image-container {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.selected-style-image-container.compact {
  width: 60px;
  height: 60px;
}

.selected-style-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.selected-style-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.selected-style-label {
  font-size: 0.8rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.selected-style-name {
  font-size: 1rem;
  color: #fff;
  font-weight: 600;
}

.style-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: rgba(75, 93, 255, 0.1);
  border: 1px solid rgba(75, 93, 255, 0.3);
  border-radius: 8px;
  color: #4b5dff;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.style-toggle-btn.compact {
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
}

.style-toggle-btn:hover {
  background: rgba(75, 93, 255, 0.2);
  border-color: rgba(75, 93, 255, 0.5);
  transform: translateY(-1px);
}

.toggle-icon {
  transition: transform 0.3s ease;
}

.toggle-icon.rotated {
  transform: rotate(180deg);
}

/* ===== COLLAPSIBLE STYLE SELECTOR CONTAINER ===== */

.style-selector-container {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease, overflow 0s ease 0.4s;
  opacity: 0;
  margin-bottom: 0;
  position: relative;
  z-index: 50;
}

.style-selector-container.expanded {
  max-height: none;
  overflow: visible;
  transition: max-height 0.4s ease, opacity 0.3s ease, overflow 0s ease 0s;
  opacity: 1;
  margin-bottom: 1rem;
  z-index: 50;
}

.style-selector-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding-top: 1rem;
}

.style-selector-grid.compact {
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
}

/* ===== STYLE OPTIONS ===== */

.style-option {
  position: relative;
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem;
  opacity: 0;
  transform: translateY(20px);
  animation: styleOptionFadeIn 0.5s ease-out forwards;
}

.style-option:hover {
  transform: translateY(-2px);
  border-color: rgba(75, 93, 255, 0.3);
  box-shadow: 0 8px 25px rgba(75, 93, 255, 0.2);
}

.style-option.selected {
  border-color: #4b5dff;
  background: rgba(75, 93, 255, 0.1);
  box-shadow: 0 8px 25px rgba(75, 93, 255, 0.3);
}

.style-image-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.style-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.style-option:hover .style-image {
  transform: scale(1.05);
}

.style-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.style-option.selected .style-overlay {
  opacity: 1;
}

.style-checkmark {
  width: 32px;
  height: 32px;
  background: #4b5dff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transform: scale(0.8);
  transition: transform 0.3s ease;
}

.style-option.selected .style-checkmark {
  transform: scale(1);
}

.style-label {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 500;
  color: #ccc;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.3s ease;
}

.style-option.selected .style-label {
  color: #4b5dff;
  font-weight: 600;
}

.style-option:hover .style-label {
  color: #fff;
}

/* ===== FILTER MODE STYLES ===== */

.style-filter-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.style-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.style-filter-option {
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  color: #ccc;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.style-filter-option:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(75, 93, 255, 0.3);
  color: #fff;
  transform: translateY(-1px);
}

.style-filter-option.selected {
  background: rgba(75, 93, 255, 0.2);
  border-color: #4b5dff;
  color: #4b5dff;
  font-weight: 600;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet */
@media (max-width: 768px) {
  .style-selector-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
  }
  
  .style-selector-grid.compact {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }
  
  .style-option {
    padding: 0.4rem;
  }
  
  .style-label {
    font-size: 0.75rem;
  }
  
  .style-checkmark {
    width: 28px;
    height: 28px;
  }
  
  .selected-style-image-container {
    width: 70px;
    height: 70px;
  }
  
  .selected-style-image-container.compact {
    width: 50px;
    height: 50px;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .style-selector-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }
  
  .style-selector-grid.compact {
    grid-template-columns: repeat(1, 1fr);
    gap: 0.5rem;
  }
  
  .style-option {
    padding: 0.3rem;
  }
  
  .style-label {
    font-size: 0.7rem;
  }
  
  .style-checkmark {
    width: 24px;
    height: 24px;
  }
  
  .selected-style-preview {
    padding: 0.8rem;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .selected-style-container {
    justify-content: center;
  }
  
  .selected-style-image-container {
    width: 60px;
    height: 60px;
  }
  
  .selected-style-image-container.compact {
    width: 45px;
    height: 45px;
  }
  
  .style-toggle-btn {
    width: 100%;
    justify-content: center;
  }
  
  .style-filter-options {
    justify-content: center;
  }
  
  .style-filter-option {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
}

/* ===== ANIMATION KEYFRAMES ===== */

@keyframes styleOptionFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Staggered animation delays for style options */
.style-option:nth-child(1) { animation-delay: 0.1s; }
.style-option:nth-child(2) { animation-delay: 0.15s; }
.style-option:nth-child(3) { animation-delay: 0.2s; }
.style-option:nth-child(4) { animation-delay: 0.25s; }
.style-option:nth-child(5) { animation-delay: 0.3s; }
.style-option:nth-child(6) { animation-delay: 0.35s; }
.style-option:nth-child(7) { animation-delay: 0.4s; }
.style-option:nth-child(8) { animation-delay: 0.45s; }
.style-option:nth-child(9) { animation-delay: 0.5s; }
.style-option:nth-child(10) { animation-delay: 0.55s; }
.style-option:nth-child(11) { animation-delay: 0.6s; }
.style-option:nth-child(12) { animation-delay: 0.65s; }
.style-option:nth-child(13) { animation-delay: 0.7s; }
.style-option:nth-child(14) { animation-delay: 0.75s; }
.style-option:nth-child(15) { animation-delay: 0.8s; }
.style-option:nth-child(16) { animation-delay: 0.85s; }
.style-option:nth-child(17) { animation-delay: 0.9s; }
.style-option:nth-child(18) { animation-delay: 0.95s; }
.style-option:nth-child(19) { animation-delay: 1s; }
.style-option:nth-child(20) { animation-delay: 1.05s; }

/* ===== COMPACT MODE SPECIFIC OVERRIDES ===== */

.selected-style-preview.compact-mode {
  padding: 0.8rem;
}

.style-selector-container.compact-mode {
  z-index: 40; /* Slightly lower than full mode to prevent conflicts */
}

.style-selector-container.compact-mode .style-option {
  padding: 0.4rem;
}

.style-selector-container.compact-mode .style-label {
  font-size: 0.75rem;
}

.style-selector-container.compact-mode .style-checkmark {
  width: 28px;
  height: 28px;
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */

.style-option:focus {
  outline: 2px solid #4b5dff;
  outline-offset: 2px;
}

.style-toggle-btn:focus {
  outline: 2px solid #4b5dff;
  outline-offset: 2px;
}

.style-filter-option:focus {
  outline: 2px solid #4b5dff;
  outline-offset: 2px;
}

/* ===== HIGH CONTRAST MODE SUPPORT ===== */

@media (prefers-contrast: high) {
  .style-option {
    border-width: 3px;
  }
  
  .style-option.selected {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.2);
  }
  
  .style-toggle-btn {
    border-width: 2px;
  }
  
  .style-filter-option.selected {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
  }
}

/* ===== REDUCED MOTION SUPPORT ===== */

@media (prefers-reduced-motion: reduce) {
  .style-option,
  .style-toggle-btn,
  .style-filter-option,
  .style-image,
  .style-checkmark,
  .toggle-icon {
    transition: none;
    animation: none;
  }
  
  .style-option {
    opacity: 1;
    transform: none;
  }
}
