/* ==========================================================================
   Image Compressor — Premium Upscaled & Fully Responsive Stylesheet
   Theme: Royal Blue (#1a3566), Amber Gold (#d97706), Slate, Glassmorphism
   Supported Breakpoints: 320px, 375px, 430px, 768px, 1024px, 1280px+
   ========================================================================== */

/* --- Tool Header & Badges --- */
.tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(26, 53, 102, 0.12);
  box-shadow: 0 4px 16px rgba(26, 53, 102, 0.05);
  font-size: 13px;
  font-weight: 600;
  color: var(--royal-dark, #122549);
  margin-bottom: 18px;
  max-width: 100%;
  text-align: center;
}

.tool-badge i {
  font-size: 15px;
  color: #059669;
  flex-shrink: 0;
}

/* --- Dropzone Base & Responsive Ergonomics --- */
.dropzone {
  position: relative;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 2px dashed rgba(26, 53, 102, 0.22);
  border-radius: 24px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  box-sizing: border-box;
}

.dropzone:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--royal, #1a3566);
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(26, 53, 102, 0.08);
}

.dropzone.dragover,
.dropzone.drag-active {
  background: rgba(238, 246, 255, 0.95);
  border-color: #2563eb;
  border-style: solid;
  transform: scale(1.01);
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.15), 0 20px 40px rgba(37, 99, 235, 0.12);
}

.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
}

.dz-content {
  position: relative;
  z-index: 5;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dz-icon-wrapper {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  background: linear-gradient(135deg, #1a3566 0%, #2563eb 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  box-shadow: 0 12px 24px rgba(26, 53, 102, 0.22);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.dropzone:hover .dz-icon-wrapper {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.35);
}

.dz-icon-wrapper svg {
  width: 38px;
  height: 38px;
}

.dropzone h3 {
  font-size: 22px;
  font-weight: 800;
  color: var(--royal-dark, #122549);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.dropzone p {
  font-size: 15px;
  color: var(--slate-600, #475569);
  margin-bottom: 18px;
  line-height: 1.5;
  max-width: 480px;
}

.dz-chips {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  max-width: 100%;
}

.dz-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(26, 53, 102, 0.06);
  border: 1px solid rgba(26, 53, 102, 0.1);
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--royal, #1a3566);
  white-space: nowrap;
}

.dz-chip i {
  font-size: 12px;
  flex-shrink: 0;
}

.dz-btn {
  pointer-events: auto;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(26, 53, 102, 0.22);
}

/* --- Processing Panel & File Bar --- */
.process-panel {
  animation: slideFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideFadeIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.file-info {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.03);
  margin-bottom: 20px;
}

.file-icon-box {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #10b981, #059669);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(16, 185, 129, 0.25);
  flex-shrink: 0;
}

.file-icon-box i {
  font-size: 22px;
}

.file-details {
  flex: 1;
  min-width: 0;
}

.file-details h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--slate-800, #1e293b);
  margin-bottom: 3px;
}

.file-details p {
  font-size: 13px;
  color: #059669;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.btn-icon {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #ef4444;
}

/* Error Alert */
#errorAlert {
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  color: #b91c1c;
  padding: 12px 18px;
  border-radius: 14px;
  margin-bottom: 20px;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#errorAlert.hidden {
  display: none !important;
}

#closeErrorBtn:hover {
  opacity: 0.7;
}

#addMoreBtn:disabled,
#addMoreBtn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* --- Workspace Toolbar & Controls --- */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  background: rgba(241, 245, 249, 0.95);
  padding: 14px 18px;
  border-radius: 16px;
  border: 1.5px solid rgba(203, 213, 225, 0.7);
  gap: 16px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 1;
  flex-wrap: wrap;
}

.toolbar-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-control label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--royal-dark, #122549);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.l2-select {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  outline: none;
  background: #ffffff;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 130px;
}

.l2-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.slider-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 320px;
  min-width: 200px;
}

.range-badge {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  min-width: 44px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25);
}

.toolbar-right {
  display: flex;
  align-items: center;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 10px;
}

/* Custom Range Slider */
.l2-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 7px;
  background: #e2e8f0;
  border-radius: 9999px;
  outline: none;
  transition: background 0.2s ease;
}

.l2-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #d97706;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.4);
  transition: transform 0.15s ease, background 0.15s ease;
}

.l2-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #d97706;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.4);
  transition: transform 0.15s ease, background 0.15s ease;
}

.l2-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: #b45309;
}

.l2-slider::-moz-range-thumb:hover {
  transform: scale(1.15);
  background: #b45309;
}

/* --- Image List / Items --- */
.image-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.image-item {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
  box-sizing: border-box;
}

