/* ============================================================
   깨알도구
   이미지 압축

   공통 페이지 / 폼 / 패널 / 버튼 / 안내 영역은
   tool-common.css 사용
   ============================================================ */

.image-compress-page {
  --tool-page-max-width: 960px;
}

/* ============================================================
   DROPZONE
   ============================================================ */

.compress-dropzone {
  width: 100%;
  min-height: 160px;

  display: flex;

  flex-direction: column;

  align-items: center;
  justify-content: center;

  gap: 6px;

  padding: 22px;

  border: 2px dashed #d4d2ca;
  border-radius: 14px;

  background: var(--surface-soft);

  color: var(--text);

  font-family: inherit;

  cursor: pointer;

  box-sizing: border-box;

  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.compress-dropzone:hover {
  border-color: var(--accent);

  background: #fffaf0;

  transform: translateY(-1px);
}

.compress-dropzone.is-dragover {
  border-color: var(--brand);

  background: #fff7df;
}

.compress-drop-icon {
  display: block;

  margin-bottom: 2px;

  font-size: 34px;
}

.compress-dropzone strong {
  color: var(--text);

  font-size: 12px;
  font-weight: 850;

  text-align: center;
}

.compress-dropzone small {
  color: var(--text-soft);

  font-size: 12px;
  line-height: 1.5;

  text-align: center;
}

/* ============================================================
   FILE INFO
   ============================================================ */

.compress-file-info {
  display: grid;

  grid-template-columns:
    48px
    minmax(0, 1fr)
    30px;

  align-items: center;

  gap: 9px;

  margin-top: 9px;

  padding: 8px;

  border: 1px solid var(--line);
  border-radius: 10px;

  background: #ffffff;
}

.compress-file-info[hidden] {
  display: none;
}

.compress-file-thumb {
  width: 48px;
  height: 48px;

  overflow: hidden;

  border-radius: 8px;

  background: var(--surface-soft);
}

.compress-file-thumb img {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: cover;
}

.compress-file-copy {
  min-width: 0;
}

.compress-file-copy strong {
  display: block;

  overflow: hidden;

  color: var(--text);

  font-size: 12px;
  font-weight: 850;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.compress-file-copy span {
  display: block;

  margin-top: 3px;

  color: var(--text-soft);

  font-size: 12px;
}

.compress-file-info > button {
  width: 30px;
  height: 30px;

  padding: 0;

  border: 0;
  border-radius: 50%;

  background: var(--surface-soft);

  color: var(--text-soft);

  font-size: 17px;

  cursor: pointer;
}

/* ============================================================
   QUALITY
   ============================================================ */

.compress-quality-badge {
  min-width: 45px;

  padding: 5px 8px;

  border-radius: 999px;

  background: #fff6dd;

  color: var(--brand);

  font-size: 12px;
  font-weight: 900;

  text-align: center;

  font-variant-numeric: tabular-nums;
}

.compress-quality-range {
  display: block;

  width: 100%;

  margin: 13px 0 5px;

  accent-color: var(--brand);

  cursor: pointer;
}

.compress-quality-range:disabled {
  opacity: 0.4;

  cursor: not-allowed;
}

.compress-quality-scale {
  display: flex;

  justify-content: space-between;

  color: var(--text-soft);

  font-size: 12px;
}

.compress-quality-presets {
  display: grid;

  grid-template-columns: repeat(5, minmax(0, 1fr));

  gap: 5px;

  margin-top: 10px;
}

.compress-quality-presets button {
  min-width: 0;

  padding: 7px 3px;

  border: 1px solid var(--line);
  border-radius: 8px;

  background: var(--surface-soft);

  color: var(--text);

  font-family: inherit;

  cursor: pointer;
}

.compress-quality-presets button:hover:not(:disabled) {
  border-color: var(--accent);

  background: #fffaf0;
}

.compress-quality-presets button.active {
  border-color: var(--brand);

  background: #fff6dd;
}

.compress-quality-presets button:disabled {
  opacity: 0.4;

  cursor: not-allowed;
}

.compress-quality-presets strong {
  display: block;

  font-size: 12px;
  font-weight: 900;
}

.compress-quality-presets small {
  display: block;

  margin-top: 2px;

  color: var(--text-soft);

  font-size: 12px;
}

/* ============================================================
   FORMAT
   ============================================================ */

.compress-format-buttons {
  display: grid;

  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 7px;
}

.compress-format-buttons button {
  min-height: 58px;

  padding: 8px;

  border: 1px solid var(--line);
  border-radius: 10px;

  background: var(--surface-soft);

  color: var(--text);

  font-family: inherit;

  cursor: pointer;
}

.compress-format-buttons button:hover:not(:disabled) {
  border-color: var(--accent);
}

.compress-format-buttons button.active {
  border-color: var(--brand);

  background: #fff6dd;
}

.compress-format-buttons button:disabled {
  opacity: 0.42;

  cursor: not-allowed;
}

.compress-format-buttons strong {
  display: block;

  font-size: 12px;
  font-weight: 900;
}

.compress-format-buttons small {
  display: block;

  margin-top: 3px;

  color: var(--text-soft);

  font-size: 12px;
}

.compress-format-help {
  margin-top: 7px;

  padding: 7px 9px;

  border-radius: 8px;

  background: var(--surface-soft);

  color: var(--text-soft);

  font-size: 12px;
  line-height: 1.45;
}

/* ============================================================
   ORIGINAL INFO
   ============================================================ */

.compress-original-info {
  display: grid;

  grid-template-columns: repeat(3, minmax(0, 1fr));

  gap: 6px;

  margin-bottom: 13px;
}

.compress-original-info[hidden] {
  display: none;
}

.compress-original-info > div {
  min-width: 0;

  padding: 9px 5px;

  border-radius: 9px;

  background: var(--surface-soft);

  text-align: center;
}

.compress-original-info span {
  display: block;

  color: var(--text-soft);

  font-size: 12px;
}

.compress-original-info strong {
  display: block;

  margin-top: 3px;

  color: var(--text);

  font-size: 12px;
  font-weight: 850;

  overflow-wrap: anywhere;
}

/* ============================================================
   RESULT PANEL
   ============================================================ */

.compress-result-panel {
  min-height: 500px;

  justify-content: flex-start;
}

/* ============================================================
   RESULT
   ============================================================ */

.compress-result-content {
  width: 100%;
}

.compress-result-content[hidden] {
  display: none;
}

/* ============================================================
   PREVIEW
   ============================================================ */

.compress-preview-head {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 10px;

  margin-bottom: 6px;
}

.compress-preview-head strong {
  color: var(--text);

  font-size: 12px;
  font-weight: 850;
}

.compress-preview-head span {
  color: var(--text-soft);

  font-size: 12px;
}

.compress-preview-box {
  width: 100%;
  min-height: 220px;

  display: flex;

  align-items: center;
  justify-content: center;

  overflow: hidden;

  padding: 8px;

  border: 1px solid var(--line);
  border-radius: 11px;

  background:
    linear-gradient(45deg, #ecebe6 25%, transparent 25%),
    linear-gradient(-45deg, #ecebe6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ecebe6 75%),
    linear-gradient(-45deg, transparent 75%, #ecebe6 75%), #f8f7f3;

  background-size: 18px 18px;

  background-position:
    0 0,
    0 9px,
    9px -9px,
    -9px 0;

  box-sizing: border-box;
}

.compress-preview-box canvas {
  display: block;

  max-width: 100%;
  max-height: 330px;

  border-radius: 5px;
}

/* ============================================================
   SAVING
   ============================================================ */

.compress-saving-card {
  margin-top: 12px;

  padding: 15px;

  border-radius: 12px;

  background: linear-gradient(145deg, #202737, #111722);

  color: #ffffff;

  text-align: center;
}

.compress-saving-card[hidden] {
  display: none;
}

.compress-saving-card span {
  display: block;

  color: rgba(255, 255, 255, 0.6);

  font-size: 12px;
  font-weight: 800;
}

.compress-saving-card strong {
  display: block;

  margin-top: 2px;

  color: #ffd979;

  font-size: 35px;
  font-weight: 900;

  letter-spacing: -1px;
}

.compress-saving-card small {
  display: block;

  margin-top: 3px;

  color: rgba(255, 255, 255, 0.7);

  font-size: 12px;
}

/* ============================================================
   COMPARE
   ============================================================ */

.compress-compare {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr)
    50px
    minmax(0, 1fr);

  align-items: center;

  gap: 5px;

  margin-top: 9px;

  padding: 10px;

  border-radius: 10px;

  background: var(--surface-soft);

  text-align: center;
}

.compress-compare[hidden] {
  display: none;
}

.compress-compare span {
  display: block;

  color: var(--text-soft);

  font-size: 12px;
}

.compress-compare strong {
  display: block;

  margin-top: 3px;

  color: var(--text);

  font-size: 12px;
  font-weight: 900;
}

.compress-compare-middle span {
  color: var(--accent);

  font-size: 16px;
  font-weight: 900;
}

.compress-compare-middle small {
  display: block;

  margin-top: 1px;

  color: var(--text-soft);

  font-size: 12px;
}

/* ============================================================
   DETAIL
   ============================================================ */

.compress-detail-grid {
  display: grid;

  grid-template-columns: repeat(3, minmax(0, 1fr));

  gap: 6px;

  margin-top: 8px;
}

.compress-detail-grid[hidden] {
  display: none;
}

.compress-detail-grid > div {
  min-width: 0;

  padding: 8px 5px;

  border: 1px solid var(--line);
  border-radius: 8px;

  background: #ffffff;

  text-align: center;
}

.compress-detail-grid span {
  display: block;

  color: var(--text-soft);

  font-size: 12px;
}

.compress-detail-grid strong {
  display: block;

  margin-top: 3px;

  color: var(--text);

  font-size: 12px;
  font-weight: 850;

  overflow-wrap: anywhere;
}

/* ============================================================
   DOWNLOAD
   ============================================================ */

.compress-download-button {
  width: 100%;
  min-height: 48px;

  display: flex;

  align-items: center;
  justify-content: center;

  margin-top: 12px;

  padding: 0 14px;

  border-radius: var(--tool-button-radius);

  background: var(--brand);

  color: #ffffff;

  font-size: 12px;
  font-weight: 850;

  text-decoration: none;

  box-sizing: border-box;
}

.compress-download-button[hidden] {
  display: none;
}

.compress-reset-button {
  width: 100%;

  margin-top: 7px;

  padding: 8px;

  border: 1px solid var(--line);
  border-radius: 9px;

  background: #ffffff;

  color: var(--text-soft);

  font-family: inherit;
  font-size: 12px;
  font-weight: 800;

  cursor: pointer;
}

.compress-reset-button:hover {
  background: var(--surface-soft);
}

/* ============================================================
   TABLET
   ============================================================ */

@media (max-width: 760px) {
  .compress-result-panel {
    order: -1;

    min-height: 0;
  }
}

/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 520px) {
  .compress-dropzone {
    min-height: 140px;

    padding: 18px 12px;
  }

  .compress-quality-presets {
    grid-template-columns: repeat(5, minmax(0, 1fr));

    gap: 3px;
  }

  .compress-quality-presets button {
    padding: 6px 1px;
  }

  .compress-quality-presets small {
    display: none;
  }

  .compress-original-info {
    grid-template-columns: 1fr;
  }

  .compress-preview-box {
    min-height: 170px;
  }

  .compress-preview-box canvas {
    max-height: 260px;
  }

  .compress-detail-grid {
    grid-template-columns: 1fr;
  }
}
