/* 기본: 다크 테마 */
:root {
  --bg-base: #050609;
  --bg: radial-gradient(
    circle at top,
    #20253a 0,
    #0b0d12 45%,
    #050609 100%
  );
  --app-bg: rgba(10, 12, 20, 0.9);
  --panel-bg: rgba(9, 11, 18, 0.9);
  --muted-bg: rgba(255, 255, 255, 0.03);
  --chip-bg: rgba(255, 255, 255, 0.05);
  --chip-bg-hover: rgba(255, 255, 255, 0.12);
  --input-bg: rgba(5, 7, 12, 0.9);
  --border: rgba(255, 255, 255, 0.08);
  --text-main: #e6e9f5;
  --text-sub: #a0a4b8;
  --accent: #7d8bff;
  --accent-hover: #9aa6ff;
  --accent-soft: rgba(125, 139, 255, 0.35);
  --danger: #ff6b81;
  --pill-bg: rgba(10, 16, 30, 0.9);
  --badge-bg: rgba(79, 140, 255, 0.12);
  --badge-border: rgba(79, 140, 255, 0.35);
  --btn-shadow: 0 12px 28px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  --btn-shadow-hover: 0 15px 36px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  --btn-shadow-active: 0 8px 18px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.03);
}

/* 라이트 테마 */
:root.light {
  --bg-base: #f5f5f8;
  --bg: radial-gradient(
    circle at top,
    #ffffff 0,
    #f5f5f8 55%,
    #e0e4f2 100%
  );
  --app-bg: #ffffff;
  --panel-bg: #f7f7ff;
  --muted-bg: rgba(0, 0, 0, 0.03);
  --chip-bg: rgba(0, 0, 0, 0.06);
  --chip-bg-hover: rgba(0, 0, 0, 0.12);
  --input-bg: #ffffff;
  --border: rgba(0, 0, 0, 0.12);
  --text-main: #1c1f28;
  --text-sub: #55596b;
  --accent: #4a5cff;
  --accent-hover: #6a78ff;
  --accent-soft: rgba(74, 92, 255, 0.35);
  --danger: #d93025;
  --pill-bg: rgba(255, 255, 255, 0.92);
  --badge-bg: rgba(74, 92, 255, 0.14);
  --badge-border: rgba(74, 92, 255, 0.3);
  --btn-shadow: 0 10px 22px rgba(76, 97, 136, 0.2),
    0 0 0 1px rgba(74, 92, 255, 0.15);
  --btn-shadow-hover: 0 14px 30px rgba(76, 97, 136, 0.24),
    0 0 0 1px rgba(74, 92, 255, 0.2);
  --btn-shadow-active: 0 6px 14px rgba(76, 97, 136, 0.2),
    0 0 0 1px rgba(74, 92, 255, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background-color: var(--bg-base);
  background-image: var(--bg);
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
  color: var(--text-main);
  margin: 0;
  padding: 32px;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.app {
  width: 100%;
  max-width: 860px;
  background: var(--app-bg);
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.02);
  padding: 30px 28px 26px;
  backdrop-filter: blur(18px);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.title-block h1 {
  font-size: 26px;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent-soft);
  background: var(--pill-bg);
  color: var(--accent);
}

.title-block p {
  margin: 0;
  font-size: 15px;
  color: var(--text-sub);
}

.badge-me {
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--accent);
  border: 1px solid var(--badge-border);
  white-space: nowrap;
}

.section {
  background: var(--panel-bg);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 18px 20px 16px;
  margin-bottom: 16px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  /* 제목도 클릭할 수 있게 커서 변경 */
  cursor: pointer; 
  transition: color 0.12s ease;
}

.section-title:hover {
  /* 제목에 마우스 올리면 색상 변경 */
  color: var(--accent); 
}

.section-title span.icon {
  font-size: 20px;
}

.hint {
  font-size: 13px;
  color: var(--text-sub);
}

.file-input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

