:root {
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #26354d;
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-sky: #0ea5e9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.5;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #0f172a;
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Pulsing Shelf Highlight Animation on 2D Map */
@keyframes pulse-shelf {
  0%, 100% {
    stroke-width: 3px;
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.9));
  }
  50% {
    stroke-width: 6px;
    filter: drop-shadow(0 0 18px rgba(245, 158, 11, 1));
  }
}

.shelf-highlight {
  animation: pulse-shelf 1.3s infinite ease-in-out;
}

/* 기초관리: 서가 구역 드래그·리사이즈 */
.shelf-map-editable .shelf-zone-editable:hover .zone-body {
  filter: brightness(1.05);
}
.shelf-map-editable .zone-resize-handle {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}
.shelf-map-editable .zone-resize-handle:hover {
  r: 10;
}

/* Toast Notification */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast-item {
  background: rgba(15, 23, 42, 0.96);
  border-left: 4px solid #6366f1;
  border-top: 1px solid #334155;
  border-right: 1px solid #334155;
  border-bottom: 1px solid #334155;
  color: #f8fafc;
  padding: 14px 18px;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  min-width: 290px;
  max-width: 420px;
  animation: slideInUp 0.25s ease-out;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal Backdrop */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.hidden {
  display: none !important;
}

/* Shelf Elevation Stack (1단 ~ 5단 시각화) */
.shelf-stack-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.shelf-stack-row.active-row {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.25), rgba(239, 68, 68, 0.2));
  border-color: #f59e0b;
  color: #fde68a;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
}

/* ───────── 밝은 테마 (data-theme="light", /js/theme.js) ───────── */
[data-theme="light"] body {
  background-color: #f1f5f9;
  color: #0f172a;
}
[data-theme="light"] ::-webkit-scrollbar-track { background: #e2e8f0; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: #94a3b8; }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #64748b; }
[data-theme="light"] .toast-item {
  background: rgba(255, 255, 255, 0.98);
  border-top-color: #e2e8f0;
  border-right-color: #e2e8f0;
  border-bottom-color: #e2e8f0;
  color: #0f172a;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.15);
}
[data-theme="light"] .toast-item .toast-msg { color: #475569 !important; }
[data-theme="light"] .modal-backdrop { background: rgba(15, 23, 42, 0.45); }
[data-theme="light"] .shelf-stack-row { background: #ffffff; border-color: #e2e8f0; }
[data-theme="light"] .shelf-stack-row.active-row { color: #92400e; }
/* 매장이 지정한 색 바탕(서가·도서 색 등) 위 글자는 흰색 유지 */
[data-theme="light"] .keep-white { color: #ffffff !important; }

/* 테마 전환 버튼 */
.ncafe-theme-toggle {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 900;
  padding: 6px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.85);
  color: #e2e8f0;
  cursor: pointer;
  opacity: 0.75;
}
.ncafe-theme-toggle:hover { opacity: 1; }
[data-theme="light"] .ncafe-theme-toggle {
  border-color: #cbd5e1;
  background: rgba(255, 255, 255, 0.9);
  color: #334155;
}
@media print { .ncafe-theme-toggle { display: none; } }
