/* 나의 칸반 -- 전체 스타일: 에메랄드 사이드바 + 흰 본문 + 연회색 칼럼 구성 */

:root {
  --sidebar-bg: #0c3b2e;
  --sidebar-bg-soft: #114639;
  --sidebar-active: #1a5a45;
  --sidebar-border: rgba(255, 255, 255, 0.16);
  --primary: #0e4b38;
  --primary-hover: #0a3a2b;
  --accent: #12855f;
  --bg: #ffffff;
  --column-bg: #f4f6f5;
  --card-bg: #ffffff;
  --border: #e1e6e4;
  --border-strong: #c9d2ce;
  --text: #1c2b26;
  --text-muted: #66756f;
  --danger: #d9342b;
  --danger-hover: #b8281f;
  --dot-todo: #9aa5a0;
  --dot-doing: #f2b705;
  --dot-done: #12855f;
  --shadow: 0 1px 3px rgba(16, 42, 34, 0.08);
  --shadow-pop: 0 8px 24px rgba(16, 42, 34, 0.18);
  --radius: 12px;
  --focus-ring: 0 0 0 3px rgba(18, 133, 95, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  font-size: 14.5px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

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

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible,
.sidebar-resizer:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.hidden { display: none !important; }

/* ---------- 전체 레이아웃 ---------- */

.app {
  display: flex;
  min-height: 100vh;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 28px 32px 40px;
}

/* ---------- 사이드바 ---------- */

.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: #ffffff;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

/* 사이드바 폭 조절 손잡이 */
.sidebar-resizer {
  width: 6px;
  flex-shrink: 0;
  cursor: col-resize;
  background: transparent;
  border-left: 1px solid var(--border);
}

.sidebar-resizer:hover,
.sidebar-resizer.resizing {
  background: rgba(18, 133, 95, 0.25);
}

body.resizing-sidebar {
  cursor: col-resize;
  user-select: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  padding: 6px 8px 14px;
}

.brand-icon {
  display: inline-flex;
  padding: 6px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

.overview-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
}

.overview-btn:hover { background: var(--sidebar-bg-soft); }

.overview-btn.active {
  background: var(--sidebar-active);
  border-color: var(--sidebar-border);
}

.menu-icon { display: inline-flex; }

.sidebar-title {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.72);
  margin: 14px 8px 4px;
}

.project-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  cursor: grab;
}

.project-item:hover { background: var(--sidebar-bg-soft); }

.project-item.active {
  background: var(--sidebar-active);
  border-color: rgba(255, 255, 255, 0.4);
}

.project-item.dragging { opacity: 0.45; cursor: grabbing; }

.project-open-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  min-height: 34px;
}

.project-open-btn .project-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  padding: 4px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: 14.5px;
  line-height: 1;
}

.icon-btn:hover { background: rgba(255, 255, 255, 0.16); }

.drag-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12.5px;
  margin: 10px 8px;
}

.add-project-btn {
  margin-top: auto;
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--sidebar-border);
  border-radius: 12px;
  background: transparent;
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 600;
}

.add-project-btn:hover { background: var(--sidebar-bg-soft); }

.logout-btn {
  width: 100%;
  min-height: 40px;
  margin-top: 8px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font-size: 13.5px;
  font-weight: 600;
}

.logout-btn:hover {
  background: var(--sidebar-bg-soft);
  color: #ffffff;
}

/* ---------- 썸네일 ---------- */

.thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 10px;
  background: #0f5540;
  color: #b5e5d3;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb svg { width: 55%; height: 55%; }

.thumb-sm { width: 28px; height: 28px; border-radius: 8px; }
.thumb-xs { width: 26px; height: 26px; border-radius: 7px; }
.thumb-lg { width: 64px; height: 64px; border-radius: 14px; }
.thumb-preview { width: 110px; height: 110px; border-radius: 14px; }

/* ---------- 메인 헤더 ---------- */

.view-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.view-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.view-title {
  font-size: 25px;
  font-weight: 700;
  margin: 0;
}

.view-desc {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 14.5px;
}

.header-spacer { flex: 1; }

.info-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 13.5px;
  background: #fff;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ---------- 버튼 공통 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 600;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-outline {
  background: #ffffff;
  color: var(--primary);
  border-color: var(--border-strong);
}

.btn-outline:hover { background: #f2f5f4; }

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover { background: var(--danger-hover); }

.btn-sm {
  min-height: 40px;
  padding: 8px 16px;
  font-size: 13.5px;
}

/* ---------- 전체 개요 ---------- */

.overview-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: stretch;
  margin-bottom: 22px;
}

.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
}

.filter-chip:hover { background: #f2f5f4; }

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.stat-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-left: auto;
}

.stat-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 148px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--primary);
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-muted);
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

/* ---------- 칸반 보드 ---------- */

.board {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 16px;
  flex: 1;
  min-width: 0;
}