input[type="file"] {
  font-size: 14px;
  color: var(--text-sub);
}

.small-text {
  font-size: 13px;
  color: var(--text-sub);
  margin: 0;
}

.list-container {
  margin-top: 8px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: var(--panel-bg);
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px 8px;
  font-size: 13px;
  color: var(--text-sub);
  border-bottom: 1px solid var(--border);
}

.list-header span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

ul#fileList {
  list-style: none;
  margin: 0;
  padding: 0;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 14px;
  cursor: grab;
  user-select: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease, transform 0.08s ease, box-shadow 0.1s ease;
}

.file-item:last-child {
  border-bottom: none;
}

.file-item:hover {
  background: var(--muted-bg);
}

.file-item.dragging {
  opacity: 0.7;
  background: rgba(79, 140, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(79, 140, 255, 0.45);
  transform: scale(1.01);
  cursor: grabbing;
}

.file-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.file-index {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-sub);
  flex-shrink: 0;
}

.file-icon {
  width: 24px;
  height: 28px;
  border-radius: 5px;
  background: linear-gradient(135deg, #ff9a5c, #ff5f6d);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  flex-shrink: 0;
}

.file-name {
  font-size: 15px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  max-width: none;
  word-break: break-all;
}

.file-sub {
  font-size: 13px;
  color: var(--text-sub);
  margin-left: 6px;
}

.file-meta {
  font-size: 13px;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dot-sep {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
}

.drag-hint {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.35);
}

.actions-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
}

.top-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bottom-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  margin-right: 10px;
}

.right-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 10px;
}

.left-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 10px;
}

button {
  font-family: inherit;
}

.btn-primary {
  padding: 10px 24px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  background: linear-gradient(135deg, #4f8cff, #7b5cff);
  color: #fff;
  box-shadow: var(--btn-shadow);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.08s ease, box-shadow 0.12s ease, filter 0.12s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: var(--btn-shadow-hover);
}

.btn-primary:active {
  transform: translateY(0);
  filter: brightness(0.98);
  box-shadow: var(--btn-shadow-active);
}

.btn-ghost,
.btn-primary {
  white-space: nowrap;
  flex-shrink: 0;
}

#fileCountText {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--text-sub);
  white-space: nowrap;
}

.btn-ghost {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--muted-bg);
  color: var(--text-sub);
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn-ghost:hover {
  background: var(--chip-bg-hover);
  border-color: var(--accent);
  color: var(--text-main);
}

.status {
  margin-top: 16px;
  font-size: 13px;
  min-height: 20px;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: pre-line;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  display: none;
}

.status.loading .status-dot {
  display: inline-block;
  animation: pulse 0.8s ease-in-out infinite alternate;
}

.status.error {
  color: var(--danger);
}

@keyframes pulse {
  from {
    transform: scale(0.9);
    opacity: 0.65;
  }
  to {
    transform: scale(1.1);
    opacity: 1;
  }
}

@media (max-width: 540px) {
  .file-name {
    max-width: 160px;
  }
  .app {
    padding: 20px 16px 16px;
  }
}

/* --- 드래그 앤 드롭 박스 --- */
.drop-zone {
  padding: 20px;
  border-radius: 14px;
  border: 1px dashed var(--border);
  background: var(--panel-bg);
  transition: border-color 0.15s ease, background 0.15s ease,
    box-shadow 0.15s ease, transform 0.12s ease;
  /* 박스 전체에 손가락 커서 표시 (핵심) */
  cursor: pointer; 
}

/* 파일이 없을 때: 고정 높이 + 중앙 정렬 */
.drop-zone.empty {
  height: 160px;
}

/* 파일이 있을 때: 내용만큼 자동으로 늘어나게 */
.drop-zone:not(.empty) {
  height: auto;
}

