/* 관제 화면 공용 단추 겉모습 — Lucian UX/UI Prompt 를 옮김
 * MIT License (c) 2026 Seokwoooo · https://lucianlabs.dev/uxui-prompt/
 *
 * 모든 관제 화면이 자기 <style> 뒤에 이 파일을 건다(/assets/lucian.css).
 * 여기에는 <겉모습>만 둔다 — 높이 · 안쪽 여백 · 폭은 화면마다 다르므로 각 화면의 규칙이 정한다.
 * 색은 화면마다 정의된 변수(--accent-btn · --accent-hover · --accent-on …)를 쓴다.
 * 바탕을 칠하는 것은 주 단추뿐이다 — 보조 · 위험 단추의 바탕은 각 화면이 정한다
 *   (위험 단추의 「한 번 더 누르면 지움」 바탕을 덮지 않으려고).
 * 글자 대비: 주 단추 그러데이션은 --accent-btn 에서 더 어두운 쪽으로만 간다(흰 글자 4.9:1 이상).
 */

/* ---------- 공용 단추 ---------- */
.btn {
  gap: 8px;
  font-weight: 700;
  letter-spacing: -.01em;
  position: relative;
  transition: transform .35s cubic-bezier(.34, 1.45, .64, 1), box-shadow .3s cubic-bezier(.2, .8, .2, 1), background-color .2s ease, border-color .2s ease, color .2s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn:active:not(:disabled) {
  transform: scale(.97);
}

.btn:disabled {
  box-shadow: none;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-btn) 0%, var(--accent-hover) 100%);
  color: var(--accent-on);
  box-shadow: 0 12px 24px -14px rgba(76, 56, 200, .7), inset 0 1px 0 rgba(255, 255, 255, .18);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-hover) 0%, #4C3DBF 100%);
  transform: translateY(-2px);
  box-shadow: 0 18px 30px -16px rgba(76, 56, 200, .75), inset 0 1px 0 rgba(255, 255, 255, .18);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0) scale(.97);
  box-shadow: 0 8px 16px -12px rgba(76, 56, 200, .6), inset 0 1px 0 rgba(255, 255, 255, .18);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-1px);
}

@media (prefers-color-scheme: dark) {
  /* 어두운 모드의 --accent-btn 은 연보라다 — 더 밝은 쪽(--accent-hover)으로 간다. 글자는 거의 검정 */
  .btn-primary {
    background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent-btn) 100%);
    box-shadow: 0 12px 24px -14px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .25);
  }

  .btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #DCD3FF 0%, var(--accent-hover) 100%);
    box-shadow: 0 18px 30px -16px rgba(0, 0, 0, .85), inset 0 1px 0 rgba(255, 255, 255, .25);
  }

  .btn-primary:active:not(:disabled) {
    box-shadow: 0 8px 16px -12px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .25);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
  }

  .btn:active:not(:disabled),
  .btn-primary:hover:not(:disabled),
  .btn-primary:active:not(:disabled),
  .btn-secondary:hover:not(:disabled),
  .btn-danger:hover:not(:disabled) {
    transform: none;
  }
}

@media print {
  .btn {
    box-shadow: none;
  }
}

/* ---------- 진행률 다운로드 단추 — Lucian UX/UI Prompt #004 을 옮김 · MIT License (c) 2026 Seokwoooo · https://lucianlabs.dev/uxui-prompt/#004 ---------- */
/* 마크업: <a class="ldl" href="…" download data-size="2.7 MB">내려받기</a> — 안은 /assets/lucian.js 가 채운다.
 * 스크립트가 없으면 그냥 링크로 받아진다. */
.ldl {
  --p: 0;
  position: relative;
  display: inline-flex;
  width: min(100%, 320px);
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  vertical-align: middle;
  box-shadow: 0 22px 36px -22px rgba(40, 30, 80, .55);
  transition: width .6s cubic-bezier(.2, .8, .2, 1), transform .5s cubic-bezier(.34, 1.45, .64, 1), background-color .5s cubic-bezier(.2, .8, .2, 1);
  font-family: inherit;
}

.ldl:hover {
  transform: translateY(-2px);
}

.ldl:active {
  transform: scale(.97);
}

.ldl:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.ldl-sm {
  height: 52px;
  width: min(100%, 300px);
}

.ldl-idle,
.ldl-run,
.ldl-ok {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  transition: opacity .35s cubic-bezier(.2, .8, .2, 1), transform .5s cubic-bezier(.2, .8, .2, 1);
}

.ldl-idle {
  gap: 12px;
  padding: 0 22px 0 8px;
}

