/* ════════════════════════════════════════════════
   Liquid Glass tokens  (iOS-style) — ax-hub 디자인 이식
   ════════════════════════════════════════════════ */
:root {
  --bg: #eef0f5;

  /* Glass fills */
  --glass: rgba(255, 255, 255, 0.68);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-thin: rgba(255, 255, 255, 0.4);
  --surface: rgba(255, 255, 255, 0.68);
  --surface-solid: #ffffff;
  --surface-hover: rgba(120, 120, 128, 0.1);
  --surface-2: rgba(120, 120, 128, 0.08);

  /* Glass edges */
  --glass-edge: rgba(255, 255, 255, 0.65);
  --glass-edge-top: rgba(255, 255, 255, 0.85);
  --border: rgba(255, 255, 255, 0.5);
  --border-strong: rgba(120, 120, 128, 0.26);
  --hairline: rgba(60, 60, 67, 0.12);

  /* Accent — iOS blue */
  --primary: #007aff;
  --primary-hover: #0a6fe0;
  --primary-pressed: #0860c4;
  --primary-light: rgba(0, 122, 255, 0.12);
  --primary-light-2: rgba(0, 122, 255, 0.22);

  /* Text */
  --text: #15151a;
  --text-secondary: rgba(40, 40, 48, 0.78);
  --text-muted: rgba(50, 50, 58, 0.58);

  /* Signal */
  --success: #34c759;
  --success-light: rgba(52, 199, 89, 0.14);
  --warning: #ff9f0a;
  --warning-light: rgba(255, 159, 10, 0.16);
  --danger: #ff3b30;
  --danger-hover: #e0322a;
  --danger-light: rgba(255, 59, 48, 0.12);

  /* Geometry */
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 22px;

  /* Shadows */
  --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-8: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-16: 0 12px 36px rgba(0, 0, 0, 0.14);
  --shadow-64: 0 24px 70px rgba(0, 0, 0, 0.24);

  --glass-inset: inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display',
    'Segoe UI', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}
::selection { background: var(--primary-light-2); }
a { color: var(--primary); text-decoration: none; }

/* ── Glass materials ── */
.acrylic,
.glass {
  background: var(--glass-strong);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
}
.card-surface {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow-8), var(--glass-inset);
}

/* ════════════════════════════════════════════════
   Header
   ════════════════════════════════════════════════ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 56px;
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
}
.brand .logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.header-right { display: flex; align-items: center; gap: 10px; }
.nav { display: flex; gap: 4px; }
.nav-link {
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s;
  white-space: nowrap;
}
.nav-link:hover { background: var(--surface-2); }
.nav-link.active { background: var(--primary-light); color: var(--primary); }

/* Search field */
.search-wrap { position: relative; }
.search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 220px;
  padding: 7px 12px 7px 32px;
  font-size: 13.5px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: all 0.18s;
}
.search-input:focus {
  background: var(--surface-solid);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

/* ════════════════════════════════════════════════
   Layout
   ════════════════════════════════════════════════ */
main {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-head h1 { font-size: 22px; font-weight: 700; margin: 0; }
.page-head .sub { font-size: 13.5px; margin-top: 2px; color: var(--text-secondary); }
.count { font-size: 13.5px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.chips { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.muted { color: var(--text-muted); }
.mono { font-family: 'SF Mono', 'Fira Mono', ui-monospace, monospace; }

/* ════════════════════════════════════════════════
   Project card
   ════════════════════════════════════════════════ */
.project-card {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-2), var(--glass-inset);
  transition: box-shadow 0.4s cubic-bezier(0.2, 0.9, 0.25, 1),
    transform 0.4s cubic-bezier(0.2, 0.9, 0.25, 1), border-color 0.3s;
  position: relative;
  overflow: hidden;
}
.project-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 255, 255, 0.55), transparent 60%);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
  mix-blend-mode: overlay;
}
.project-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.1) 55%, transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}
.project-card:hover {
  box-shadow: var(--shadow-16), var(--glass-inset);
  transform: translateY(-4px);
  border-color: var(--glass-edge-top);
}
.project-card:hover::after,
.project-card:hover::before { opacity: 1; }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; position: relative; z-index: 1; }
.card-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.type-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  text-transform: uppercase;
  flex-shrink: 0;
}
.type-node { background: #83cd29; }
.type-python { background: #3776ab; }
.type-go { background: #00add8; }
.type-html { background: #e34f26; }
.type-markdown { background: #4b5563; }
.type-unknown { background: #8e8e93; }
.card-title { font-size: 15px; font-weight: 700; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-slug { font-size: 12px; margin-top: 3px; color: var(--text-muted); }
.card-desc { font-size: 13px; line-height: 1.55; color: var(--text-secondary); margin: 14px 0 0; min-height: 20px; }
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
}
.card-meta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-muted); }
.card-actions { display: flex; gap: 4px; position: relative; z-index: 1; }

/* ════════════════════════════════════════════════
   Status pill
   ════════════════════════════════════════════════ */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.status .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.s-running { background: var(--success-light); color: #1c7a36; }
.s-running .dot { background: var(--success); box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.18); }
.s-stopped { background: var(--surface-2); color: var(--text-muted); }
.s-stopped .dot { background: var(--text-muted); }
.s-starting { background: var(--warning-light); color: #a8620a; }
.s-starting .dot { background: var(--warning); }
.s-errored { background: var(--danger-light); color: #c42119; }
.s-errored .dot { background: var(--danger); }
.s-static { background: var(--primary-light); color: var(--primary); }
.s-static .dot { background: var(--primary); }

/* ════════════════════════════════════════════════
   Buttons
   ════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  white-space: nowrap;
  font-family: inherit;
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { background: var(--primary-pressed); }
.btn-ghost {
  background: var(--glass-strong);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: var(--text);
  border-color: var(--glass-edge);
  box-shadow: var(--shadow-2), var(--glass-inset);
}
.btn-ghost:hover { background: var(--surface-solid); }
.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 59, 48, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: none;
  background: var(--glass-thin);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-solid); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-light); color: var(--danger); }

/* ════════════════════════════════════════════════
   Filter chip
   ════════════════════════════════════════════════ */
.filter-chip {
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--glass-edge);
  background: var(--glass-strong);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: var(--text-secondary);
  box-shadow: var(--shadow-2), var(--glass-inset);
  transition: all 0.18s;
  font-family: inherit;
}
.filter-chip:hover { background: var(--surface-solid); color: var(--text); }
.filter-chip.active {
  background: var(--primary);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* ════════════════════════════════════════════════
   Form inputs
   ════════════════════════════════════════════════ */
.form-label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-group { margin-bottom: 20px; }
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  outline: none;
  transition: box-shadow 0.18s, background 0.18s, border-color 0.18s;
  font-family: inherit;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:hover { background: var(--surface-hover); }
.form-input:focus {
  background: var(--surface-solid);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}
textarea.form-input { resize: vertical; }
.field-hint { font-size: 12px; margin-top: 6px; color: var(--text-muted); }

.url-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  transition: box-shadow 0.18s, background 0.18s, border-color 0.18s;
}
.url-input-wrap:focus-within {
  background: var(--surface-solid);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}
.url-input-wrap .prefix {
  padding: 10px 12px;
  font-size: 13px;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-muted);
  border-right: 1px solid var(--hairline);
}
.url-input-wrap input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font-size: 14px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: 'SF Mono', 'Fira Mono', ui-monospace, monospace;
}

/* Drop zone */
.drop-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
  background: var(--surface-2);
}
.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--primary);
  border-style: solid;
  background: var(--primary-light);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.drop-zone .big { font-size: 30px; margin-bottom: 10px; }
.drop-zone .title { font-size: 14px; font-weight: 600; }
.drop-zone .desc { font-size: 12.5px; margin-top: 4px; color: var(--text-muted); }
.file-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  margin-top: 10px;
  background: var(--primary-light);
}
.file-pill .name { font-size: 13.5px; font-weight: 600; color: var(--primary); }
.file-pill .size { font-size: 12px; color: var(--text-muted); }

