/* basket-box.css - Clean Simple File Uploader */
:root {
  /* Theme Colors - Default */
  --basket-primary: #5B7029;
  --basket-primary-light: rgba(91, 112, 41, 0.1);
  --basket-secondary: #a8c95f;
  --basket-bg: #ffffff;
  --basket-bg-hover: #f8f9f5;
  --basket-border: #e0e6d1;
  --basket-text: #2c3e1a;
  --basket-text-light: #6b7a4c;
  --basket-error: #ff4757;
  --basket-error-light: rgba(255, 71, 87, 0.1);
  --basket-success: #5B7029;
  --basket-shadow: 0 4px 12px rgba(91, 112, 41, 0.08);
  --basket-shadow-hover: 0 8px 24px rgba(91, 112, 41, 0.12);
  --basket-radius: 12px;
  --basket-transition: all 0.3s ease;
  
  /* NEW: Slider colors */
  --basket-slider-arrow: var(--basket-primary);
  --basket-slider-arrow-hover: var(--basket-secondary);
  --basket-slider-bg: rgba(255, 255, 255, 0.9);
  
  /* NEW: Thumbnail colors */
  --basket-thumbnail: #FFD700;
  --basket-thumbnail-hover: #FFC107;
  --basket-thumbnail-star: #FFFFFF;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.basket-box-container {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  width: 100%;
  max-width: 100%;
}

/* Main upload area */
.basket-box-upload-area {
  display: flex;
  flex-direction: row;
  gap: 16px;
  align-items: flex-start;
  width: 100%;
  padding: 16px 0 20px;
  min-height: 160px;
  position: relative;
}

/* Add Box - Left Side */
.basket-box-add {
  flex: 0 0 auto;
  width: 140px;
  height: 140px;
  border: 2px dashed var(--basket-border);
  border-radius: var(--basket-radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--basket-bg);
  transition: var(--basket-transition);
  position: relative;
  overflow: hidden;
}

.basket-box-add:hover {
  border-color: var(--basket-primary);
  background: var(--basket-bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--basket-shadow);
}

.basket-box-add.dragover {
  border-color: var(--basket-primary);
  background: var(--basket-primary-light);
  border-width: 3px;
  animation: basket-pulse 1s infinite alternate;
}

@keyframes basket-pulse {
  0% { 
    border-color: var(--basket-primary);
    box-shadow: 0 0 0 0 var(--basket-primary-light);
  }
  100% { 
    border-color: var(--basket-secondary);
    box-shadow: 0 0 0 8px transparent;
  }
}

.basket-box-add-input {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.basket-box-add-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--basket-transition);
}

.basket-box-add-icon svg {
  width: 100%;
  height: 100%;
  stroke: var(--basket-primary);
  stroke-width: 2;
  fill: none;
}

.basket-box-add:hover .basket-box-add-icon svg {
  stroke: var(--basket-secondary);
  transform: scale(1.1);
}

.basket-box-add-text {
  text-align: center;
  padding: 0 10px;
}

.basket-box-add-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--basket-text);
  margin-bottom: 4px;
}

.basket-box-add-subtitle {
  font-size: 12px;
  color: var(--basket-text-light);
  font-weight: 400;
}

