/* TulBD Image Converter Suite - Ultra-Fast Client-Side CSS */
.img-conv-card {
  background: var(--tb-card, #ffffff);
  border: 1px solid var(--tb-border, #e2e8f0);
  border-radius: var(--tb-radius-lg, 16px);
  padding: 24px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
  margin: 0 0 32px;
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
}

[data-theme="dark"] .img-conv-card {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.4);
}

.img-conv-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3b82f6, #06b6d4, #10b981);
}

.img-conv-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  margin-bottom: 22px;
  width: 100%;
}

.img-conv-title-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0 auto;
  text-align: center;
}

.img-conv-icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}

.img-conv-real-logo {
  width: 48px;
  height: 48px;
  display: block;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.08));
}

[data-theme="dark"] .img-conv-real-logo rect:first-child,
body.dark-theme .img-conv-real-logo rect:first-child {
  fill: #1e293b;
  stroke: #334155;
}

.img-conv-title-wrap h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  color: var(--tb-text, #0f172a);
  text-align: center;
  line-height: 1.25;
}

[data-theme="dark"] .img-conv-title-wrap h2,
body.dark-theme .img-conv-title-wrap h2 {
  color: #f8fafc;
}

.img-conv-lead {
  text-align: center;
  max-width: 780px;
  margin: 0 auto;
  color: var(--tb-text-secondary, #64748b);
  font-size: 14.5px;
  line-height: 1.6;
}

[data-theme="dark"] .img-conv-lead,
body.dark-theme .img-conv-lead {
  color: #94a3b8;
}

.img-conv-badge-safe {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #059669;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 4px 10px;
  border-radius: 9999px;
}

/* Quick Format Switcher */
.img-format-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--tb-border, rgba(0, 0, 0, 0.08));
}

