/* static/css/ai_cowork.css — AI 이미지 툴 'Cowork 작업물' 탭 (읽기 전용 뷰어)
   팔레트 3(딥틸+크림+번트오렌지): #04151f #183a37 #efd6ac #c44900 #432534 — 한 화면 한 팔레트.
   모든 규칙은 .acw-* 스코프 안에만 있어 다른 탭과 충돌하지 않는다. */

.acw-card {
  --acw-ink: #04151f;
  --acw-teal: #183a37;
  --acw-cream: #efd6ac;
  --acw-orange: #c44900;
  --acw-plum: #432534;
  --acw-cream-soft: rgba(239, 214, 172, 0.42);
  --acw-teal-line: rgba(24, 58, 55, 0.2);
  --acw-muted: rgba(67, 37, 52, 0.66);
  padding: 24px;
  color: var(--acw-plum);
}

/* ===== 툴바 ===== */
.acw-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 14px;
}

.acw-crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.acw-crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--acw-cream-soft);
  color: var(--acw-plum);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  text-decoration: none;
}

.acw-crumb:hover {
  border-color: var(--acw-orange);
  color: var(--acw-orange);
}

.acw-crumb.is-current {
  background: var(--acw-teal);
  color: var(--acw-cream);
  cursor: default;
}

.acw-crumb.is-current:hover {
  border-color: transparent;
  color: var(--acw-cream);
}

.acw-crumb-sep {
  color: var(--acw-muted);
  font-size: 0.78rem;
}

.acw-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.acw-search {
  position: relative;
  display: block;
  margin: 0;
}

.acw-search > i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--acw-muted);
  font-size: 0.8rem;
  pointer-events: none;
}

.acw-search > input {
  width: 200px;
  padding-left: 30px;
  border-color: var(--acw-teal-line);
  border-radius: 999px;
  color: var(--acw-plum);
}

.acw-search > input:focus {
  border-color: var(--acw-orange);
  box-shadow: 0 0 0 3px rgba(196, 73, 0, 0.16);
}

.acw-sort {
  width: auto;
  border-color: var(--acw-teal-line);
  border-radius: 999px;
  color: var(--acw-plum);
}

.acw-sort:focus {
  border-color: var(--acw-orange);
  box-shadow: 0 0 0 3px rgba(196, 73, 0, 0.16);
}

.acw-auto {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 2px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--acw-plum);
  cursor: pointer;
  user-select: none;
}

.acw-auto .form-check-input {
  margin: 0;
  border-color: var(--acw-teal);
}

.acw-auto .form-check-input:checked {
  background-color: var(--acw-orange);
  border-color: var(--acw-orange);
}

.acw-auto .form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(196, 73, 0, 0.16);
}

.acw-btn-primary,
.acw-btn-primary:focus {
  background: var(--acw-orange);
  border: 1px solid var(--acw-orange);
  color: #fff;
  font-weight: 700;
  border-radius: 999px;
  padding: 5px 14px;
}

.acw-btn-primary:hover {
  background: var(--acw-plum);
  border-color: var(--acw-plum);
  color: #fff;
}

.acw-btn-ghost,
.acw-btn-ghost:focus {
  background: #fff;
  border: 1px solid var(--acw-teal);
  color: var(--acw-teal);
  font-weight: 700;
  border-radius: 999px;
  padding: 5px 14px;
}

.acw-btn-ghost:hover {
  background: var(--acw-cream-soft);
  border-color: var(--acw-teal);
  color: var(--acw-ink);
}

.acw-only-mobile {
  display: none;
}

/* ===== 본문: 트리 + 격자 ===== */
.acw-body {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.acw-tree {
  background: var(--acw-teal);
  color: var(--acw-cream);
  border-radius: 14px;
  padding: 10px;
  max-height: 72vh;
  overflow: auto;
  font-size: 0.86rem;
  position: sticky;
  top: 12px;
}

.acw-tree-loading,
.acw-tree-empty {
  padding: 10px 8px;
  color: rgba(239, 214, 172, 0.8);
  font-size: 0.82rem;
}

.acw-tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.acw-tree ul ul {
  padding-left: 14px;
  border-left: 1px dashed rgba(239, 214, 172, 0.22);
  margin-left: 11px;
}

.acw-tree li.is-collapsed > ul {
  display: none;
}

.acw-node {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 8px;
  cursor: pointer;
  min-width: 0;
}

.acw-node:hover {
  background: rgba(239, 214, 172, 0.14);
}

.acw-node.is-active {
  background: var(--acw-orange);
  color: #fff;
}

.acw-node-toggle {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 0.7rem;
  line-height: 18px;
  text-align: center;
  opacity: 0.8;
  transition: transform 0.15s ease;
}

.acw-node-toggle.is-hidden {
  visibility: hidden;
}

li.is-collapsed > .acw-node > .acw-node-toggle {
  transform: rotate(-90deg);
}

.acw-node-icon {
  flex: 0 0 auto;
  color: var(--acw-cream);
  opacity: 0.9;
}

.acw-node.is-active .acw-node-icon {
  color: #fff;
}

.acw-node-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.acw-node-count {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(239, 214, 172, 0.2);
  color: var(--acw-cream);
}

.acw-node.is-active .acw-node-count {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.acw-main {
  min-width: 0;
}

.acw-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  min-height: 26px;
}

.acw-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--acw-cream-soft);
  color: var(--acw-plum);
  font-size: 0.78rem;
  font-weight: 700;
}

