/* ============================================================
   pdf.css — TimeSave PDF Tools 공통 스타일
   ============================================================ */

:root {
  --bg-base:        #f8f9fb;
  --bg-surface:     #ffffff;
  --accent:         #2563EB;
  --accent-dim:     rgba(37, 99, 235, 0.08);
  --green:          #22C55E;
  --green-dim:      rgba(34, 197, 94, 0.08);
  --err-color:      #ef4444;
  --text-primary:   #111218;
  --text-secondary: #55556a;
  --text-muted:     #9898b0;
  --border:         rgba(0, 0, 0, 0.08);
  --border-hover:   rgba(0, 0, 0, 0.16);
  --radius:         14px;
  --radius-sm:      9px;
  --font-body:      'DM Sans', system-ui, sans-serif;
  --font-mono:      'Space Mono', monospace;
}

.hidden { display: none !important; }
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  min-height: 100vh;
}


/* ═══════════════════════════════════════════
   MAIN LAYOUT
═══════════════════════════════════════════ */
main {
  padding: 48px 24px 72px;
  display: flex; justify-content: center;
}

/* ═══════════════════════════════════════════
   TOOL CARD
═══════════════════════════════════════════ */
.tool-card {
  width: 100%; max-width: 860px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 6px 36px rgba(0, 0, 0, 0.06);
  display: flex; flex-direction: column; gap: 28px;
}

/* ═══════════════════════════════════════════
   TOOL HEADER
═══════════════════════════════════════════ */
.tool-header { display: flex; align-items: flex-start; gap: 18px; }
.tool-icon {
  width: 54px; height: 54px; border-radius: 14px;
  background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; flex-shrink: 0;
}
.tool-kicker {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent); background: var(--accent-dim);
  border-radius: 4px; padding: 2px 8px;
  display: inline-block; margin-bottom: 7px;
}
.tool-title { font-size: 22px; font-weight: 800; margin-bottom: 5px; letter-spacing: -0.01em; }
.tool-desc  { font-size: 14px; color: var(--text-secondary); line-height: 1.65; }

/* ═══════════════════════════════════════════
   DROPZONE
═══════════════════════════════════════════ */
.dropzone {
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius);
  background: var(--bg-base);
  padding: 40px 28px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
}
.dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.dropzone input[type="file"] { display: none; }
.drop-icon {
  width: 58px; height: 58px; border-radius: 14px;
  background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); flex-shrink: 0;
}
.drop-title { font-size: 16px; font-weight: 700; }
.drop-hint  { font-size: 13px; color: var(--text-muted); line-height: 1.6; max-width: 360px; }
.btn-pick {
  background: var(--accent);
  border: none; border-radius: 8px;
  color: #fff; font-family: var(--font-body);
  font-size: 14px; font-weight: 600;
  padding: 10px 22px; cursor: pointer;
  transition: filter 0.15s;
  margin-top: 4px;
}
.btn-pick:hover { filter: brightness(1.1); }
.btn-pick.secondary {
  background: transparent;
  border: 1px solid var(--border-hover);
  color: var(--text-secondary);
}
.btn-pick.secondary:hover { border-color: var(--accent); color: var(--accent); filter: none; }

/* ═══════════════════════════════════════════
   FILE LIST
═══════════════════════════════════════════ */
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-list-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.file-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px; font-size: 14px;
}
.file-item-icon { color: var(--accent); flex-shrink: 0; }
.file-item-name {
  flex: 1; font-weight: 500; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-item-size {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-muted); flex-shrink: 0;
}
.file-item-remove {
  width: 26px; height: 26px; border-radius: 50%;
  border: none; background: transparent;
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s; flex-shrink: 0;
}
.file-item-remove:hover { background: rgba(239,68,68,0.1); color: #ef4444; }

.page-count-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-dim);
  border: 1px solid rgba(37,99,235,0.2);
  border-radius: 6px; padding: 5px 12px;
  font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--accent);
}

/* ═══════════════════════════════════════════
   OPTIONS
═══════════════════════════════════════════ */
.options-section { display: flex; flex-direction: column; gap: 18px; }
.field-group { display: flex; flex-direction: column; gap: 8px; }
.field-label {
  font-size: 12px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.07em;
}