.image-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  border-color: #bfdbfe;
}

.image-preview {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.image-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
}

.image-details {
  flex: 1;
  min-width: 0;
}

.image-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--royal-dark, #122549);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.image-meta {
  font-size: 12.5px;
  color: var(--slate-500, #64748b);
  font-weight: 500;
  margin-bottom: 8px;
  line-height: 1.4;
}

.compression-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--slate-100, #f1f5f9);
  color: var(--slate-600, #475569);
}

.savings-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 800;
  background: #dcfce7;
  color: #166534;
  margin-left: 6px;
}

.delete-btn {
  background: #fee2e2;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.delete-btn:hover {
  background: #fecaca;
  color: #dc2626;
  transform: scale(1.1);
}

/* --- Floating Sticky Action Footer --- */
.action-footer {
  margin-top: 24px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  bottom: 20px;
  z-index: 100;
}

.selection-status {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--slate-700, #334155);
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-buttons {
  display: flex;
  gap: 14px;
}

.action-buttons .btn {
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* --- Section Headlines & Content Blocks --- */
.section-headline {
  font-size: 26px;
  font-weight: 900;
  color: var(--royal-dark, #122549);
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: 15px;
  color: var(--slate-600, #475569);
  text-align: center;
  max-width: 680px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

/* --- Steps & Guidelines --- */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.step-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.step-number {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a3566, #2563eb);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(26, 53, 102, 0.2);
}

.step-text h5 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--slate-800, #1e293b);
  margin-bottom: 3px;
}

.step-text p {
  font-size: 13.5px;
  color: var(--slate-600, #475569);
  line-height: 1.5;
  margin: 0;
}

.guidelines-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guideline-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.guideline-icon {
  font-size: 18px;
  color: #d97706;
  flex-shrink: 0;
  margin-top: 1px;
}

.guideline-text {
  font-size: 13.5px;
  color: var(--slate-700, #334155);
  line-height: 1.5;
}

.guideline-text strong {
  color: var(--slate-900, #0f172a);
}

/* ==========================================================================
   Comprehensive Responsive Breakpoints (Mobile, Tablet, Desktop)
   ========================================================================== */

/* --- Tablet (max-width: 768px) --- */
@media (max-width: 768px) {
  .section-headline {
    font-size: 22px;
  }

  .section-subtitle {
    font-size: 14px;
    margin-bottom: 24px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .toolbar-left {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .slider-wrapper {
    max-width: 100%;
  }

  .action-footer {
    flex-direction: column;
    gap: 14px;
    align-items: stretch;
    text-align: center;
  }

  .action-buttons {
    flex-direction: column;
  }
}

/* --- Mobile Devices (max-width: 480px) --- */
@media (max-width: 480px) {
  .tool-badge {
    font-size: 11px;
    padding: 5px 12px;
    gap: 6px;
    margin-bottom: 12px;
  }

  .dropzone {
    padding: 24px 14px 20px;
    border-radius: 16px;
  }

  .dz-icon-wrapper {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    margin-bottom: 12px;
  }

  .dz-icon-wrapper svg {
    width: 28px;
    height: 28px;
  }

  .dropzone h3 {
    font-size: 17px;
    margin-bottom: 4px;
  }

  .dropzone p {
    font-size: 12.5px;
    margin-bottom: 12px;
  }

  .dz-chips {
    gap: 6px;
    margin-bottom: 14px;
  }

  .dz-chip {
    font-size: 10.5px;
    padding: 3px 8px;
    gap: 4px;
  }

  .dz-btn {
    width: 100%;
    max-width: 260px;
    font-size: 14px;
    padding: 11px 18px;
    border-radius: 12px;
  }

  .file-info {
    padding: 12px 14px;
    gap: 10px;
    border-radius: 14px;
    margin-bottom: 16px;
  }

  .file-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .file-details h4 {
    font-size: 13.5px;
  }

  .file-details p {
    font-size: 11.5px;
  }

  .btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .image-item {
    padding: 12px;
    gap: 12px;
  }

  .image-preview {
    width: 60px;
    height: 60px;
    border-radius: 10px;
  }

  .image-name {
    font-size: 13.5px;
  }

  .image-meta {
    font-size: 11.5px;
  }

  .delete-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .action-footer {
    padding: 12px 14px;
    border-radius: 14px;
    bottom: 12px;
  }

  .action-buttons .btn {
    font-size: 14px;
    padding: 12px 18px;
    border-radius: 12px;
    min-height: 44px;
  }
}

/* --- Accessibility & Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .dropzone,
  .image-item,
  .action-buttons .btn {
    transition: none !important;
    animation: none !important;
  }
}