.acw-chip i {
  color: var(--acw-orange);
  font-size: 0.74rem;
}

.acw-chip.is-quiet {
  background: transparent;
  border: 1px dashed var(--acw-teal-line);
  font-weight: 600;
}

/* ===== 격자 ===== */
.acw-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 10px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--acw-teal);
}

.acw-section-title::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: var(--acw-teal-line);
}

.acw-section-count {
  font-size: 0.72rem;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--acw-teal);
  color: var(--acw-cream);
}

.acw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.acw-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  padding: 0;
  text-align: left;
  border: 1px solid var(--acw-teal-line);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  color: inherit;
}

.acw-tile:hover,
.acw-tile:focus-visible {
  transform: translateY(-2px);
  border-color: var(--acw-orange);
  box-shadow: 0 8px 20px rgba(4, 21, 31, 0.12);
  outline: none;
}

.acw-tile-folder {
  background: var(--acw-cream-soft);
  border-color: rgba(239, 214, 172, 0.9);
}

.acw-tile-folder .acw-thumb {
  background: transparent;
  aspect-ratio: 16 / 7;
}

.acw-tile-folder .acw-thumb i {
  font-size: 2.4rem;
  color: var(--acw-orange);
}

.acw-thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  background: rgba(24, 58, 55, 0.06);
  overflow: hidden;
}

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

.acw-thumb-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--acw-teal);
}

.acw-thumb-icon i {
  font-size: 2.2rem;
}

.acw-ext {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--acw-orange);
  color: #fff;
}

.acw-tile-body {
  padding: 9px 11px 11px;
  min-width: 0;
}

.acw-tile-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--acw-plum);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acw-tile-meta {
  margin-top: 3px;
  font-size: 0.72rem;
  color: var(--acw-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acw-badge-new {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--acw-orange);
  color: #fff;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: 0 2px 6px rgba(4, 21, 31, 0.25);
}

.acw-kind-mark {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 21, 31, 0.7);
  color: var(--acw-cream);
  font-size: 0.7rem;
}

/* 로딩 · 빈 상태 · 오류 */
.acw-loading {
  display: flex;
  align-items: center;
  padding: 26px 6px;
  color: var(--acw-muted);
  font-size: 0.9rem;
}

.acw-empty {
  padding: 34px 20px;
  border: 1px dashed var(--acw-teal-line);
  border-radius: 14px;
  text-align: center;
  color: var(--acw-plum);
  background: rgba(239, 214, 172, 0.18);
}

.acw-empty i {
  font-size: 2rem;
  color: var(--acw-orange);
  margin-bottom: 10px;
}

.acw-empty-title {
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 6px;
}

.acw-empty-sub {
  font-size: 0.84rem;
  color: var(--acw-muted);
  line-height: 1.6;
}

.acw-empty-sub code {
  color: var(--acw-orange);
  background: rgba(196, 73, 0, 0.08);
  padding: 1px 6px;
  border-radius: 6px;
}

.acw-error {
  padding: 16px 18px;
  border-radius: 12px;
  background: rgba(196, 73, 0, 0.1);
  border: 1px solid rgba(196, 73, 0, 0.35);
  color: var(--acw-plum);
  font-size: 0.88rem;
}

.acw-status {
  margin-top: 6px;
  font-size: 0.76rem;
  color: var(--acw-muted);
  text-align: right;
}

.acw-status.is-live span::after {
  content: ' · 자동 갱신 중';
  color: var(--acw-orange);
  font-weight: 700;
}

/* ===== 모달 (미리보기 · 텍스트) ===== */
.acw-modal .modal-content {
  background: var(--acw-ink, #04151f);
  color: #efd6ac;
  border: 1px solid #183a37;
  border-radius: 16px;
}

.acw-modal .modal-header,
.acw-modal .modal-footer {
  border-color: #183a37;
  padding: 12px 18px;
}

.acw-preview-head {
  min-width: 0;
  flex: 1 1 auto;
}

.acw-modal .modal-title {
  font-size: 1rem;
  font-weight: 800;
  color: #efd6ac;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acw-preview-sub {
  font-size: 0.76rem;
  color: rgba(239, 214, 172, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acw-preview-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  min-height: 300px;
  background: #000;
}

.acw-stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-height: 72vh;
}

.acw-stage img,
.acw-stage video {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 6px;
}

.acw-stage audio {
  width: min(560px, 100%);
}

.acw-stage-audio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 30px 10px;
  color: #efd6ac;
}

.acw-stage-audio i {
  font-size: 3rem;
  color: #c44900;
}

.acw-nav {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: #183a37;
  color: #efd6ac;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease;
}

.acw-nav:hover:not(:disabled) {
  background: #c44900;
  color: #fff;
}