/* Counter - Simple */
.basket-box-counter {
  position: absolute;
  top: 5px;
  right: 5px;
  background: var(--basket-primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  min-width: 24px;
  height: 24px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(91, 112, 41, 0.3);
  z-index: 10;
  padding: 0 8px;
  border: 2px solid white;
  animation: basket-counter-pop 0.3s ease;
}

@keyframes basket-counter-pop {
  0% {
    transform: scale(0);
  }
  100% {
    transform: scale(1);
  }
}

/* NEW: Files wrapper for slider */
.basket-box-files-wrapper {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

/* File boxes grid */
.basket-box-files {
  display: flex;
  flex-direction: row;
  gap: 16px;
  flex-wrap: nowrap;
  transition: transform 0.3s ease;
  padding: 0 0 8px 0;
}

/* NEW: Slider arrows */
.basket-box-slider-arrows {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 5;
  padding: 0 4px;
}

.basket-box-slider-arrow {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--basket-slider-bg);
  border: none;
  color: var(--basket-slider-arrow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  transition: var(--basket-transition);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: scale(0.9);
}

.basket-box-slider-arrow:hover {
  background: var(--basket-primary);
  color: white;
  transform: scale(1);
  box-shadow: 0 4px 12px rgba(91, 112, 41, 0.2);
  border-color: var(--basket-primary);
}

.basket-box-slider-arrow:hover svg {
  stroke: white;
}

.basket-box-slider-arrow svg {
  width: 18px;
  height: 18px;
  stroke: var(--basket-slider-arrow);
  stroke-width: 2.5;
  fill: none;
  transition: var(--basket-transition);
}

.basket-box-files-wrapper:hover .basket-box-slider-arrow {
  opacity: 1;
  transform: scale(1);
}

.basket-box-slider-prev {
  transform: translateX(-100px) scale(0.9);
}

.basket-box-slider-next {
  transform: translateX(100px) scale(0.9);
}

.basket-box-files-wrapper:hover .basket-box-slider-prev {
  transform: translateX(0) scale(1);
}

.basket-box-files-wrapper:hover .basket-box-slider-next {
  transform: translateX(0) scale(1);
}

/* File box */
.basket-box-file {
  flex: 0 0 auto;
  width: 140px;
  height: 140px;
  border-radius: var(--basket-radius);
  background: var(--basket-bg);
  border: 1px solid var(--basket-border);
  overflow: hidden;
  position: relative;
  box-shadow: var(--basket-shadow);
  transition: var(--basket-transition);
  animation: basket-file-appear 0.3s ease;
}

@keyframes basket-file-appear {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.basket-box-file:hover {
  transform: translateY(0px);
  box-shadow: var(--basket-shadow-hover);
  border-color: var(--basket-primary);
}

/* Completed file has theme color border */
.basket-box-file.completed {
  border-color: var(--basket-primary);
}

/* File preview */
.basket-box-preview {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.basket-box-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--basket-transition);
}

.basket-box-file:hover .basket-box-preview img {
  transform: scale(1.05);
}

.basket-box-preview-icon {
  width: 48px;
  height: 48px;
  stroke: var(--basket-border);
  stroke-width: 1.5;
  fill: none;
}

.basket-box-file:hover .basket-box-preview-icon {
  stroke: var(--basket-primary);
}

/* File info overlay */
.basket-box-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  padding: 12px 8px 8px;
  color: white;
  transform: translateY(100%);
  transition: var(--basket-transition);
  z-index: 3;
}

.basket-box-file:hover .basket-box-overlay {
  transform: translateY(0);
}

.basket-box-filename {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.basket-box-filesize {
  font-size: 10px;
  opacity: 0.9;
}

/* Progress bar */
.basket-box-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--basket-primary), var(--basket-secondary));
  width: 0%;
  transition: width 0.3s ease;
  z-index: 4;
}

/* Status indicators - Theme Color */
.basket-box-status {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  opacity: 0;
  transform: scale(0.8);
  transition: var(--basket-transition);
  background: var(--basket-primary);
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.basket-box-file.completed .basket-box-status {
  opacity: 1;
  transform: scale(1);
  animation: basket-status-pop 0.3s ease;
}

@keyframes basket-status-pop {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.basket-box-status svg {
  width: 12px;
  height: 12px;
  stroke: white;
  stroke-width: 3;
  fill: none;
}

/* NEW: Thumbnail star button */
.basket-box-thumbnail {
  position: absolute;
  top: 8px;
  left: 40px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  opacity: 0;
  transition: var(--basket-transition);
  padding: 0;
}

.basket-box-file.completed .basket-box-thumbnail {
  opacity: 0.7;
}

.basket-box-file:hover .basket-box-thumbnail {
  opacity: 1;
}

.basket-box-thumbnail.active {
  background: var(--basket-thumbnail) !important;
  color: var(--basket-thumbnail-star) !important;
  opacity: 1 !important;
  box-shadow: 0 0 0 2px white, 0 2px 8px rgba(255, 215, 0, 0.3);
  animation: basket-thumbnail-pulse 2s infinite;
  pointer-events: none;
}

@keyframes basket-thumbnail-pulse {
  0%, 100% {
    box-shadow: 0 0 0 2px white, 0 2px 8px rgba(255, 215, 0, 0.3);
  }
  50% {
    box-shadow: 0 0 0 2px white, 0 2px 12px rgba(255, 215, 0, 0.6);
  }
}

.basket-box-thumbnail:hover {
  background: var(--basket-thumbnail-hover);
  transform: scale(1.1);
  opacity: 1 !important;
}

.basket-box-thumbnail svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 2;
  fill: currentColor;
  transition: var(--basket-transition);
}

.basket-box-thumbnail.active svg {
  fill: currentColor;
  stroke: currentColor;
}

/* Remove button - Customizable color */
.basket-box-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--basket-remove-color, rgba(0, 0, 0, 0.6));
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  opacity: 0;
  transition: var(--basket-transition);
}

.basket-box-file:hover .basket-box-remove {
  opacity: 1;
}

.basket-box-remove:hover {
  background: var(--basket-remove-color, rgba(0, 0, 0, 0.8));
  transform: scale(1.1);
}

.basket-box-remove svg {
  width: 12px;
  height: 12px;
  stroke: white;
  stroke-width: 3;
  fill: none;
}

/* Expand button for lightbox */
.basket-box-expand {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
  opacity: 0;
  transition: var(--basket-transition);
}

.basket-box-file:hover .basket-box-expand {
  opacity: 1;
}

.basket-box-expand:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

.basket-box-expand svg {
  width: 12px;
  height: 12px;
  stroke: white;
  stroke-width: 2.5;
  fill: none;
}

/* Error display with progress bar */
.basket-box-error-container {
  margin-top: 12px;
  min-height: 24px;
  transition: var(--basket-transition);
  width: 100%;
}

