/* Image Compressor Styles */

/* Main Section */
.page {
  /* expose shared section padding so global title offset calculation works */
  --section-padding-top: 2.25rem;
  padding: var(--section-padding-top) 0.75rem;
  min-height: calc(100vh - 160px);
}

.lead {
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  max-width: 800px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

@media (max-width: 768px) {
  .lead {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
  }
}

.content {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.highlights-grid {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

@media (max-width: 768px) {
  .highlights-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 1.5rem;
  }
}

.highlight-card {
  position: relative;
  padding: 1.5rem;
  border-radius: 16px;
  background: rgba(8, 15, 25, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(57, 255, 20, 0.08);
  transition:
    transform 0.35s ease,
    border-color 0.35s ease;
  backdrop-filter: blur(18px);
}

@media (max-width: 768px) {
  .highlight-card {
    padding: 1rem;
    border-radius: 12px;
  }
}

.highlight-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: rgba(57, 255, 20, 0.12);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.highlight-card:hover {
  transform: translateY(-6px);
}

.highlight-card:hover::after {
  opacity: 1;
}

.highlight-card__eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.6);
}

.highlight-card__title {
  margin: 0.25rem 0 0.5rem;
  font-size: 1.2rem;
  color: #e0ffef;
}

.highlight-card__text {
  margin: 0;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.75);
}

.main-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
  margin-top: 24px;
  padding: 24px 12px;
  background: rgba(24, 28, 42, 0.85);
  border-radius: 18px;
  box-shadow: 0 2px 24px rgba(0, 0, 0, 0.1);
}

.helper-card {
  padding: 1rem;
  border-radius: 14px;
  background: rgba(5, 12, 24, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
  height: fit-content;
}

@media (max-width: 768px) {
  .helper-card {
    padding: 1rem;
    border-radius: 12px;
  }
}

.helper-card__header {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.helper-card__icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .helper-card__icon {
    width: 36px;
    height: 36px;
  }
}

.helper-card__eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
}

.helper-card__title {
  font-size: 1.1rem;
  color: #e0ffef;
  margin: 0.25rem 0 0 0;
}

@media (max-width: 768px) {
  .helper-card__title {
    font-size: 1rem;
  }
}

.helper-list {
  margin: 1rem 0;
  padding-left: 1.25rem;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  line-height: 1.6;
}

@media (max-width: 768px) {
  .helper-list {
    font-size: 0.85rem;
    padding-left: 1rem;
    margin: 0.75rem 0;
  }
}

.helper-list li {
  margin-bottom: 0.5rem;
}

.helper-status {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.helper-status__pill {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: rgba(57, 255, 20, 0.15);
  color: #39ff14;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.helper-status__text {
  margin: 0.75rem 0 0 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Upload Area */
.upload-area {
  position: relative;
  padding: 3rem 2rem;
  border-radius: 20px;
  border: 2px dashed rgba(57, 255, 20, 0.3);
  background: rgba(5, 12, 24, 0.6);
  text-align: center;
  cursor: pointer;
  transition: all 0.35s ease;
  backdrop-filter: blur(10px);
}

.upload-area:hover {
  border-color: rgba(57, 255, 20, 0.6);
  background: rgba(5, 12, 24, 0.8);
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(57, 255, 20, 0.15);
}

.upload-area.drag-over {
  border-color: #39ff14;
  background: rgba(57, 255, 20, 0.1);
  transform: scale(1.02);
}

.upload-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  opacity: 0.9;
}

@media (max-width: 768px) {
  .upload-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
  }
}

.upload-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #e0ffef;
  margin: 0 0 0.5rem;
}

@media (max-width: 768px) {
  .upload-title {
    font-size: 1.25rem;
  }
}

.upload-description {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0 0 0.5rem;
}

@media (max-width: 768px) {
  .upload-description {
    font-size: 0.9rem;
  }
}

.upload-formats {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 1.5rem;
}

@media (max-width: 768px) {
  .upload-formats {
    font-size: 0.8rem;
    margin: 0 0 1rem;
  }
}

