/* WooCommerce Categories Circle Widget Styles */

/* Base container styles */
.woo-categories-circle-container {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  padding: 20px 0;
}

/* Force slider layout - CRITICAL CSS OVERRIDE */
.woo-categories-circle-container.has-slider {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  scroll-behavior: smooth;
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
  grid-template-columns: unset !important;
  padding: 20px 0 !important;
  margin: 0 !important;
  width: 100% !important;
}

/* Hide scrollbar */
.woo-categories-circle-container.has-slider::-webkit-scrollbar {
  display: none;
}

/* Item styles */
.woo-category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Item styles for slider */
.woo-categories-circle-container.has-slider .woo-category-item {
  flex: 0 0 auto !important;
  margin: 0 10px !important;
  width: auto !important;
  min-width: 120px !important;
}

.woo-category-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.woo-category-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background-color: #f0f8ff;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible; /* Changed from hidden to visible */
  transition: all 0.3s ease;
  border: 2px solid transparent;
  box-sizing: border-box;
  position: relative;
}

.woo-category-circle:hover {
  border-color: #8b0000;
  transform: scale(1.05);
  transform-origin: center center; /* Added to ensure scaling from center */
  z-index: 10; /* Added to ensure hover appears above other elements */
}

.woo-category-image {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Changed from cover to contain */
  padding: 5px; /* Added padding */
}

.woo-category-placeholder {
  width: 100%;
  height: 100%;
  background-color: #e0e0e0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.woo-category-name {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.3s ease;
}

.woo-category-link:hover .woo-category-name {
  color: #8b0000;
}

/* Admin notice styles */
.woo-categories-admin-notice {
  margin-top: 15px;
  padding: 10px;
  background-color: #f7f7f7;
  border-left: 4px solid #0073aa;
  color: #333;
}

/* Admin sorting indicator */
.admin-sorting-indicator {
  background-color: #f7f7f7;
  border-left: 4px solid #0073aa;
  color: #333;
  padding: 10px 15px;
  margin-bottom: 15px;
  font-weight: bold;
}

/* Save button styles */
.woo-categories-save-button {
  margin: 15px 0;
  display: flex;
  align-items: center;
}

.woo-categories-save-button .save-status {
  margin-left: 10px;
  font-style: italic;
}

.woo-categories-save-button .save-status.success {
  color: green;
}

.woo-categories-save-button .save-status.error {
  color: red;
}

/* Drag indicator */
.woo-category-drag-indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 50%;
  z-index: 10;
}

.woo-category-item:hover .woo-category-drag-indicator {
  opacity: 1;
}

.woo-category-drag-indicator .dashicons {
  font-size: 24px;
  width: 24px;
  height: 24px;
}

/* Sortable styles */
.woo-categories-circle-container.sortable .woo-category-item {
  cursor: move !important;
  position: relative;
}

.woo-categories-circle-container.sortable .woo-category-link {
  cursor: move !important;
}

.admin-sortable-link {
  cursor: move !important;
}

.woo-categories-circle-container.sorting-in-progress .woo-category-item {
  opacity: 0.8;
}

.ui-sortable-helper {
  opacity: 0.8;
  z-index: 9999;
}

.ui-sortable-placeholder {
  visibility: visible !important;
  border: 2px dashed #ccc;
  background-color: #f9f9f9;
  border-radius: 50%;
  min-height: 120px;
  height: 120px;
  width: 120px;
  margin: 0 auto;
}

.woo-category-link.sorting-active {
  pointer-events: none !important;
}

/* Empty state */
.woo-categories-empty {
  padding: 20px;
  text-align: center;
  background-color: #f7f7f7;
  border-radius: 5px;
  color: #666;
}

/* Click animations */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

@keyframes flash {
  0%,
  50%,
  100% {
    opacity: 1;
  }
  25%,
  75% {
    opacity: 0.5;
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-5px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(5px);
  }
}

@keyframes rubberBand {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scaleX(1.25) scaleY(0.75);
  }
  40% {
    transform: scaleX(0.75) scaleY(1.25);
  }
  60% {
    transform: scaleX(1.15) scaleY(0.85);
  }
  100% {
    transform: scale(1);
  }
}

.animated.pulse {
  animation: pulse 0.5s;
}
.animated.bounce {
  animation: bounce 0.5s;
}
.animated.flash {
  animation: flash 0.5s;
}
.animated.shake {
  animation: shake 0.5s;
}
.animated.rubberBand {
  animation: rubberBand 0.5s;
}

/* Slider Styles - COMPLETELY REVISED */
/* The main container that holds everything */
.woo-categories-slider-container {
  width: 100%;
  position: relative;
  margin: 0 auto;
  overflow: visible;
  padding: 0 40px; /* Add padding for the arrows */
}

/* Navigation arrows - Make them more visible */
.woo-categories-nav {
  position: absolute;
  top: 50%;
  width: 100%;
  left: 0;
  display: flex;
  justify-content: space-between;
  z-index: 100;
  transform: translateY(-50%);
  pointer-events: none;
}

.woo-categories-nav-button {
  background-color: rgba(139, 0, 0, 0.8);
  color: white;
  border: 1px solid #8b0000;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  font-weight: bold;
  font-size: 18px;
}

.woo-categories-nav-button:hover {
  background-color: #8b0000;
  color: white;
  transform: scale(1.1);
}

.woo-categories-nav-prev {
  margin-left: -20px;
}

.woo-categories-nav-next {
  margin-right: -20px;
}

/* Responsive styles */
@media (min-width: 1025px) {
  .woo-categories-circle-container.has-slider .woo-category-item {
    width: auto;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .woo-categories-circle-container.has-slider .woo-category-item {
    width: auto;
  }

  .woo-categories-nav-button {
    width: 35px;
    height: 35px;
  }
}

@media (max-width: 767px) {
  .woo-categories-circle-container.has-slider .woo-category-item {
    width: auto;
  }

  .woo-categories-nav-button {
    width: 30px;
    height: 30px;
  }
}

/* Mobile-specific styles for smaller circles */
@media (max-width: 767px) {
  .woo-category-circle {
    width: 80px;
    height: 80px;
  }

  .woo-categories-circle-container.has-slider .woo-category-item {
    min-width: 80px !important;
  }

  .woo-category-name {
    font-size: 12px;
    margin-top: 5px;
  }

  .ui-sortable-placeholder {
    min-height: 80px;
    height: 80px;
    width: 80px;
  }

  /* Adjust spacing for mobile */
  .woo-categories-circle-container.has-slider .woo-category-item {
    margin: 0 5px !important;
  }
}