.ldl-arw {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--bg) 16%, transparent);
  overflow: hidden;
}

.ldl-sm .ldl-arw {
  width: 38px;
  height: 38px;
}

.ldl-arw svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ldl-a {
  transition: transform .5s cubic-bezier(.2, .8, .2, 1);
}

.ldl:hover .ldl-a {
  animation: ldl-bob 1s cubic-bezier(.2, .8, .2, 1) infinite;
}

@keyframes ldl-bob {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(3px);
  }
}

.ldl-idle b {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.ldl-sm .ldl-idle b {
  font-size: 15px;
}

.ldl-idle small {
  margin-left: auto;
  padding-left: 8px;
  font-size: 13px;
  font-weight: 600;
  opacity: .7;
  white-space: nowrap;
}

/* 받는 동안의 바탕 — 두 모드 모두 어둡게 둔다(그 위의 흰 글자가 어두운 모드에서도 보이게) */
.ldl-track {
  position: absolute;
  inset: 0;
  background: #26243A;
  opacity: 0;
  transition: opacity .4s cubic-bezier(.2, .8, .2, 1);
}

.ldl-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  background: linear-gradient(90deg, #7B61FF, #6A57F2 55%, #5D4DD5);
  transform-origin: 0 50%;
  transform: scaleX(var(--p));
  border-radius: inherit;
  transition: transform .2s linear;
}

.ldl-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
  background-size: 220% 100%;
  animation: ldl-shine 1.3s linear infinite;
}

@keyframes ldl-shine {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -100% 0;
  }
}

.ldl-run {
  justify-content: space-between;
  gap: 12px;
  padding: 0 24px;
  opacity: 0;
  transform: translateY(12px);
  color: #fff;
}

.ldl-run b {
  font-size: 19px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ldl-run small {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.ldl-ok {
  justify-content: center;
  gap: 10px;
  opacity: 0;
  transform: scale(.6);
  color: #fff;
}

.ldl-ok i {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .2);
}

.ldl-ok svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ldl-ok path {
  stroke-dasharray: 18;
  stroke-dashoffset: 18;
  transition: stroke-dashoffset .45s cubic-bezier(.2, .8, .2, 1) .25s;
}

.ldl-ok span {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-width .6s cubic-bezier(.2, .8, .2, 1), opacity .4s cubic-bezier(.2, .8, .2, 1);
}

.ldl[data-state="run"] .ldl-idle {
  opacity: 0;
  transform: translateY(-12px);
}

.ldl[data-state="run"] .ldl-a {
  transform: translateY(26px);
}

.ldl[data-state="run"] .ldl-track {
  opacity: 1;
}

.ldl[data-state="run"] .ldl-run {
  opacity: 1;
  transform: none;
}

.ldl[data-state="fold"] .ldl-idle {
  opacity: 0;
}

.ldl[data-state="fold"] {
  width: 60px;
  background: #0E7F5D;
}

.ldl.ldl-sm[data-state="fold"] {
  width: 52px;
}

.ldl[data-state="fold"] .ldl-bar {
  opacity: 0;
}

.ldl[data-state="fold"] .ldl-ok {
  opacity: 1;
  transform: none;
}

.ldl[data-state="fold"] .ldl-ok path {
  stroke-dashoffset: 0;
}

.ldl[data-state="done"] .ldl-idle {
  opacity: 0;
}

/* 초록은 흰 글자가 4.5:1 을 넘는 #0E7F5D(원본 #119C72 는 3.4:1) */
.ldl[data-state="done"] {
  background: #0E7F5D;
  transition-timing-function: cubic-bezier(.34, 1.45, .64, 1);
}

.ldl[data-state="done"] .ldl-ok {
  opacity: 1;
  transform: none;
}

.ldl[data-state="done"] .ldl-ok path {
  stroke-dashoffset: 0;
}

.ldl[data-state="done"] .ldl-ok span {
  max-width: 200px;
  opacity: 1;
}

.ldl[data-unknown="1"] .ldl-bar {
  transform: none;
}

.ldl-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
  .ldl {
    box-shadow: 0 22px 36px -22px rgba(0, 0, 0, .8);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ldl,
  .ldl-idle,
  .ldl-run,
  .ldl-ok,
  .ldl-bar,
  .ldl-a,
  .ldl-ok path,
  .ldl-ok span {
    transition: none;
  }

  .ldl:hover .ldl-a,
  .ldl-bar::after {
    animation: none;
  }

  .ldl:hover,
  .ldl:active {
    transform: none;
  }
}

@media print {
  .ldl {
    box-shadow: none;
  }
}