.upload-filename {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Batch upload styles */
.batch-panel {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: rgba(8, 15, 25, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

@media (max-width: 768px) {
  .batch-panel {
    padding: 0.75rem 1rem;
    margin-top: 1rem;
  }
}
.batch-title {
  margin: 0 0 0.25rem;
  color: #e0ffef;
  font-size: 1.05rem;
}

@media (max-width: 768px) {
  .batch-title {
    font-size: 1rem;
  }
}

.batch-desc {
  margin: 0 0 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .batch-desc {
    font-size: 0.85rem;
  }
}
.batch-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.batch-count {
  margin-left: 0.5rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
}

/* hide native file input (we use the styled button) */
#batchFileInput {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

/* Make select and compress buttons visually identical */
.batch-controls .upload-button,
.batch-controls .compress-all-button {
  min-width: 160px;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
}

.batch-controls .compress-all-button {
  background: rgba(57, 255, 20, 0.12);
  color: #39ff14;
  border: 1px solid rgba(57, 255, 20, 0.12);
}
.batch-controls .upload-button {
  background: #39ff14;
  color: #000;
}
.batch-controls .upload-button:hover,
.batch-controls .compress-all-button:hover {
  transform: translateY(-2px);
}
.batch-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.batch-item {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 160px 120px;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem;
}

/* Styles moved from pages/products/imgcompressor.html <style> block to keep HTML clean */

/* Layout grid tweaks (overrides from inline styles) */
.main-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
  width: 100%;
  align-content: start;
}

.left-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Helper card removed: hide if present */
.helper-card {
  display: none !important;
}

/* Workspace panel and controls styling tweaks */
.workspace-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.controls-area {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.01)
  );
  backdrop-filter: blur(6px);
}
.control-section__content {
  padding-top: 8px;
}

/* Upload area quick improvements */
.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-radius: 12px;
  border: 2px dashed rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), transparent);
  cursor: pointer;
  text-align: center;
}
.upload-area input[type="file"] {
  display: none;
}
.upload-button {
  margin-top: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* Comparison/preview layout tweaks */
.comparison-container {
  margin-top: 12px;
}
.image-comparison {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.comparison-side {
  flex: 1;
  min-width: 180px;
}
.image-wrapper {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.01)
  );
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-canvas {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  object-fit: contain;
}

.comparison-title {
  text-align: center;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--muted-text, #cfe8ff);
}

/* Buttons and action groups */
.download-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}
.download-options .reset-button,
.download-options .download-button {
  padding: 10px 14px;
  border-radius: 8px;
}

/* File info grid */
#fileInfo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.file-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
}

/* Batch panel tweaks to match theme */
.batch-panel {
  margin-top: 18px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.03);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.01),
    rgba(255, 255, 255, 0.005)
  );
}

@media (max-width: 980px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
  .helper-card {
    order: 2;
  }
  .comparison-container {
    order: 3;
  }
  .batch-panel {
    order: 4;
  }
  .image-comparison {
    flex-direction: column;
  }
  .download-options {
    justify-content: flex-start;
  }
}

@media (max-width: 420px) {
  .controls-area {
    padding: 10px;
  }
  .upload-area {
    padding: 12px;
  }
  .image-wrapper {
    min-height: 180px;
  }
}

/* Batch controls alignment */
.batch-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.batch-controls input[type="file"] {
  display: none;
}
.batch-controls .upload-button,
.batch-controls .compress-all-button,
.batch-controls .donate-button {
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 8px;
  white-space: nowrap;
}
.batch-count {
  margin-left: 6px;
  color: var(--muted-text, #9fb7c9);
}

/* Ensure download-options buttons align consistently */
.download-options button,
.download-options a {
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
}

/* Make the file count vertically centered */
.batch-count {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
}

/* Keep the ZIP download hidden until JS enables it */
#batchDownloadZipButton {
  display: none;
}

/* Helper card width and spacing */
.helper-card {
  max-width: 300px;
  padding: 12px;
}

.media-cleanup-dummy {
}
@media (max-width: 420px) {
  .batch-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .batch-controls .upload-button,
  .batch-controls .compress-all-button,
  .batch-controls .donate-button,
  .batch-controls #batchDownloadZipButton {
    width: 100%;
  }
}
.batch-item .name {
  color: #e0ffef;
  font-weight: 600;
}
.batch-item .orig-size {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
}
.batch-item .batch-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.batch-item .batch-middle {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: right;
}
.batch-item .new-size {
  color: #39ff14;
  font-weight: 700;
}
.batch-item .ratio {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}
.batch-item .actions {
  margin-left: 0;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-self: end;
}

