/* The image tools: the drop zone, the settings, the per-file list, the
   before/after comparison and the metadata panel. Hero, content sections,
   cards, table and FAQ all come from tool_page.css. */

/* The starfield behind the hero is a full-size absolutely positioned image at
   z-index 0, so anything interactive on top of it needs its own stacking
   context or the image swallows every click. */
.im {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto 56px auto;
  padding: 0 16px;
}

.im-panel {
  margin-top: 16px;
  padding: 20px;
  border-radius: 16px;
  border: 0.5px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
}

.im-panel-title {
  margin: 0 0 6px 0;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
}

.im-hint {
  margin: 0 0 14px 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  line-height: 22px;
}

.im-note {
  margin: 14px 0 0 0;
  color: #6ee7a8;
  font-size: 13px;
  line-height: 20px;
}

.im-field-label {
  display: block;
  margin-bottom: 7px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 500;
}

/* Drop zone */

.im-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.26);
  background: rgba(0, 0, 0, 0.2);
  color: rgba(255, 255, 255, 0.68);
  font-size: 15px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.im-drop i {
  font-size: 30px;
  color: #b38bff;
}

.im-drop small {
  color: rgba(255, 255, 255, 0.45);
  font-size: 13px;
}

.im-drop:hover,
.im-drop.is-over,
.im-drop:focus-visible {
  border-color: #8c46ff;
  background: rgba(140, 70, 255, 0.12);
  outline: none;
}

.im-file {
  display: none;
}

/* Settings */

.im-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.im-setting {
  min-width: 0;
}

.im-setting select,
.im-setting input[type="number"] {
  width: 100%;
  border-radius: 10px;
  border: 0.5px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  font-size: 15px;
  line-height: 22px;
  padding: 10px 13px;
}

.im-setting select option {
  background: #1b0b33;
  color: #fff;
}

.im-setting select:focus,
.im-setting input:focus {
  outline: none;
  border-color: #8c46ff;
}

.im-setting input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.14);
  accent-color: #8c46ff;
  cursor: pointer;
}

.im-segment {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  border: 0.5px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.24);
}

.im-segment-item {
  padding: 7px 16px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.im-segment-item.is-active {
  background: rgba(140, 70, 255, 0.36);
  color: #fff;
}

.im-dimensions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.im-dimensions input {
  min-width: 0;
}

.im-times {
  color: rgba(255, 255, 255, 0.4);
}

.im-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0 0;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.im-check input {
  width: 17px;
  height: 17px;
  accent-color: #8c46ff;
  cursor: pointer;
}

.im-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Reserves one line's height whether or not it is saying anything, so a status
   message appearing and vanishing moves nothing on the page. */
.im-status {
  grid-column: 1 / -1;
  min-height: 20px;
  margin: 0;
  color: #6ee7a8;
  font-size: 13px;
  line-height: 20px;
}

/* File list */

.im-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.im-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.24);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.im-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

.im-row.is-selected {
  border-color: #8c46ff;
  background: rgba(140, 70, 255, 0.14);
}

.im-thumb {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  background: repeating-conic-gradient(#3a3a3a 0% 25%, #2a2a2a 0% 50%) 0 0 / 12px 12px;
}

.im-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.im-row-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.im-row-name {
  color: #fff;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.im-row-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: rgba(255, 255, 255, 0.55);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.im-row-after {
  color: #fff;
}

.im-arrow {
  color: rgba(255, 255, 255, 0.35);
}

.im-badge {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
}

.im-badge.is-good {
  background: rgba(110, 231, 168, 0.16);
  color: #6ee7a8;
}

.im-badge.is-flat {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
}

.im-row-dims {
  color: rgba(255, 255, 255, 0.4);
  font-size: 12px;
}

.im-row-note {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12.5px;
}

.im-row-error {
  color: #ff9b9b;
  font-size: 12.5px;
}

.im-row-download {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 0.5px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.8);
  font-size: 17px;
  text-decoration: none;
  transition: background 0.2s ease;
}

.im-row-download:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* Before / after */

.im-compare {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  line-height: 0;
  background: repeating-conic-gradient(#3a3a3a 0% 25%, #2a2a2a 0% 50%) 0 0 / 16px 16px;
}

.im-compare img {
  display: block;
  width: 100%;
  height: auto;
}

/* The original is clipped over the processed one, so dragging the handle
   reveals the difference in place rather than side by side. */
.im-compare-before {
  position: absolute;
  inset: 0;
  width: 50%;
  overflow: hidden;
}

.im-compare-before img {
  position: absolute;
  top: 0;
  left: 0;
  width: auto;
  max-width: none;
  height: 100%;
}

.im-compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: rgba(255, 255, 255, 0.9);
  transform: translateX(-1px);
  pointer-events: none;
}

.im-compare-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.45);
}

.im-compare-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.55);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

/* EXIF */

.im-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.im-exif-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 8px 0;
  border-top: 0.5px solid rgba(255, 255, 255, 0.08);
}

.im-exif-row:first-child {
  border-top: none;
}

.im-exif-label {
  flex: 0 0 170px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 14px;
}

.im-exif-value {
  flex: 1 1 200px;
  min-width: 0;
  color: #fff;
  font-size: 14px;
  word-break: break-word;
}

a.im-exif-value {
  color: #c9a2ff;
  text-decoration: underline;
}

.im-exif-row.is-warn .im-exif-label {
  color: #ffc98b;
}

@media (max-width: 640px) {
  .im-settings {
    grid-template-columns: minmax(0, 1fr);
  }

  .im-actions .tp-btn {
    width: 100%;
  }

  .im-exif-label {
    flex: 1 1 100%;
  }

  .im-thumb {
    width: 44px;
    height: 44px;
  }
}