.basket-box-error {
  background: linear-gradient(90deg, var(--basket-error-light), rgba(255, 71, 87, 0.05));
  border-left: 4px solid var(--basket-error);
  color: var(--basket-text);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: basket-error-slide 0.3s ease;
  box-shadow: 0 2px 8px rgba(255, 71, 87, 0.1);
  border: 1px solid rgba(255, 71, 87, 0.15);
  position: relative;
  overflow: hidden;
}

@keyframes basket-error-slide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Progress bar for error timeout */
.basket-box-error-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--basket-error), #ff6b81);
  width: 100%;
  transform-origin: left;
}

.basket-box-error-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  z-index: 1;
}

.basket-box-error svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: white;
  stroke-width: 2.5;
  fill: var(--basket-error);
}

.basket-box-error-close {
  background: none;
  border: none;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--basket-transition);
  background: rgba(255, 71, 87, 0.1);
  opacity: 0.6;
  z-index: 1;
}

.basket-box-error-close:hover {
  opacity: 1;
  background: rgba(255, 71, 87, 0.2);
  transform: rotate(90deg);
}

.basket-box-error-close svg {
  width: 12px;
  height: 12px;
  stroke: var(--basket-error);
  stroke-width: 3;
}

/* Lightbox for image preview */
.basket-box-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.basket-box-lightbox.active {
  opacity: 1;
  visibility: visible;
}

.basket-box-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  animation: basket-lightbox-appear 0.3s ease;
}

@keyframes basket-lightbox-appear {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.basket-box-lightbox-img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 8px;
}

.basket-box-lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--basket-transition);
}

.basket-box-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.basket-box-lightbox-close svg {
  width: 18px;
  height: 18px;
  stroke: white;
  stroke-width: 2.5;
  fill: none;
}

.basket-box-lightbox-info {
  position: absolute;
  bottom: -50px;
  left: 0;
  right: 0;
  text-align: center;
  color: white;
  padding: 12px;
  font-size: 14px;
}

.basket-box-lightbox-filename {
  font-weight: 600;
  margin-bottom: 4px;
}

.basket-box-lightbox-filesize {
  opacity: 0.8;
  font-size: 12px;
}

/* Size classes */
.basket-box-file.sm, .basket-box-add.sm {
  width: 120px;
  height: 120px;
}

.basket-box-file.md, .basket-box-add.md {
  width: 140px;
  height: 140px;
}

.basket-box-file.lg, .basket-box-add.lg {
  width: 160px;
  height: 160px;
}

.basket-box-file.sm .basket-box-overlay {
  padding: 10px 6px 6px;
}

.basket-box-file.sm .basket-box-filename {
  font-size: 10px;
}

.basket-box-file.sm .basket-box-filesize {
  font-size: 9px;
}

.basket-box-file.sm .basket-box-status,
.basket-box-file.sm .basket-box-remove,
.basket-box-file.sm .basket-box-expand,
.basket-box-file.sm .basket-box-thumbnail {
  width: 20px;
  height: 20px;
  top: 6px;
  left: 6px;
  right: 6px;
}

.basket-box-file.sm .basket-box-thumbnail {
  right: 34px;
}

.basket-box-file.sm .basket-box-expand {
  bottom: 6px;
  right: 6px;
}

.basket-box-file.sm .basket-box-status svg,
.basket-box-file.sm .basket-box-remove svg,
.basket-box-file.sm .basket-box-expand svg,
.basket-box-file.sm .basket-box-thumbnail svg {
  width: 10px;
  height: 10px;
}

/* Responsive */
@media (max-width: 768px) {
  .basket-box-upload-area {
    flex-direction: column;
    gap: 16px;
  }
  
  .basket-box-add {
    width: 100%;
    height: 120px;
    flex-direction: row;
    gap: 16px;
    padding: 0 20px;
  }
  
  .basket-box-add-icon {
    margin-bottom: 0;
    width: 32px;
    height: 32px;
  }
  
  .basket-box-add-text {
    text-align: left;
    flex: 1;
  }
  
  .basket-box-files-wrapper {
    width: 100%;
  }
  
  .basket-box-counter {
    top: -6px;
    right: -6px;
  }
  
  .basket-box-expand {
    opacity: 1;
  }
  
  .basket-box-slider-arrow {
    opacity: 1;
    transform: scale(1);
  }
  
  .basket-box-slider-prev {
    transform: translateX(0);
  }
  
  .basket-box-slider-next {
    transform: translateX(0);
  }
}

@media (max-width: 480px) {
  .basket-box-add-title {
    font-size: 13px;
  }
  
  .basket-box-add-subtitle {
    font-size: 11px;
  }
  
  .basket-box-file.sm, .basket-box-add.sm {
    width: 100px;
    height: 100px;
  }
  
  .basket-box-file.md, .basket-box-add.md {
    width: 120px;
    height: 120px;
  }
  
  .basket-box-file.lg, .basket-box-add.lg {
    width: 140px;
    height: 140px;
  }
  
  .basket-box-slider-arrow {
    width: 32px;
    height: 32px;
  }
  
  .basket-box-slider-arrow svg {
    width: 16px;
    height: 16px;
  }
}