/* ================================================================
   MYCFO — Command Palette  (v0.1.3)
   Ctrl+K  /  헤더 검색 버튼으로 열리는 전역 커맨드 팔레트
   ================================================================ */

/* ── Backdrop ─────────────────────────────────────────────── */
.cmd-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 9000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  animation: cmd-fade-in 0.12s ease;
}
.cmd-backdrop.open {
  display: flex;
}
@keyframes cmd-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Dialog box ───────────────────────────────────────────── */
.cmd-dialog {
  width: 100%;
  max-width: 580px;
  margin: 0 1rem;
  background: #fff;
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.06),
    0 8px 40px rgba(0,0,0,0.18),
    0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
  animation: cmd-slide-in 0.14s ease;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
}
@keyframes cmd-slide-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)     scale(1); }
}

/* ── Search input row ─────────────────────────────────────── */
.cmd-search-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.cmd-search-icon {
  color: #94a3b8;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.cmd-search-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}
.cmd-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  font-weight: 400;
  color: #1e293b;
  background: transparent;
  font-family: inherit;
  min-width: 0;
}
.cmd-input::placeholder {
  color: #94a3b8;
}
.cmd-kbd-hint {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.cmd-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  min-width: 22px;
  height: 20px;
  line-height: 1;
  font-family: inherit;
}

/* ── Results area ─────────────────────────────────────────── */
.cmd-results {
  overflow-y: auto;
  flex: 1;
  padding: 0.375rem 0;
  min-height: 0;
}
.cmd-results::-webkit-scrollbar { width: 4px; }
.cmd-results::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

/* ── Section label ────────────────────────────────────────── */
.cmd-section-label {
  padding: 0.5rem 1rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1;
}

/* ── Result item ──────────────────────────────────────────── */
.cmd-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.08s;
  text-decoration: none;
  color: inherit;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.cmd-item:hover,
.cmd-item.active {
  background: #f1f5f9;
}
.cmd-item.active {
  background: #eff6ff;
}

/* ── Item icon ────────────────────────────────────────────── */
.cmd-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: background 0.08s;
}
.cmd-item.active .cmd-item-icon {
  background: #dbeafe;
  border-color: #bfdbfe;
}

/* Icon color variants */
.cmd-item-icon.blue   { background: #eff6ff; border-color: #bfdbfe; }
.cmd-item-icon.green  { background: #f0fdf4; border-color: #bbf7d0; }
.cmd-item-icon.orange { background: #fff7ed; border-color: #fed7aa; }
.cmd-item-icon.purple { background: #faf5ff; border-color: #e9d5ff; }
.cmd-item-icon.red    { background: #fef2f2; border-color: #fecaca; }
.cmd-item-icon.teal   { background: #f0fdfa; border-color: #99f6e4; }
.cmd-item-icon.slate  { background: #f8fafc; border-color: #e2e8f0; }

/* ── Item body ────────────────────────────────────────────── */
.cmd-item-body {
  flex: 1;
  min-width: 0;
}
.cmd-item-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.cmd-item-sub {
  font-size: 0.73rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.1rem;
  line-height: 1.3;
}

/* ── Item right side ──────────────────────────────────────── */
.cmd-item-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.cmd-item-path {
  font-size: 0.68rem;
  color: #94a3b8;
  font-family: 'SFMono-Regular', 'Consolas', monospace;
  background: #f8fafc;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}
.cmd-item-enter-icon {
  color: #94a3b8;
  opacity: 0;
  transition: opacity 0.08s;
}
.cmd-item:hover .cmd-item-enter-icon,
.cmd-item.active .cmd-item-enter-icon {
  opacity: 1;
}

/* ── Divider ──────────────────────────────────────────────── */
.cmd-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 0.375rem 0;
}

/* ── Empty state ──────────────────────────────────────────── */
.cmd-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: #94a3b8;
}
.cmd-empty-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}
.cmd-empty-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
}
.cmd-empty-sub {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

/* ── Footer hint bar ──────────────────────────────────────── */
.cmd-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  border-top: 1px solid #f1f5f9;
  background: #fafafa;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.cmd-footer-hint {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  color: #94a3b8;
}
.cmd-footer-sep {
  width: 1px;
  height: 14px;
  background: #e2e8f0;
}
.cmd-footer-label {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-left: auto;
}

/* ── Match highlight ──────────────────────────────────────── */
.cmd-highlight {
  color: #2563eb;
  font-weight: 700;
  background: #dbeafe;
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Category tag ─────────────────────────────────────────── */
.cmd-category-tag {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  white-space: nowrap;
}
.cmd-category-tag.nav    { background: #dbeafe; color: #1e40af; }
.cmd-category-tag.action { background: #dcfce7; color: #166534; }
.cmd-category-tag.recent { background: #f3f4f6; color: #4b5563; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .cmd-backdrop {
    padding-top: 0;
    align-items: flex-end;
  }
  .cmd-dialog {
    margin: 0;
    border-radius: 16px 16px 0 0;
    max-height: 80vh;
    animation: cmd-slide-up 0.16s ease;
  }
  @keyframes cmd-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }
  .cmd-kbd-hint { display: none; }
  .cmd-footer   { display: none; }
}
