/* /tool/image-editor — 이미지 편집 올인원 도구 (완전 클라이언트사이드). 2026-08-30 신규. */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
  background: #f5f6f8;
  color: #1f2937;
}

/* ── 상단 네비 (view/tool/_e/topnav.php 공통 partial, navPrefix='ie') ──
   배경/보더는 항상 풀와이드인 .ie-topnav에, 콘텐츠 폭 제한은 안쪽 .ie-topnav-left에 분리. */
.ie-topnav {
  border-bottom: 1px solid #e2e6ec;
  background: #fff;
}
.ie-topnav-left {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 24px;
  position: relative;
}
.ie-site-brand { font-weight: 900; font-size: 16px; color: #f59e0b; text-decoration: none; flex-shrink: 0; }
.ie-topnav a:not(.ie-site-brand) {
  color: #556; text-decoration: none; font-size: 13px;
  display: inline-flex; align-items: center; gap: 4px;
}
.ie-topnav a:not(.ie-site-brand):hover { color: #f59e0b; }

/* 도구 전환 드롭다운 (view/tool/_e/topnav.php 공통) */
.ie-tool-switcher { position: relative; }
.ie-tool-switcher-btn .fa-chevron-down { font-size: 10px; margin-left: 2px; transition: transform .15s; }
.ie-tool-switcher.open .fa-chevron-down { transform: rotate(180deg); }
.ie-tool-switcher-panel {
  display: none; position: absolute; top: calc(100% + 10px); left: 0; min-width: 220px;
  background: #fff; border: 1px solid #e2e6ec; border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15,23,42,.14); padding: 6px; z-index: 100;
}
.ie-tool-switcher.open .ie-tool-switcher-panel { display: block; }
.ie-tool-switcher-item {
  display: flex !important; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  font-size: 13px !important; color: #334155 !important; white-space: nowrap;
}
.ie-tool-switcher-item:hover { background: #f5f6f8; color: #334155 !important; }
.ie-tool-switcher-item.on { background: #fef3e2; color: #f59e0b !important; font-weight: 700; }
.ie-tool-switcher-item i { width: 16px; text-align: center; color: #f59e0b; }

/* 모바일 햄버거 + 접이식 링크 */
.ie-nav-toggle {
  display: none; margin-left: auto; background: none; border: 1px solid #e2e6ec; border-radius: 8px;
  color: #334155; font-size: 16px; padding: 6px 10px; cursor: pointer; flex-shrink: 0;
}
.ie-nav-links { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
@media (max-width: 720px) {
  .ie-nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .ie-nav-links {
    display: none; position: absolute; top: 100%; right: 0; margin-top: 8px;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: #fff; border: 1px solid #e2e6ec; border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15,23,42,.14); padding: 6px; min-width: 180px; z-index: 60;
  }
  .ie-nav-links.open { display: flex; }
  .ie-nav-links a { padding: 10px 12px; border-radius: 8px; font-size: 13px !important; }
  .ie-nav-links a:hover { background: #f5f6f8; }
}

/* ── 페이지 ── */
.ie-page { max-width: 720px; margin: 0 auto; padding: 32px 16px 60px; }

.ie-header { margin-bottom: 20px; }
.ie-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700;
  color: #b45309; background: #fef3e2; border: 1px solid #fcd9a8;
  border-radius: 50px; padding: 5px 12px; margin-bottom: 12px;
}
.ie-header h1 { font-size: 24px; margin: 0 0 8px; font-weight: 900; letter-spacing: -.01em; }
.ie-header h1 i { color: #f59e0b; margin-right: 8px; }
.ie-sub { color: #64748b; font-size: 13px; margin: 0; line-height: 1.6; }

.ie-lib-warning {
  background: #fdecea; border: 1px solid #f5c2c0; color: #9c2b26;
  border-radius: 8px; padding: 12px 16px; font-size: 13px; margin: 16px 0;
}

.ie-ad-slot { text-align: center; padding: 14px 0; }

/* ── 업로드 영역 ── */
.ie-drop-zone {
  margin: 8px 0 20px; padding: 40px 20px; border: 2px dashed #d8b98a;
  border-radius: 14px; background: #fff; text-align: center; color: #667;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.ie-drop-zone:hover { border-color: #f0a94d; box-shadow: 0 8px 24px rgba(245,158,11,.08); }
.ie-drop-zone.drag-over { background: #fff8ee; border-color: #f59e0b; box-shadow: 0 8px 24px rgba(245,158,11,.18); }
.ie-drop-icon { font-size: 30px; color: #d8b98a; margin-bottom: 10px; transition: color .15s; }
.ie-drop-zone:hover .ie-drop-icon, .ie-drop-zone.drag-over .ie-drop-icon { color: #f59e0b; }
.ie-drop-zone p { margin: 0 0 12px; font-size: 14px; }
.ie-drop-hint { font-size: 12px !important; color: #94a3b8; margin: 8px 0 0 !important; }

.ie-file-btn {
  display: inline-block; padding: 8px 18px; background: #f59e0b; color: #fff;
  border-radius: 8px; font-size: 14px; cursor: pointer;
  box-shadow: 0 6px 18px rgba(245,158,11,.3); transition: transform .15s, box-shadow .15s;
}
.ie-file-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(245,158,11,.4); }

.ie-error {
  background: #fdecea; border: 1px solid #f5c2c0; color: #9c2b26;
  border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px;
}

/* ── 작업 영역 ── */
.ie-workspace {
  background: #fff; border: 1.5px solid #e2e8f0; border-radius: 16px;
  padding: 20px; box-shadow: 0 10px 30px rgba(15,23,42,.06);
  position: relative; overflow: hidden;
}
.ie-workspace::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #f59e0b, #fb923c, #fbbf24);
}

.ie-file-info { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.ie-preview-thumb {
  width: 64px; height: 64px; object-fit: cover; border-radius: 10px;
  border: 1px solid #e2e8f0; background: #f5f6f8; flex-shrink: 0;
}
.ie-file-meta { flex: 1; min-width: 160px; }
.ie-file-name { font-size: 14px; font-weight: 800; color: #1f2937; word-break: break-all; }
.ie-file-detail { font-size: 12px; color: #64748b; margin-top: 2px; }
.ie-history { margin-top: 6px; font-size: 11px; }
.ie-history-label { color: #94a3b8; margin-right: 6px; }
.ie-history-path { color: #f59e0b; font-weight: 700; }
.ie-reset-btn {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  color: #64748b; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 8px 14px; cursor: pointer; transition: all .15s; flex-shrink: 0;
}
.ie-reset-btn:hover { background: #f5f6f8; border-color: #94a3b8; color: #334155; }

/* 탭 */
.ie-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.ie-tab {
  flex: 1; padding: 11px; border-radius: 10px; border: 1px solid #e2e8f0;
  background: #f8fafc; color: #64748b; font-size: 13px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px; transition: all .15s;
}
.ie-tab:hover { border-color: #f0a94d; color: #334155; }
.ie-tab.is-active { background: #fef3e2; border-color: #f59e0b; color: #b45309; box-shadow: 0 0 0 3px rgba(245,158,11,.1); }

.ie-panel { display: none; }
.ie-panel.is-active { display: block; }

.ie-field-row { display: flex; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.ie-field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 120px; }
.ie-field-label { font-size: 12px; font-weight: 700; color: #334155; }
.ie-field-label b { color: #f59e0b; }
.ie-field input[type="number"] {
  border: 1.5px solid #e2e8f0; border-radius: 8px; padding: 9px 10px;
  font-size: 14px; color: #1f2937; background: #f8fafc; outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.ie-field input[type="number"]:focus { border-color: #f59e0b; background: #fff; box-shadow: 0 0 0 3px rgba(245,158,11,.12); }

.ie-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #334155; margin-bottom: 14px; cursor: pointer; }
.ie-check input { width: 15px; height: 15px; cursor: pointer; }

.ie-field-slider input[type="range"] { width: 100%; accent-color: #f59e0b; margin-top: 4px; }

.ie-current-format { font-size: 13px; color: #475569; margin-bottom: 12px; }
.ie-current-format b { color: #f59e0b; }

.ie-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ie-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 20px;
  border: 1.5px solid #e2e8f0; background: #fff; font-size: 13px; font-weight: 600; color: #64748b;
  cursor: pointer; user-select: none; transition: all .15s;
}
.ie-chip:hover { border-color: #f0a94d; color: #334155; }
.ie-chip:has(input:checked) { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.ie-chip input { width: 14px; height: 14px; cursor: pointer; }

.ie-webp-warning {
  background: #fdecea; border: 1px solid #f5c2c0; color: #9c2b26;
  border-radius: 8px; padding: 9px 12px; font-size: 12px; margin-bottom: 12px;
}

.ie-meta-status { font-size: 14px; font-weight: 700; color: #334155; margin-bottom: 8px; }
.ie-meta-status.has-meta { color: #b45309; }
.ie-meta-status.no-meta { color: #16a34a; }
.ie-meta-desc { font-size: 12px; color: #64748b; line-height: 1.6; margin: 0 0 14px; }

.ie-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid #e2e8f0; background: #fff;
  color: #334155; font-size: 13px; font-weight: 700; padding: 10px 18px; border-radius: 8px;
  cursor: pointer; transition: all .15s;
}
.ie-btn:hover { background: #f0f3f7; border-color: #aab4c2; }
.ie-btn:disabled { opacity: .5; cursor: not-allowed; }
.ie-btn-primary {
  background: linear-gradient(135deg, #f59e0b, #fb923c); border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px rgba(245,158,11,.3);
}
.ie-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(245,158,11,.4); background: linear-gradient(135deg, #f59e0b, #fb923c); }
.ie-btn-primary:active { transform: translateY(0); }

.ie-size-compare {
  margin-top: 14px; padding: 12px 14px; background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 8px; font-size: 12px; color: #475569; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.ie-size-compare .arrow { color: #94a3b8; }
.ie-size-compare .down { color: #16a34a; font-weight: 700; }
.ie-size-compare .up { color: #dc2626; font-weight: 700; }

/* 비교 슬라이더 */
.ie-compare-wrap { margin-top: 20px; }
.ie-compare-label { font-size: 12px; font-weight: 700; color: #64748b; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.ie-compare-slider {
  position: relative; width: 100%; aspect-ratio: 16 / 10; max-height: 360px;
  border-radius: 12px; overflow: hidden; border: 1px solid #e2e8f0; background: #111;
  user-select: none;
}
.ie-compare-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #111; }
.ie-compare-after-wrap { position: absolute; inset: 0; width: 50%; overflow: hidden; }
.ie-compare-after-wrap .ie-compare-img { width: var(--ie-compare-w, 100%); max-width: none; }
.ie-compare-handle {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; background: #fff;
  transform: translateX(-50%); pointer-events: none; box-shadow: 0 0 8px rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
}
.ie-compare-handle i {
  position: absolute; width: 30px; height: 30px; border-radius: 50%; background: #fff; color: #f59e0b;
  display: flex; align-items: center; justify-content: center; font-size: 12px; box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.ie-compare-range {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize;
  -webkit-appearance: none; appearance: none;
}

.ie-download-row { margin-top: 18px; text-align: center; }
.ie-btn-download {
  width: 100%; justify-content: center; padding: 13px 18px; font-size: 14px;
  background: linear-gradient(135deg, #0f2744, #1d4ed8); border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px rgba(29,78,216,.25);
}
.ie-btn-download:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(29,78,216,.35); background: linear-gradient(135deg, #0f2744, #1d4ed8); }

/* 다른 도구 추천 */
.ie-other-tools { margin: 24px 0; padding: 20px; background: #fff; border: 1px solid #e2e6ec; border-radius: 14px; }
.ie-other-tools-label { font-size: 12px; font-weight: 700; color: #667; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.ie-other-tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.ie-other-tool-card {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border: 1px solid #e2e6ec; border-radius: 10px; text-decoration: none; color: #334155;
  font-size: 13px; font-weight: 700; transition: all .15s;
}
.ie-other-tool-card:hover { border-color: #f59e0b; background: #fef3e2; transform: translateY(-2px); }
.ie-other-tool-card i { font-size: 16px; color: #f59e0b; }

.ie-footer { text-align: center; padding: 20px 0; color: #94a3b8; font-size: 12px; line-height: 1.7; }

@media (max-width: 480px) {
  .ie-field-row { flex-direction: column; gap: 10px; }
  .ie-tabs { flex-wrap: wrap; }
  .ie-tab { min-width: 45%; }
}
