/* ============================================================
   깨알도구
   이미지 리사이즈

   공통 페이지 / 패널 / 폼 / 버튼 / 가이드는
   tool-common.css 사용
   ============================================================ */

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

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

.resize-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;
}

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

  background: #fffaf0;

  transform: translateY(-1px);
}

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

  background: #fff7df;
}

.resize-drop-icon {
  display: block;

  margin-bottom: 2px;

  font-size: 32px;
}

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

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

  text-align: center;
}

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

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

  text-align: center;
}

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

.resize-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;
}

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

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

  overflow: hidden;

  border-radius: 8px;

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

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

  width: 100%;
  height: 100%;

  object-fit: cover;
}

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

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

  overflow: hidden;

  color: var(--text);

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

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

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

  margin-top: 3px;

  color: var(--text-soft);

  font-size: 12px;
}

.resize-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;
}

.resize-file-info > button:hover {
  color: var(--text);
}

/* ============================================================
   SIZE
   ============================================================ */

.resize-size-grid {
  display: grid;

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

  align-items: end;

  gap: 7px;
}

.resize-ratio-button {
  width: 34px;
  height: 48px;

  padding: 0;

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

  background: #ffffff;

  color: var(--text-soft);

  font-size: 13px;

  cursor: pointer;
}

.resize-ratio-button.is-locked {
  border-color: var(--brand);

  background: #fff7df;

  color: var(--brand);
}

.resize-ratio-button:disabled {
  opacity: 0.4;

  cursor: not-allowed;
}

.resize-ratio-info {
  margin-top: 7px;

  color: var(--text-soft);

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

/* ============================================================
   PRESET
   ============================================================ */

.resize-preset-grid {
  display: grid;

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

  gap: 6px;
}

.resize-preset {
  min-width: 0;

  min-height: 49px;

  padding: 7px 5px;

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

  background: var(--surface-soft);

  color: var(--text);

  font-family: inherit;

  cursor: pointer;

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

.resize-preset:hover:not(:disabled) {
  transform: translateY(-1px);

  border-color: var(--accent);

  background: #fffaf0;
}

.resize-preset:disabled {
  opacity: 0.42;

  cursor: not-allowed;
}

.resize-preset strong {
  display: block;

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

.resize-preset small {
  display: block;

  margin-top: 2px;

  color: var(--text-soft);

  font-size: 12px;
}

/* ============================================================
   OUTPUT SETTINGS
   ============================================================ */

.resize-output-grid {
  display: grid;

  grid-template-columns:
    minmax(0, 0.8fr)
    minmax(0, 1.2fr);

  align-items: end;

  gap: 10px;
}

.resize-quality-value {
  margin-left: 4px;

  color: var(--brand);

  font-size: 12px;
}

.resize-quality-range {
  width: 100%;
  height: 8px;

  margin: 14px 0 9px;

  accent-color: var(--brand);

  cursor: pointer;
}

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

  cursor: not-allowed;
}

.resize-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;
}

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

.resize-result-panel {
  min-height: 520px;

  justify-content: flex-start;
}

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

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

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

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

.resize-preview-section + .resize-preview-section {
  margin-top: 12px;
}

.resize-preview-head {
  display: flex;

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

  gap: 10px;

  margin-bottom: 6px;
}

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

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

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

  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.resize-preview-box {
  width: 100%;
  min-height: 150px;

  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;
}

.resize-preview-box img,
.resize-preview-box canvas {
  display: block;

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

  object-fit: contain;

  border-radius: 5px;
}

.resize-output-preview canvas {
  width: auto;
  height: auto;
}

/* ============================================================
   COMPARISON
   ============================================================ */

.resize-comparison {
  display: grid;

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

  align-items: center;

  gap: 5px;

  margin-top: 12px;

  padding: 10px;

  border-radius: 10px;

  background: var(--surface-soft);

  text-align: center;
}

.resize-comparison[hidden] {
  display: none;
}

.resize-comparison span {
  display: block;

  color: var(--text-soft);

  font-size: 12px;
}

.resize-comparison strong {
  display: block;

  margin-top: 3px;

  color: var(--text);

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

  overflow-wrap: anywhere;
}

.resize-comparison-arrow {
  color: var(--accent);

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

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

.resize-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;

  transition:
    transform 0.15s ease,
    opacity 0.15s ease;
}

.resize-download-button:hover {
  transform: translateY(-1px);
}

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

.resize-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;
}

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

  color: var(--text);
}

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

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

    min-height: 0;
  }
}

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

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

    padding: 18px 12px;
  }

  .resize-size-grid {
    grid-template-columns:
      minmax(0, 1fr)
      30px
      minmax(0, 1fr);

    gap: 5px;
  }

  .resize-ratio-button {
    width: 30px;
  }

  .resize-preset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .resize-output-grid {
    grid-template-columns: 1fr;

    gap: 13px;
  }

  .resize-preview-box {
    min-height: 125px;
  }

  .resize-preview-box img,
  .resize-preview-box canvas {
    max-height: 240px;
  }
}