/* 마우스 올렸을 때 효과 강화 */
.drop-zone:hover {
  border-color: var(--accent); /* 테두리 색상을 강조색으로 */
  background: var(--muted-bg); /* 배경 살짝 밝게 */
  box-shadow: 0 0 0 1px var(--accent-soft),
    0 0 22px rgba(79, 140, 255, 0.15);
  transform: translateY(-1px);
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.12);
  box-shadow: 0 0 0 1px rgba(79, 140, 255, 0.55),
    0 0 28px rgba(79, 140, 255, 0.4);
  transform: translateY(-1px);
}

.drop-zone-content {
  display: none;
}

/* 파일이 없을 때만 아이콘+문구 보이도록 */
.drop-zone.empty .drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  height: 100%;
  pointer-events: none; /* 드롭 이벤트에 방해 안 되게 */
}

.drop-zone-icon {
  font-size: 32px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(79, 140, 255, 0.16);
  box-shadow: 0 0 0 1px rgba(79, 140, 255, 0.35);
  animation: float-icon 1.6s ease-in-out infinite alternate;
}

.drop-zone-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drop-zone-text {
  font-size: 15px;
  color: var(--text-main);
}

.drop-zone-text b,
.drop-zone-sub b {
  font-weight: 600;
  color: var(--accent); /* 강조색 적용 */
  text-decoration: underline; /* 밑줄 추가 */
  text-underline-offset: 3px;
}

.drop-zone-text b {
  font-weight: 600;
  animation: pulse-text 1.7s ease-in-out infinite alternate;
}

.drop-zone-sub {
  font-size: 13px;
  color: var(--text-sub);
}

@keyframes float-icon {
  from {
    transform: translateY(0px);
    opacity: 0.9;
  }
  to {
    transform: translateY(-3px);
    opacity: 1;
  }
}

@keyframes pulse-text {
  from {
    opacity: 0.7;
  }
  to {
    opacity: 1;
  }
}

.drop-zone ul {
  margin-top: 4px;
}

.file-item.blank {
  opacity: 0.85;
  background: rgba(255, 255, 255, 0.01);
  font-style: italic;
}

.file-icon.blank {
  background: linear-gradient(135deg, #999, #555);
}

.file-name.blank {
  color: #e0e0e0;
}

.delete-btn {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  margin-left: 6px;
  line-height: 1;
  border-radius: 999px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, color 0.12s ease;
}

.delete-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ff7b94;
}

.delete-btn:active {
  background: rgba(255, 255, 255, 0.12);
}

.output-row {
  margin-top: 16px;
  margin-bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  font-size: 13px;
  color: var(--text-sub);
}

.output-label {
  font-size: 13px;
  white-space: nowrap;
}

.output-input {
  flex: 1 1 200px;
  min-width: 160px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
}

.output-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(79, 140, 255, 0.35);
}

.output-hint {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 4px;
}

.summary-bar {
  margin-top: 16px;
  margin-bottom: 6px;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  color: var(--text-sub);
}

.drop-marker {
  height: 0;
  border-top: 2px solid var(--accent);
  margin: 4px 0;
  pointer-events: none;
}

.reverse-pages-btn {
  border: none;
  background: var(--muted-bg);
  color: var(--text-sub);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  margin-left: 8px;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.reverse-pages-btn:hover {
  background: var(--chip-bg-hover);
  color: var(--text-main);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.page-range-btn {
  border: none;
  background: var(--muted-bg);
  color: var(--text-sub);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  margin-left: 8px;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.page-range-btn:hover {
  background: var(--chip-bg-hover);
  color: var(--text-main);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.split-btn {
  border: none;
  background: var(--chip-bg);
  color: var(--accent);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  margin-left: 8px;
  white-space: nowrap;
  box-shadow: 0 0 0 1px var(--accent-soft);
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease,
    transform 0.12s ease;
}

.split-btn:hover {
  background: var(--chip-bg-hover);
  color: var(--text-main);
  box-shadow: 0 0 0 1px var(--accent);
}

.split-btn:active {
  transform: translateY(1px);
}