/* Responsive: stack columns on narrow screens */
@media (max-width: 800px) {
  .batch-item {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }
  .batch-item .batch-middle {
    text-align: left;
  }
  .batch-item .actions {
    justify-self: start;
  }
}
.compress-all-button {
  padding: 0.6rem 1rem;
  border-radius: 10px;
  background: #39ff14;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.download-link {
  display: inline-block;
  padding: 0.35rem 0.6rem;
  background: rgba(57, 255, 20, 0.12);
  color: #39ff14;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
}
.download-link:hover {
  background: rgba(57, 255, 20, 0.18);
}

/* Small responsive tweak for batch controls */
@media (max-width: 600px) {
  .batch-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .compress-all-button {
    width: 100%;
  }
}

#fileInput {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.upload-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  background: #39ff14;
  color: #000;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(57, 255, 20, 0.3);
}

/* Ensure batch buttons remain visually identical to the upload button and aligned */
.batch-controls .upload-button,
.batch-controls .compress-all-button {
  height: 44px;
  align-items: center;
  display: inline-flex;
}

@media (max-width: 768px) {
  .upload-button {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
  }
}

.upload-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(57, 255, 20, 0.4);
}

.button-icon {
  width: 20px;
  height: 20px;
}

/* Final override: ensure batch control buttons match vertically and remove extra glow */
.batch-controls .upload-button,
.batch-controls .compress-all-button {
  padding: 0.6rem 1.25rem; /* match compact batch sizing */
  height: 44px; /* fixed height for consistent alignment */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none !important; /* remove large glow from select button */
  margin: 0;
  vertical-align: middle;
}

/* Give compress-all a subtle focus/hover to match visual weight without changing color */
.batch-controls .compress-all-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

/* Processing Status */
.processing-status {
  text-align: center;
  padding: 3rem 2rem;
  margin-top: 2rem;
}

.spinner {
  width: 60px;
  height: 60px;
  margin: 0 auto 1.5rem;
  border: 4px solid rgba(57, 255, 20, 0.2);
  border-top-color: #39ff14;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.processing-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: #e0ffef;
  margin: 0 0 0.5rem;
}

.processing-subtext {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

/* Preview Area */
.preview-area {
  margin-top: 2rem;
}

.workspace-panel {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Controls Area */
.controls-area {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.download-options {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.donate-button {
  /* Standardized donate button: match other action buttons */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
  text-decoration: none;
  background: rgba(255, 16, 240, 0.12);
  color: #ff10f0;
  border: 1px solid rgba(255, 16, 240, 0.2);
  box-shadow:
    0 4px 12px rgba(57, 255, 20, 0.02),
    0 2px 8px rgba(0, 0, 0, 0.16);
}

.donate-button:hover {
  background: rgba(255, 16, 240, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

@media (max-width: 768px) {
  .donate-button {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    width: 100%;
  }
}

.reset-button,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  border: none;
}

@media (max-width: 768px) {
  .reset-button,
  .download-button {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    width: 100%;
    justify-content: center;
  }
}

.icon-only {
  padding: 0.875rem;
}

.reset-button {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.reset-button:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.download-button {
  background: #39ff14;
  color: #000;
  box-shadow: 0 4px 15px rgba(57, 255, 20, 0.3);
}

/* Ensure donate button matches height and vertical alignment of other action buttons */
.download-options .donate-button,
.batch-controls .donate-button {
  /* reinforce standardized sizing inside action groups */
  height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
  gap: 0.5rem;
  box-shadow:
    0 4px 12px rgba(57, 255, 20, 0.02),
    0 2px 8px rgba(0, 0, 0, 0.16);
}

/* Ensure the SVG/icon sits exactly centered with text */
.donate-button .button-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
  margin: 0;
}

/* Strong final override to guarantee identical Donate button styling everywhere */
.download-options .donate-button,
.batch-controls .donate-button,
.donate-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  height: 44px !important;
  padding: 0 14px !important;
  border-radius: 8px !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  text-decoration: none !important;
  color: #ff10f0 !important;
  background: linear-gradient(
    180deg,
    rgba(255, 16, 240, 0.12),
    rgba(255, 16, 240, 0.06)
  ) !important;
  border: 1px solid rgba(255, 16, 240, 0.22) !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22) !important;
}

/* Icon inside donate buttons aligned */
.download-options .donate-button .button-icon,
.batch-controls .donate-button .button-icon,
.donate-button .button-icon {
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  vertical-align: middle !important;
}

/* Remove any stray glow from upload-styled buttons when donate is inside batch-controls */
.batch-controls .donate-button {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22) !important;
}

.download-button:hover {
  transform: translateY(-2px);
}

/* Control Section */
.control-section {
  padding: 1.5rem;
  border-radius: 16px;
  background: rgba(5, 12, 24, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 768px) {
  .control-section {
    padding: 1rem;
    border-radius: 12px;
  }
}

.control-section__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.control-section__icon {
  width: 24px;
  height: 24px;
  color: #39ff14;
}

/* Restore defaults icon button styling */
.restore-button {
  background: none;
  border: none;
  padding: 6px;
  margin-right: 8px;
  cursor: pointer;
  color: #39ff14; /* same green as control icon */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.restore-button:hover {
  background: rgba(57, 255, 20, 0.06);
}
.restore-button svg {
  width: 20px;
  height: 20px;
  color: inherit;
}
/* Ensure SVG fill matches the gear icon color exactly */
.restore-button svg {
  fill: #39ff14;
}

.control-section__title {
  font-size: 1.1rem;
  color: #e0ffef;
  margin: 0;
}

.control-section__content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.control-section__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 500;
  color: #e0ffef;
}

.control-label-checkbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #e0ffef;
  cursor: pointer;
}

.control-value {
  padding: 0.25rem 0.75rem;
  background: rgba(57, 255, 20, 0.15);
  color: #39ff14;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
}

.control-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
}