.img-format-pill {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  min-width: max-content;
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  background: var(--tb-surface, #f8fafc);
  color: var(--tb-text-secondary, #475569);
  border: 1px solid var(--tb-border, #e2e8f0);
  transition: all 0.2s ease;
  box-sizing: border-box;
  line-height: 1.3;
}

.img-format-pill:hover {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.img-format-pill.active {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #1d4ed8 !important;
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.35);
}

/* Dark Mode visibility fix for Format Switcher */
[data-theme="dark"] .img-format-switcher,
body.dark-theme .img-format-switcher,
.dark-theme .img-format-switcher {
  border-bottom-color: #273549 !important;
  background: transparent !important;
}

[data-theme="dark"] .img-format-pill,
body.dark-theme .img-format-pill,
.dark-theme .img-format-pill,
[data-theme="dark"] .img-format-switcher .img-format-pill,
body.dark-theme .img-format-switcher .img-format-pill {
  background: #0f172a !important;
  color: #f1f5f9 !important;
  border: 1px solid #334155 !important;
  box-shadow: none;
}

[data-theme="dark"] .img-format-pill:hover,
body.dark-theme .img-format-pill:hover,
.dark-theme .img-format-pill:hover,
[data-theme="dark"] .img-format-switcher .img-format-pill:hover,
body.dark-theme .img-format-switcher .img-format-pill:hover {
  background: #1e293b !important;
  color: #38bdf8 !important;
  border-color: #2563eb !important;
  transform: translateY(-1px);
}

[data-theme="dark"] .img-format-pill.active,
body.dark-theme .img-format-pill.active,
.dark-theme .img-format-pill.active,
[data-theme="dark"] .img-format-switcher .img-format-pill.active,
body.dark-theme .img-format-switcher .img-format-pill.active {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.45) !important;
}

/* Dropzone */
.img-dropzone {
  border: 2px dashed #93c5fd;
  background: rgba(239, 246, 255, 0.6);
  border-radius: 14px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  outline: none;
}

[data-theme="dark"] .img-dropzone {
  border-color: #3b82f6;
  background: rgba(30, 41, 59, 0.5);
}

.img-dropzone:hover,
.img-dropzone.dragover {
  border-color: #2563eb;
  background: rgba(219, 234, 254, 0.8);
  transform: translateY(-1px);
}

.img-dropzone-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

[data-theme="dark"] .img-dropzone-icon {
  background: #1e293b;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.img-dropzone-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--tb-text, #0f172a);
  margin-bottom: 6px;
}

.img-dropzone-sub {
  font-size: 13px;
  color: var(--tb-text-secondary, #64748b);
  margin-bottom: 12px;
}

.img-dropzone-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #2563eb;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 8px;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* Settings Panel (Resolution & Compression) */
.img-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 22px;
  background: var(--tb-bg-secondary, #f8fafc);
  border: 1px solid var(--tb-border, #e2e8f0);
  border-radius: 12px;
  padding: 18px;
}

[data-theme="dark"] .img-settings-grid {
  background: #0f172a;
  border-color: #334155;
}

.img-setting-box h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--tb-text, #0f172a);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.img-setting-tag {
  font-size: 11px;
  font-weight: 600;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
}

/* Resolution Controls */
.img-res-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.img-input-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.img-input-wrap label {
  font-size: 11px;
  font-weight: 600;
  color: var(--tb-text-secondary, #64748b);
  text-transform: uppercase;
}

.img-input-wrap input {
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--tb-border, #cbd5e1);
  border-radius: 8px;
  background: var(--tb-card, #ffffff);
  color: var(--tb-text, #0f172a);
  box-sizing: border-box;
}

[data-theme="dark"] .img-input-wrap input {
  background: #1e293b;
  border-color: #475569;
}

.img-lock-btn {
  background: var(--tb-card, #ffffff);
  border: 1px solid var(--tb-border, #cbd5e1);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--tb-text-secondary, #64748b);
  transition: all 0.15s ease;
}

.img-lock-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
}

[data-theme="dark"] .img-lock-btn {
  background: #1e293b;
  border-color: #475569;
  color: #94a3b8;
}

.img-lock-btn.locked {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

/* Presets */
.img-preset-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.img-preset-btn {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--tb-border, #cbd5e1);
  background: var(--tb-card, #ffffff);
  color: var(--tb-text, #0f172a);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

[data-theme="dark"] .img-preset-btn {
  background: #1e293b;
  border-color: #475569;
}

.img-preset-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
}

/* Compression Quality Slider */
.img-quality-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.img-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #cbd5e1;
  outline: none;
}

[data-theme="dark"] .img-slider {
  background: #475569;
}

.img-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2563eb;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(37, 99, 235, 0.4);
}

.img-quality-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--tb-text-secondary, #64748b);
}

.img-quality-val {
  font-weight: 700;
  color: #2563eb;
}

/* Preview Comparison Section */
.img-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.img-preview-card {
  border: 1px solid var(--tb-border, #e2e8f0);
  background: var(--tb-card, #ffffff);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .img-preview-card {
  background: #0f172a;
  border-color: #334155;
}

.img-preview-head {
  padding: 10px 14px;
  background: var(--tb-bg-secondary, #f8fafc);
  border-bottom: 1px solid var(--tb-border, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: var(--tb-text, #0f172a);
}

[data-theme="dark"] .img-preview-head {
  background: #1e293b;
  border-color: #334155;
}

.img-preview-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.img-badge-orig {
  background: #e2e8f0;
  color: #475569;
}

.img-badge-conv {
  background: #dbeafe;
  color: #1e40af;
}

.img-preview-body {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  max-height: 320px;
  background: repeating-conic-gradient(#f1f5f9 0% 25%, #ffffff 0% 50%) 50% / 16px 16px;
  overflow: hidden;
}

[data-theme="dark"] .img-preview-body {
  background: repeating-conic-gradient(#1e293b 0% 25%, #0f172a 0% 50%) 50% / 16px 16px;
}

.img-preview-body img,
.img-preview-body canvas {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.img-preview-placeholder {
  color: var(--tb-text-secondary, #94a3b8);
  font-size: 13px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.img-preview-meta {
  padding: 10px 14px;
  background: var(--tb-bg-secondary, #f8fafc);
  border-top: 1px solid var(--tb-border, #e2e8f0);
  font-size: 12px;
  color: var(--tb-text-secondary, #64748b);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

[data-theme="dark"] .img-preview-meta {
  background: #1e293b;
  border-color: #334155;
}

/* Actions Toolbar */
.img-actions-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--tb-border, #e2e8f0);
  text-align: center;
}

.img-btn-convert {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 26px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: all 0.2s ease;
}

.img-btn-convert:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}

.img-btn-convert:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.img-btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #059669, #10b981);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 26px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  animation: imgPulseDownload 2s infinite;
  text-decoration: none;
  transition: all 0.2s ease;
}

.img-btn-download:hover {
  background: linear-gradient(135deg, #047857, #059669);
  transform: translateY(-1px);
}

@keyframes imgPulseDownload {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.img-btn-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  color: var(--tb-text-secondary, #64748b);
  border: 1px solid var(--tb-border, #cbd5e1);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.img-btn-reset:hover {
  background: var(--tb-bg-secondary, #f1f5f9);
  color: var(--tb-text, #0f172a);
}

.img-status-msg {
  width: 100%;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--tb-text-secondary, #64748b);
  margin: 6px 0 0;
  order: 10;
}

.img-status-msg.success {
  color: #059669;
}

.img-status-msg.error {
  color: #dc2626;
}

@media (max-width: 640px) {
  .img-conv-card {
    padding: 16px 12px;
  }
  .img-preview-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
    margin-top: 16px;
  }
  .img-preview-card {
    border-radius: 10px;
  }
  .img-preview-body {
    min-height: 180px;
    max-height: 280px;
    padding: 12px;
  }
  .img-preview-body img,
  .img-preview-body canvas {
    max-width: 100% !important;
    max-height: 240px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block;
    margin: 0 auto;
  }
  .img-actions-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .img-btn-convert,
  .img-btn-download,
  .img-btn-reset {
    width: 100%;
  }
}

.img-related-tools {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
}