.column {
  width: 480px;
  flex-shrink: 0;
  background: var(--column-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.column-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 4px;
}

.column-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.column-dot.todo { background: var(--dot-todo); }
.column-dot.doing { background: var(--dot-doing); }
.column-dot.done { background: var(--dot-done); }
.column-dot.custom { background: var(--accent); }

.column-name {
  font-size: 15.5px;
  font-weight: 700;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-count {
  min-width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border-radius: 8px;
  background: #e6eae8;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
}

.column-menu-btn {
  margin-left: auto;
  color: var(--text-muted);
  min-width: 36px;
  min-height: 36px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 16px;
  line-height: 1;
}

.column-menu-btn:hover { background: #e6eae8; }

.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 40px;
}

.column-empty {
  color: var(--text-muted);
  font-size: 13.5px;
  text-align: center;
  padding: 14px 8px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
}

/* ---------- 카드 ---------- */

.card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px;
  display: flex;
  gap: 8px;
  cursor: grab;
}

.card.dragging { opacity: 0.45; cursor: grabbing; }

.card.card-editing { cursor: auto; }

.card.flash {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

.card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding-right: 30px; /* 우측 상단 복사 아이콘 자리 확보 */
}

.card-body {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  margin: 0;
}

/* 복사 버튼: 카드 우측 상단 고정, 아이콘만 표시 */
.copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  min-width: 32px;
  min-height: 32px;
  padding: 4px;
  border-radius: 8px;
}

.copy-btn:hover { background: #eef1f0; color: var(--text); }

.copy-btn.copied { color: var(--accent); }

.card-meta {
  display: flex;
  flex-wrap: wrap; /* 한 줄 표시, 좁으면 줄바꿈 */
  justify-content: flex-end;
  gap: 2px 12px;
  color: var(--text-muted);
  font-size: 9px;
}

.card-project {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 700;
}

.overview-card { cursor: pointer; }

.overview-card:hover { border-color: var(--border-strong); }

/* 카드 편집/작성 */

.card-editing {
  border: 2px solid var(--primary);
}

.composer {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.composer-title {
  font-size: 14.5px;
  font-weight: 700;
  margin: 0;
}

.composer textarea,
.card-edit-textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
}

.composer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.add-card-btn {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
}

.add-card-btn:hover { background: #e9edec; }

/* 드롭 위치 표시 */

.drop-indicator {
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
  margin: -2px 0;
}

.column.drag-over { border-color: var(--accent); }

/* 칼럼 추가 영역(보드 끝) */

.add-column-zone {
  width: 300px;
  flex-shrink: 0;
  min-height: 220px;
  border: 2px dashed var(--border-strong);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* ---------- 빈 상태 ---------- */

.empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 15.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.empty-state strong {
  color: var(--text);
  font-size: 18px;
}

/* ---------- 모달 ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 30, 24, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

/* 로그인 화면: 불투명 배경으로 뒤 내용 완전 차단 */
.modal-overlay.opaque { background: var(--sidebar-bg); }

/* 로그인 전 잠금: 앱 내용 비표시 */
body.locked .app { visibility: hidden; }

.modal {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: var(--shadow-pop);
  width: 100%;
  max-width: 420px;
  padding: 26px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-sm { max-width: 360px; }

.modal-eyebrow {
  color: var(--text-muted);
  font-size: 12.5px;
  margin: 0 0 4px;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 18px;
}

.field-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin: 14px 0 6px;
}

.required { color: var(--danger); }

.text-input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--text);
}

.field-error {
  color: var(--danger);
  font-size: 12.5px;
  margin: 6px 0 0;
}

.field-hint {
  color: var(--text-muted);
  font-size: 12.5px;
  margin: 8px 0 0;
}

.preview-label {
  font-size: 13.5px;
  font-weight: 600;
  margin: 14px 0 8px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

/* ---------- 팝오버 ---------- */

.popover {
  position: fixed;
  z-index: 60;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  min-width: 160px;
  padding: 6px;
  color: var(--text);
}

.popover-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.popover-menu button {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  min-height: 42px;
}

.popover-menu button:hover:not(:disabled) { background: #f2f5f4; }

.popover-menu button:disabled {
  color: #a8b3ae;
  cursor: not-allowed;
}

.popover-menu button.danger { color: var(--danger); }

.popover-menu button.danger:hover:not(:disabled) { background: #fdeceb; }

.confirm-pop {
  max-width: 260px;
  padding: 14px;
}

.confirm-pop .confirm-title {
  font-size: 13.5px;
  font-weight: 700;
  margin: 0 0 6px;
}

.confirm-pop .confirm-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.confirm-pop .confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- 토스트 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--primary);
  color: #ffffff;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 14.5px;
  font-weight: 600;
  box-shadow: var(--shadow-pop);
  max-width: min(90vw, 480px);
}

.toast.error { background: var(--danger); }

.toast-close {
  border: none;
  background: transparent;
  color: #ffffff;
  font-size: 14.5px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 8px;
}

.toast-close:hover { background: rgba(255, 255, 255, 0.18); }

/* ---------- 반응형 ---------- */

@media (max-width: 900px) {
  .sidebar { width: 220px; padding: 14px 10px; }
  .main { padding: 18px 16px 32px; }
  .stat-group { margin-left: 0; }
  .stat-tile { min-width: 0; flex: 1 1 auto; }
}

/* ---------- 애니메이션 최소화 ---------- */

@media (prefers-reduced-motion: no-preference) {
  .btn, .filter-chip, .icon-btn, .copy-btn, .add-card-btn, .popover-menu button {
    transition: background-color 0.15s ease, border-color 0.15s ease;
  }
  .card.flash { animation: flash-fade 1.6s ease forwards; }
  @keyframes flash-fade {
    0%, 70% { outline-color: var(--accent); }
    100% { outline-color: transparent; }
  }
}
