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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
  color: #e4e4e7;
}

.container {
  background: #1e1e2e;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header h1 {
  font-size: 18px;
  font-weight: 600;
  color: #f4f4f5;
}

.close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #71717a;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #a1a1aa;
}

#install-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #6366f1;
  cursor: pointer;
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 18px;
  margin-left: 8px;
}

#install-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

#install-btn svg {
  width: 20px;
  height: 20px;
}

.content {
  padding: 24px;
}

.drop-zone {
  border: 2px dashed rgba(99, 102, 241, 0.4);
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(99, 102, 241, 0.05);
  position: relative;
}

.drop-zone:hover {
  border-color: rgba(99, 102, 241, 0.7);
  background: rgba(99, 102, 241, 0.1);
}

.drop-zone.dragover {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.15);
  transform: scale(1.01);
}

.drop-zone-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: #6366f1;
}

.drop-zone-text {
  font-size: 14px;
  color: #a1a1aa;
  margin-bottom: 4px;
}

.drop-zone-text a {
  color: #6366f1;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}

.drop-zone-text a:hover {
  text-decoration: underline;
}

.drop-zone-hint {
  font-size: 12px;
  color: #71717a;
}

#file-selector {
  display: none;
}

.divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  color: #52525b;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.divider span {
  padding: 0 12px;
}

.preview-section {
  margin-top: 24px;
}

.preview-label {
  font-size: 14px;
  font-weight: 500;
  color: #a1a1aa;
  margin-bottom: 12px;
}

#imgs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 60px;
  max-height: 300px;
  overflow-y: auto;
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

#imgs:empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

#imgs:empty::before {
  content: "No images selected";
  color: #52525b;
  font-size: 13px;
}

.img-wrapper {
  position: relative;
  cursor: grab;
  transition: transform 0.2s, opacity 0.2s;
}

.img-wrapper:active {
  cursor: grabbing;
}

.img-wrapper.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}

.img-wrapper.drag-over {
  transform: translateX(10px);
}

.img-wrapper.drag-over::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #6366f1, #8b5cf6);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.6);
}

.img-placeholder {
  height: 100px;
  width: 70px;
  border: 2px dashed rgba(99, 102, 241, 0.5);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
  font-size: 12px;
  text-align: center;
  padding: 8px;
  box-sizing: border-box;
}

.img-wrapper img {
  height: 100px;
  width: 70px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, object-fit 0.3s, background-color 0.3s;
  pointer-events: none;
}

.img-wrapper.keep-ratio img {
  object-fit: contain;
  background-color: white;
}

.img-wrapper.fullscreen img {
  object-fit: fill;
  background-color: transparent;
}

.img-wrapper:hover img {
  transform: scale(1.05);
}

.img-wrapper .img-index {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(99, 102, 241, 0.9);
  color: white;
  font-size: 10px;
  font-weight: 600;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-item {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  margin-top: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.file-item.show {
  display: flex;
}

.file-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.file-info {
  flex: 1;
}

.file-name {
  font-size: 14px;
  font-weight: 500;
  color: #e4e4e7;
  margin-bottom: 4px;
}

.file-meta {
  font-size: 12px;
  color: #71717a;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  font-size: 12px;
  color: #6366f1;
  margin-left: auto;
}

.footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.15);
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  display: none;
}

.btn.show {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #a1a1aa;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #e4e4e7;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Scrollbar styling */
#imgs::-webkit-scrollbar {
  width: 6px;
}

#imgs::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

#imgs::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.5);
  border-radius: 3px;
}

#imgs::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.7);
}

.status-badge {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 20px;
  font-size: 12px;
  color: #4ade80;
  margin-top: 16px;
}

.status-badge.show {
  display: inline-flex;
}

.options-section {
  margin-top: 20px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.option-item input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(99, 102, 241, 0.5);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  background: transparent;
  flex-shrink: 0;
}

.option-item:hover .checkbox-custom {
  border-color: #6366f1;
}

.option-item input[type="checkbox"]:checked + .checkbox-custom {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-color: #6366f1;
}

.checkbox-custom svg {
  width: 12px;
  height: 12px;
  color: white;
  opacity: 0;
  transition: opacity 0.2s;
}

.option-item input[type="checkbox"]:checked + .checkbox-custom svg {
  opacity: 1;
}

.option-label {
  font-size: 14px;
  color: #a1a1aa;
  user-select: none;
}

.option-label strong {
  color: #e4e4e7;
  font-weight: 500;
}

/* Quality slider styles */
.quality-slider {
  display: none;
  padding: 12px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #a1a1aa;
  margin-bottom: 12px;
}

.slider-label strong {
  color: #6366f1;
  font-weight: 600;
}

.slider-hint {
  font-size: 12px;
  color: #71717a;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  background: transparent;
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  cursor: pointer;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.5);
  transition: transform 0.2s;
  margin-top: -6px;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  cursor: pointer;
  border-radius: 50%;
  border: none;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.5);
  transition: transform 0.2s;
  margin-top: 0;
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.1);
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

input[type="range"]::-moz-range-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