.form-input, .form-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: var(--font-body); font-size: 15px;
  color: var(--text-primary); background: var(--bg-base);
  outline: none; width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-input::placeholder { color: var(--text-muted); }
.form-select { cursor: pointer; width: auto; }

.form-hint {
  font-size: 12px; color: var(--text-muted); line-height: 1.6;
  margin-top: -2px;
}

/* Segmented control */
.seg-control {
  display: flex; gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
  background: var(--bg-base); width: fit-content;
}
.seg-btn {
  flex: 1; padding: 9px 20px;
  border: none; background: transparent;
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn.active { background: var(--accent); color: #fff; font-weight: 700; }

/* Rotation angle buttons */
.rotate-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.rotate-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 24px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-base); cursor: pointer;
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  color: var(--text-secondary);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  flex: 1; min-width: 90px;
}
.rotate-btn:hover { border-color: var(--accent); color: var(--accent); }
.rotate-btn.active {
  border-color: var(--accent); background: var(--accent-dim);
  color: var(--accent);
}
.rotate-btn svg { transition: transform 0.3s; }

/* ═══════════════════════════════════════════
   THUMBNAIL GRID
═══════════════════════════════════════════ */
.thumb-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  column-gap: 10px;
  row-gap: 32px;
  max-height: 400px; overflow-y: auto;
  padding: 32px 4px 4px;
}
.thumb-item {
  border: 2px solid var(--border);
  border-radius: 8px; overflow: hidden;
  background: var(--bg-surface); cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}
.thumb-item:hover  { border-color: var(--border-hover); }
.thumb-item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
.thumb-item canvas { width: 100%; display: block; }
.thumb-check {
  position: absolute; top: 5px; right: 5px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; opacity: 0; transition: opacity 0.15s;
}
.thumb-item.selected .thumb-check { opacity: 1; }
.thumb-num {
  text-align: center;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-muted); padding: 4px;
  background: var(--bg-base); border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════
   PROGRESS
═══════════════════════════════════════════ */
.progress-section { display: flex; flex-direction: column; gap: 10px; }
.progress-track {
  height: 10px; background: rgba(0,0,0,0.06);
  border-radius: 6px; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #22C55E, #2563EB);
  border-radius: 6px; transition: width 0.25s ease;
}
@keyframes progress-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}
.progress-fill.pulsing { animation: progress-pulse 1.2s ease infinite; width: 100%; }
.progress-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-mono); font-size: 13px; color: var(--text-muted);
}
.progress-pct { color: var(--text-primary); font-weight: 700; }

/* ═══════════════════════════════════════════
   STATUS TEXT
═══════════════════════════════════════════ */
.status-text {
  font-size: 14px; color: var(--text-secondary);
  text-align: center; line-height: 1.5; min-height: 20px;
}
.status-text.error   { color: var(--err-color); }
.status-text.success { color: #16a34a; }

/* ═══════════════════════════════════════════
   ACTION BUTTON
═══════════════════════════════════════════ */
.btn-action {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 18px 28px;
  border: none; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 18px; font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn-action:hover:not(:disabled)  { filter: brightness(1.08); transform: translateY(-1px); }
.btn-action:active:not(:disabled) { transform: scale(0.99); filter: none; }
.btn-action:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary-action {
  background: linear-gradient(135deg, #22C55E, #2563EB);
  color: #fff;
  box-shadow: 0 3px 18px rgba(37, 99, 235, 0.22);
}
.btn-primary-action.done {
  background: #22C55E;
  box-shadow: 0 3px 18px rgba(34, 197, 94, 0.25);
}

/* ═══════════════════════════════════════════
   TOAST
═══════════════════════════════════════════ */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(14px);
  background: #1a1a2e; color: #fff;
  font-size: 15px; padding: 12px 24px;
  border-radius: 24px; opacity: 0;
  transition: all 0.25s; pointer-events: none; z-index: 999;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ═══════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 48px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--text-muted);
  flex-wrap: wrap; gap: 12px;
}
.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--text-secondary); }
.footer-links { display: flex; gap: 20px; }

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 900px) {
main { padding: 28px 16px 56px; }
  .tool-card { padding: 24px 20px; }
  .site-footer { padding: 20px; }
}
@media (max-width: 480px) {
.tool-header { flex-direction: column; gap: 12px; }
  .rotate-btns { gap: 8px; }
  .seg-btn { padding: 9px 14px; }
}