/* ════════════════════════════════════════════════
   Empty state
   ════════════════════════════════════════════════ */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}
.empty .emoji { font-size: 48px; margin-bottom: 16px; }
.empty .title { font-size: 18px; font-weight: 700; color: var(--text); }
.empty p { font-size: 14px; margin-top: 6px; }

/* ════════════════════════════════════════════════
   Modal (logs / delete)
   ════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-64);
  padding: 24px;
  width: 720px;
  max-width: 94vw;
  animation: slideUp 0.35s cubic-bezier(0.2, 0.9, 0.25, 1);
}
.modal.small { width: 420px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h2 { font-size: 18px; font-weight: 700; margin: 0; }
.modal p { font-size: 14px; line-height: 1.6; color: var(--text-secondary); margin: 0; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

.logbox {
  background: rgba(28, 28, 30, 0.96);
  border-radius: var(--radius);
  padding: 16px;
  font-family: 'SF Mono', 'Fira Mono', ui-monospace, monospace;
  font-size: 12.5px;
  line-height: 1.65;
  color: #e5e7eb;
  max-height: 52vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ════════════════════════════════════════════════
   Toast
   ════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  padding: 13px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-16), var(--glass-inset);
  animation: slideUp 0.35s cubic-bezier(0.2, 0.9, 0.25, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 340px;
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--glass-edge);
}
.toast.success { background: rgba(52, 199, 89, 0.18); color: #1c7a36; }
.toast.error { background: rgba(255, 59, 48, 0.16); color: #c42119; }
.toast.info { background: rgba(0, 122, 255, 0.16); color: #0860c4; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; height: 240px; color: var(--text-muted); }

.detail-hint { font-size: 12px; font-weight: 600; color: var(--text-muted); align-self: center; }
.project-card:hover .detail-hint { color: var(--primary); }

/* ════════════════════════════════════════════════
   상세 페이지
   ════════════════════════════════════════════════ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.back-link:hover { color: var(--primary); }

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.detail-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.detail-title .type-badge { width: 52px; height: 52px; border-radius: 13px; font-size: 15px; }
.detail-title h1 { font-size: 24px; font-weight: 700; margin: 0; line-height: 1.2; }
.detail-title .slug { font-size: 13.5px; margin-top: 4px; color: var(--text-muted); }
.detail-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px 28px;
}
.info-item { min-width: 0; }
.info-item .k { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.info-item .v { font-size: 14px; color: var(--text); word-break: break-word; }
.info-item .v.mono { font-size: 13px; }
.info-full { grid-column: 1 / -1; }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}
.section-title h2 { font-size: 16px; font-weight: 700; margin: 0; }

/* 업로드 페이지: 화면 중앙 정렬 */
.upload-main {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.upload-main .page-head { width: 100%; }

/* ── 좁은 화면 대응 ── */
@media (max-width: 760px) {
  .app-header { padding: 0 16px; }
  .search-wrap { display: none; }
  main { padding: 20px 16px; }
  .header-right { gap: 6px; }
}
