/* ============================================================
   리브레토 마케팅 — Phase 0 사이드바 IA
   - 220px 좌측 고정, 헤더 52px 아래
   - 그룹 라벨 / 활성 상태 / placeholder(disabled)
   - 모바일 768px 이하: off-canvas drawer (mobile.css 가 처리)
   ============================================================ */

:root {
    --sidebar-width: 220px;
    --sidebar-bg: var(--bg-white);
    --sidebar-border: var(--border-light);
}

/* ===== Sidebar (데스크톱 기본) ===== */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 80;
    padding: 14px 10px 24px;
    font-family: var(--font-sans);
    /* iOS 자연 스크롤 */
    -webkit-overflow-scrolling: touch;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

/* 그룹 */
.sidebar__group { margin-bottom: 14px; }
.sidebar__group:last-child { margin-bottom: 0; }

.sidebar__label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 6px 10px 4px;
    margin: 0;
}

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

/* 도구 항목 */
.sidebar__item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: left;
    cursor: pointer;
    transition: background .12s, color .12s;
    /* 텍스트 잘림 방지 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar__item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.sidebar__item.is-active {
    background: var(--sage-light);
    color: var(--sage-dark);
    font-weight: 600;
}

.sidebar__item.is-active .sidebar__icon {
    color: var(--sage);
}

.sidebar__icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color .12s;
}
.sidebar__item:hover .sidebar__icon { color: var(--text-secondary); }

.sidebar__item-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* placeholder (준비중) */
.sidebar__item.is-disabled,
.sidebar__item[aria-disabled="true"] {
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: .55;
}
.sidebar__item.is-disabled:hover,
.sidebar__item[aria-disabled="true"]:hover {
    background: transparent;
    color: var(--text-muted);
}
.sidebar__item-soon {
    margin-left: auto;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 8px;
    flex-shrink: 0;
}

/* ===== Content (작업 영역) ===== */
.content {
    /* 사이드바 폭만큼 좌측 패딩 — 자식 패널의 fixed 위치는 별도 오버라이드로 처리 */
    margin-left: var(--sidebar-width);
    /* 자식 .tool-panel 들이 position:fixed 라서 기본은 그저 스택 컨테이너 */
}

/* 도구 패널 — 기존 .main-tab-panel 의 후속 */
.tool-panel {
    display: none;
}
.tool-panel.is-active {
    display: block;
}

/* ===== 햄버거 (모바일 전용 — 데스크톱에선 숨김) ===== */
.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    margin-right: 6px;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    flex-shrink: 0;
}
.sidebar-toggle:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ===== 모바일 오버레이 (사이드바 열렸을 때) ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, .35);
    z-index: 70;
    opacity: 0;
    transition: opacity .18s;
}
.sidebar-overlay.is-visible {
    display: block;
    opacity: 1;
}

/* ============================================================
   Phase 0 — 도구 패널 좌측 위치 보정
   기존 .project-dashboard / .project-detail / .main-tab-panel--cardnews 가
   position:fixed; left:0 인데, 사이드바 220px 만큼 밀어줘야 함.
   기존 cardnews.css 가 top 을 (header+main-tab) 으로 잡고 있어 그것도 보정.
   ============================================================ */
.project-dashboard,
.project-detail {
    left: var(--sidebar-width);
    /* 기존 cardnews.css 에서 top 을 main-tab-height 까지 더했지만,
       메인탭 제거되었으므로 헤더 바로 아래로 끌어올림 */
    top: var(--header-height);
}

.tool-panel--cardnews {
    position: fixed;
    top: var(--header-height);
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    overflow-y: auto;
    background: var(--bg-primary);
}
.tool-panel--cardnews.is-active { display: block; }

/* 후방호환: 기존 .main-tab-panel--cardnews 클래스가 남아있는 경우에도 동작 */
.main-tab-panel--cardnews {
    left: var(--sidebar-width);
    top: var(--header-height);
}