.acw-nav:disabled {
  opacity: 0.3;
  cursor: default;
}

.acw-preview-counter {
  margin-right: auto;
  font-size: 0.8rem;
  color: rgba(239, 214, 172, 0.75);
}

.acw-modal .acw-btn-ghost,
.acw-modal .acw-btn-ghost:focus {
  background: transparent;
  border-color: #efd6ac;
  color: #efd6ac;
}

.acw-modal .acw-btn-ghost:hover {
  background: rgba(239, 214, 172, 0.14);
  color: #fff;
}

.acw-modal .btn-close {
  margin-left: 12px;
}

.acw-text-body-wrap {
  padding: 0;
  background: #04151f;
}

.acw-text-truncated {
  padding: 8px 16px;
  font-size: 0.8rem;
  background: rgba(196, 73, 0, 0.18);
  color: #efd6ac;
  border-bottom: 1px solid #183a37;
}

.acw-text-body {
  margin: 0;
  padding: 16px 18px;
  min-height: 200px;
  max-height: 70vh;
  overflow: auto;
  color: #efd6ac;
  background: #04151f;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
  tab-size: 4;
}

/* ===== 좁은 화면 (모바일 셸 포함) ===== */
@media (max-width: 767px) {
  .acw-card {
    padding: 16px 12px 18px;
  }

  .acw-only-mobile {
    display: inline-flex;
    align-items: center;
  }

  .acw-body {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .acw-tree {
    display: none;
    position: static;
    max-height: 46vh;
  }

  .acw-card.acw-tree-open .acw-tree {
    display: block;
  }

  .acw-tools {
    width: 100%;
  }

  .acw-search {
    flex: 1 1 150px;
    min-width: 0;
  }

  .acw-search > input {
    width: 100%;
  }

  .acw-grid {
    grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
    gap: 10px;
  }

  .acw-crumb {
    max-width: 150px;
    font-size: 0.8rem;
  }

  .acw-preview-body {
    padding: 8px 4px;
    min-height: 200px;
  }

  .acw-nav {
    width: 32px;
    height: 32px;
  }

  .acw-stage img,
  .acw-stage video {
    max-height: 62vh;
  }

  .acw-status {
    text-align: left;
  }
}

/* ===== 파일 선택 · 삭제 · 페이지네이션 (2026-09-20, 같은 팔레트 3) ===== */
.acw-actionbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid var(--acw-teal-line);
  border-radius: 12px;
  background: var(--acw-cream-soft);
}
.acw-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--acw-plum);
  cursor: pointer;
  white-space: nowrap;
}
.acw-select-all .form-check-input,
.acw-check .form-check-input {
  width: 17px;
  height: 17px;
  margin: 0;
  border-color: var(--acw-teal);
  cursor: pointer;
}
.acw-select-all .form-check-input:checked,
.acw-check .form-check-input:checked {
  background-color: var(--acw-orange);
  border-color: var(--acw-orange);
}
.acw-selection-summary { font-size: 0.82rem; color: var(--acw-muted); white-space: nowrap; }

.acw-btn-danger,
.acw-btn-danger:focus {
  background: #fff;
  border: 1px solid var(--acw-orange);
  color: var(--acw-orange);
  font-weight: 700;
  border-radius: 999px;
  padding: 5px 14px;
}
.acw-btn-danger:hover:not(:disabled) { background: var(--acw-orange); border-color: var(--acw-orange); color: #fff; }
.acw-btn-danger:disabled { opacity: 0.45; cursor: not-allowed; }

/* 타일 왼쪽 위 체크박스 — 클릭이 타일(미리보기)로 번지지 않는다(JS stopPropagation) */
.acw-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--acw-teal-line);
  cursor: pointer;
}
.acw-tile-file.is-selected {
  border-color: var(--acw-orange);
  box-shadow: 0 0 0 3px rgba(196, 73, 0, 0.18);
}
.acw-tile-file.is-selected .acw-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(196, 73, 0, 0.12);
  pointer-events: none;
}
/* NEW 배지는 오른쪽 위로(왼쫓 위는 체크박스 자리) */
.acw-tile-file .acw-badge-new { left: auto; right: 8px; }

/* 페이저 — AiImagePager 마크업을 팔레트 3 으로(ai_cartoon.css 없이도 동작) */
.acw-pager { min-height: 30px; margin-top: 12px; }
.acw-pager .apose-pagination {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0;
}
.acw-pager .apose-page-btn {
  min-width: 34px; height: 32px; padding: 0 10px; border: 1px solid var(--acw-teal-line); border-radius: 8px;
  background: #fff; color: var(--acw-teal); font-size: 0.82rem; font-weight: 700; line-height: 1; transition: all 0.15s;
}
.acw-pager .apose-page-btn:hover:not([disabled]) { background: var(--acw-cream-soft); border-color: var(--acw-orange); color: var(--acw-orange); }
.acw-pager .apose-page-btn.is-active { background: var(--acw-teal); border-color: var(--acw-teal); color: var(--acw-cream); }
.acw-pager .apose-page-btn.is-nav { padding: 0 14px; }
