/**
 * Snappat - Ajax Uploader CSS
 * Styling for fine-uploader used in item posting
 */

/* Container */
.qq-uploader {
  position: relative;
  width: 100%;
}

/* Upload button */
.qq-upload-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 2rem;
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  border-radius: 0.75rem;
  color: #6c757d;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.qq-upload-button:hover {
  background: #f1f3f5;
  border-color: #e53935;
  color: #e53935;
}

.qq-upload-button-focus {
  border-color: #e53935;
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.1);
}

/* Drop area */
.qq-uploader-drop-area {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(229, 57, 53, 0.05);
  border: 2px dashed #e53935;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.qq-uploader-drop-area span {
  color: #e53935;
  font-weight: 600;
}

/* Upload list */
.qq-upload-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  padding: 0;
  list-style: none;
}

.qq-upload-list li {
  position: relative;
  aspect-ratio: 1;
  background: #f8f9fa;
  border-radius: 0.75rem;
  overflow: hidden;
}

/* File preview */
.qq-upload-file {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qq-upload-spinner,
.qq-upload-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border: 3px solid #e5e5e5;
  border-top-color: #e53935;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Progress bar */
.qq-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #e5e5e5;
}

.qq-progress-bar span {
  display: block;
  height: 100%;
  background: #e53935;
  transition: width 0.3s ease;
}

/* Remove button */
.qq-upload-cancel,
.qq-upload-delete {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.qq-upload-list li:hover .qq-upload-cancel,
.qq-upload-list li:hover .qq-upload-delete {
  opacity: 1;
}

.qq-upload-cancel:hover,
.qq-upload-delete:hover {
  background: #e53935;
}

/* Status icons */
.qq-upload-success {
  border: 2px solid #22c55e;
}

.qq-upload-fail {
  border: 2px solid #ef4444;
}

/* Error messages */
.qq-upload-failed-text {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem;
  background: #ef4444;
  color: white;
  font-size: 0.75rem;
  text-align: center;
}

/* Size info */
.qq-upload-size {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 0.625rem;
  border-radius: 0.25rem;
}

/* Drag reorder */
.qq-upload-list li.dragging {
  opacity: 0.5;
}

.qq-upload-list li.drag-over {
  border: 2px dashed #e53935;
}

/* Thumbnails container (custom Snappat style) */
.snappat-thumbnails {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.snappat-thumbnail {
  position: relative;
  aspect-ratio: 1;
  background: #f1f5f9;
  border: 2px solid transparent;
  border-radius: 0.75rem;
  overflow: hidden;
  cursor: move;
}

.snappat-thumbnail:first-child {
  border-color: #e53935;
}

.snappat-thumbnail:first-child::after {
  content: 'Huvudbild';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.25rem;
  background: #e53935;
  color: white;
  font-size: 0.625rem;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
}

.snappat-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.snappat-thumbnail-remove {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.snappat-thumbnail:hover .snappat-thumbnail-remove {
  opacity: 1;
}

.snappat-thumbnail-remove:hover {
  background: #e53935;
}

/* Add more button */
.snappat-add-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  aspect-ratio: 1;
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 0.75rem;
  color: #64748b;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.snappat-add-more:hover {
  background: #f1f5f9;
  border-color: #e53935;
  color: #e53935;
}

.snappat-add-more svg {
  width: 24px;
  height: 24px;
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .qq-upload-list,
  .snappat-thumbnails {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
  
  .qq-upload-button {
    padding: 1.5rem;
  }
}

