/* ==========================================================================
   taekm33 dashboard styles
   - 다크/라이트 토글 (data-theme="dark|light")
   - 시스템 폰트, 가벼운 미니멀 디자인
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
  --transition: 160ms cubic-bezier(0.2, 0, 0, 1);
  --font-sans: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo",
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", "Menlo", monospace;
}

/* Light theme */
:root,
[data-theme="light"] {
  --bg: #fafafa;
  --bg-elevated: #ffffff;
  --bg-subtle: #f1f3f5;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-muted: #6b7280;
  --text-subtle: #9ca3af;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --planned: #94a3b8;
}

/* Dark theme */
[data-theme="dark"] {
  --bg: #0b0d10;
  --bg-elevated: #14171c;
  --bg-subtle: #1c2027;
  --border: #2a2f37;
  --border-strong: #3a4049;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --text-subtle: #6b7280;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --planned: #64748b;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

button { font-family: inherit; cursor: pointer; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  position: fixed;
  left: 16px; top: 16px;
  padding: 8px 12px;
  background: var(--accent);
  color: white;
  border-radius: var(--radius-sm);
  z-index: 1000;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(160%) blur(8px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  font-size: 20px;
  color: var(--accent);
  transform: rotate(45deg);
  display: inline-block;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-text strong { font-size: 16px; font-weight: 700; }
.brand-text small { font-size: 12px; color: var(--text-muted); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box input {
  width: 280px;
  max-width: 40vw;
  padding: 8px 36px 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--transition), background var(--transition);
}
.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-elevated);
}
.search-kbd {
  position: absolute;
  right: 8px;
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-family: var(--font-mono);
  pointer-events: none;
}
.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--accent);
}
[data-theme="dark"] .icon-sun { display: inline; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: inline; }

/* ---------- Hero ---------- */
.main { flex: 1; padding: 48px 0 64px; }
.hero { margin-bottom: 32px; }
.hero-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.hero-sub {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 15px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}
.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.chip.is-active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  text-decoration: none;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  min-height: 160px;
}
.card:hover {
  text-decoration: none;
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.card.is-disabled {
  pointer-events: none;
  opacity: 0.65;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.card-icon {
  font-size: 28px;
  line-height: 1;
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}
.card-desc {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-muted);
  flex: 1;
}
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-subtle);
}
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--text-muted);
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
}
.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--planned);
}
.status[data-status="online"] { color: var(--success); }
.status[data-status="online"]::before { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 20%, transparent); }
.status[data-status="offline"] { color: var(--danger); }
.status[data-status="offline"]::before { background: var(--danger); }
.status[data-status="degraded"] { color: var(--warning); }
.status[data-status="degraded"]::before { background: var(--warning); }
.status[data-status="planned"] { color: var(--text-subtle); }
.status[data-status="planned"]::before { background: var(--planned); }

.badge-admin {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 0;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 24px 0;
  margin-top: auto;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}
.footer-meta { margin: 0; }

/* ---------- Modal ---------- */
.modal {
  border: none;
  padding: 0;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text);
  width: min(92vw, 420px);
  box-shadow: var(--shadow-lg);
}
.modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}
.modal-inner {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-inner h2 { margin: 0; font-size: 18px; }
.modal-desc { margin: 0; font-size: 13px; color: var(--text-muted); }
.modal-desc code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-subtle);
  padding: 1px 4px;
  border-radius: 3px;
}
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.field input {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.field input:focus { outline: none; border-color: var(--accent); }
.form-error {
  margin: 0;
  font-size: 12px;
  color: var(--danger);
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.btn {
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}
.btn:hover { border-color: var(--border-strong); }
.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Mobile tweaks ---------- */
@media (max-width: 640px) {
  .header-inner { height: 56px; }
  .search-box input { width: 160px; }
  .brand-text small { display: none; }
  .main { padding: 28px 0 40px; }
}