.control-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #39ff14;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(57, 255, 20, 0.4);
  transition: all 0.3s ease;
}

.control-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 3px 12px rgba(57, 255, 20, 0.6);
}

.control-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #39ff14;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(57, 255, 20, 0.4);
  transition: all 0.3s ease;
}

.control-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 3px 12px rgba(57, 255, 20, 0.6);
}

.control-hint {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
}

.control-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #39ff14;
}

.control-input {
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
}

.control-input:focus {
  border-color: #39ff14;
  background: rgba(255, 255, 255, 0.08);
}

.resize-options {
  padding-left: 1rem;
  border-left: 2px solid rgba(57, 255, 20, 0.3);
}

/* File Info */
.file-info {
  padding: 1.5rem;
  border-radius: 16px;
  background: rgba(5, 12, 24, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 768px) {
  .file-info {
    padding: 1rem;
    border-radius: 12px;
  }
}

.file-info-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.file-info-row:last-child {
  margin-bottom: 0;
}

.file-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-info-label {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.file-info-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: #39ff14;
}

/* Comparison Container */
.comparison-container {
  margin-top: 2rem;
}

.image-comparison {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

@media (max-width: 768px) {
  .image-comparison {
    gap: 1rem;
  }
}

.comparison-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.comparison-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e0ffef;
  margin: 0;
  text-align: center;
}

.image-wrapper {
  position: relative;
  border-radius: 16px;
  background: rgba(5, 12, 24, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

@media (max-width: 768px) {
  .image-wrapper {
    min-height: 200px;
    padding: 0.75rem;
    border-radius: 12px;
  }
}

.preview-canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 60vh;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 220ms ease-in-out;
}

@media (max-width: 768px) {
  .preview-canvas {
    max-height: 45vh;
    border-radius: 6px;
  }
}

.preview-canvas.loaded {
  opacity: 1;
}

/* Ensure upload area sits above helper card to avoid accidental overlap */
.upload-area {
  position: relative;
  z-index: 2;
}
.helper-card {
  position: relative;
  z-index: 1;
}

/* How-to Section */
.how-to-section {
  margin-top: 2rem;
  padding: 1.5rem 1rem;
  border-radius: 14px;
  background: rgba(5, 12, 24, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.how-to-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #e0ffef;
  text-align: center;
  margin: 0 0 1.25rem;
}

.how-to-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.how-to-step {
  text-align: center;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  margin: 0 auto 1rem;
  background: #39ff14;
  color: #000;
  font-size: 1.75rem;
  font-weight: 700;
  border-radius: 50%;
  box-shadow: 0 4px 15px rgba(57, 255, 20, 0.3);
}

.step-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: #e0ffef;
  margin: 0 0 0.75rem;
}

.step-description {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
  margin: 0;
}

/* FAQ Section */
.faq-section {
  margin-top: 2rem;
  padding: 1.5rem 1rem;
  border-radius: 14px;
  background: rgba(5, 12, 24, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.faq-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #e0ffef;
  text-align: center;
  margin: 0 0 1.25rem;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.faq-item {
  padding: 1.5rem;
  border-radius: 16px;
  background: rgba(8, 15, 25, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s ease;
}

.faq-item:hover {
  border-color: rgba(57, 255, 20, 0.3);
  transform: translateY(-2px);
}

.faq-question {
  font-size: 1.1rem;
  font-weight: 600;
  color: #39ff14;
  margin: 0 0 0.75rem;
}

.faq-answer {
  /* Mobile improvements: tighter spacing, full-width buttons, stacked actions */
  @media (max-width: 768px) {
    .main-layout {
      padding: 12px 8px;
      gap: 12px;
    }
    .container {
      padding-left: 8px;
      padding-right: 8px;
    }
    .upload-area {
      padding: 14px;
      border-radius: 12px;
    }
    .upload-icon {
      width: 56px;
      height: 56px;
    }
    .upload-title {
      font-size: 1.15rem;
    }
    .upload-description,
    .upload-formats {
      font-size: 0.95rem;
    }
    .upload-button {
      width: 100%;
      padding: 0.75rem;
      font-size: 0.95rem;
      box-shadow: none;
    }
    .download-options {
      justify-content: center;
      gap: 8px;
    }
    .download-options .reset-button,
    .download-options .download-button,
    .download-options .donate-button {
      width: 100%;
    }
    .controls-area {
      padding: 12px;
    }
    .file-info {
      padding: 12px;
    }
    .image-wrapper {
      min-height: 160px;
    }
    .preview-canvas {
      max-height: 35vh;
    }
    .comparison-title {
      font-size: 1rem;
    }
    .batch-controls {
      gap: 8px;
    }
    .batch-controls .upload-button,
    .batch-controls .compress-all-button,
    .batch-controls .donate-button {
      width: 100%;
    }
    .how-to-grid,
    .faq-grid {
      gap: 12px;
    }
  }

  @media (max-width: 420px) {
    .page__title {
      font-size: calc(var(--h1-size) * 0.9) !important;
      margin-bottom: calc(var(--h1-gap) * 0.9) !important;
    }
    .lead {
      font-size: 0.95rem;
    }
    .upload-area {
      padding: 12px;
    }
    .upload-icon {
      width: 48px;
      height: 48px;
    }
    .image-wrapper {
      min-height: 140px;
    }
    .preview-canvas {
      max-height: 30vh;
    }
    .download-options {
      flex-direction: column;
    }
    .download-options button,
    .download-options a {
      width: 100%;
    }
    .control-section {
      padding: 12px;
    }
  }
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.6;
  margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .main-layout {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .control-section__row {
    grid-template-columns: 1fr;
  }

  .image-comparison {
    grid-template-columns: 1fr;
  }

  .how-to-grid,
  .faq-grid {
    grid-template-columns: 1fr;
  }

  .download-options {
    flex-direction: column;
  }

  .file-info-row {
    grid-template-columns: 1fr;
  }

  /* Keep helper card visually separated from the upload area on small screens */
  .helper-card {
    margin-top: 1rem;
  }
}

@media (max-width: 480px) {
  .page {
    padding: 2rem 0.5rem;
  }

  .page__title {
    font-size: calc(var(--h1-size) * 0.93) !important;
    margin-bottom: calc(var(--h1-gap) * 0.93) !important;
  }

  .upload-area {
    padding: 1.5rem 1rem;
  }

  .upload-icon {
    width: 50px;
    height: 50px;
  }

  .how-to-section,
  .faq-section {
    padding: 1.5rem 1rem;
    margin-top: 2.5rem;
  }

  .how-to-title,
  .faq-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
  }

  .step-number {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }

  .step-title {
    font-size: 1.15rem;
  }

  .faq-item {
    padding: 1rem;
  }

  .faq-question {
    font-size: 1rem;
  }
}

/* Desktop: force FAQ to two columns for better readability */
@media (min-width: 992px) {
  .faq-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 2rem;
    max-width: 1100px;
    margin: 0 auto;
  }
}
