/* ============================================================================
   hr.dockPanel.css — 알프스 표준 우측 도크 패널 컴포넌트
   ============================================================================
   동작: resizable (좌측 핸들 드래그) + default 열림 + 닫기/열기 + localStorage 위치/폭 기억
   디자인: Phoenix support-chat 의 카드 chrome (그림자/border-radius/헤더/푸터) 차용
   범위: 알프스 공용 — OKR 피드 외 향후 인사평가/조직도/급여 등 화면별 dock 재사용
   z-index: 100049 (modal2 100050 직하, dialog 100200 아래)
   ============================================================================ */

/* ── 컨테이너 (panel + 닫혔을 때 토글 버튼 wrap) ─────────────────────
   floating 메신저 카드 — 카톡/Phoenix support-chat 스타일.
   우측 하단에 떠 있는 카드 (full-height dock 아님). 본문과 분리 */
.dock-panel-container {
    position: fixed;
    z-index: 100049;
    pointer-events: none;
    right: 0;
    bottom: 0;
    width: auto;
    height: auto;
}

/* ── 본체 패널 (열림 상태) ────────────────────────────────────────
   Phoenix support-chat 스펙 — max-width 27.87rem (≈446px), body 27rem (≈432px) */
.dock-panel {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: var(--dock-width, 420px);
    min-width: 360px;
    max-width: 480px;
    height: 640px;
    max-height: calc(100vh - 80px);
    background: var(--phoenix-body-emphasis-bg, #fff);
    border: 1px solid var(--phoenix-border-color-translucent, #e3e6ed);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(36, 40, 46, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
    transform: scale(0.85) translateY(20px);
    transform-origin: bottom right;
    opacity: 0;
    visibility: hidden;
    transition: transform 0.22s cubic-bezier(0.22, 0.61, 0.36, 1),
                opacity 0.18s ease,
                visibility 0s linear 0.22s;
}
.dock-panel.is-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    visibility: visible;
    transition: transform 0.22s cubic-bezier(0.22, 0.61, 0.36, 1),
                opacity 0.18s ease,
                visibility 0s linear 0s;
}

/* floating 카드는 resize 비활성 — 카톡도 고정 크기 */
.dock-panel-resizer { display: none; }

/* ── 헤더 (타이틀 + 액션) ──────────────────────────────────────── */
.dock-panel-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--phoenix-border-color-translucent, #e3e6ed);
    background: var(--phoenix-body-emphasis-bg, #fff);
    gap: 8px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}
.dock-panel-title {
    flex: 1;
    min-width: 0;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--phoenix-body-color, #141824);
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dock-panel-title-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    background: var(--phoenix-danger, #fa3b1d);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: 999px;
    line-height: 1;
}
.dock-panel-title-badge.is-zero { display: none; }

.dock-panel-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.dock-panel-act-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    background: transparent;
    border-radius: 6px;
    color: var(--phoenix-body-tertiary-color, #525b75);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}
.dock-panel-act-btn:hover {
    background: var(--phoenix-body-highlight-bg, #f5f7fa);
    color: var(--phoenix-body-color, #141824);
}

/* ── 본문 (iframe 영역) ────────────────────────────────────────── */
.dock-panel-body {
    flex: 1;
    min-height: 0;
    position: relative;
    background: #fff;
    overflow: hidden;
}
.dock-panel-body iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}
.dock-panel-body.is-loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.7) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><circle cx="16" cy="16" r="12" fill="none" stroke="%233874ff" stroke-width="3" stroke-linecap="round" stroke-dasharray="50 30"><animateTransform attributeName="transform" type="rotate" from="0 16 16" to="360 16 16" dur="0.8s" repeatCount="indefinite"/></circle></svg>') center center no-repeat;
    background-size: 32px 32px;
    z-index: 1;
}

/* ── 닫혔을 때 토글 버튼 (우측 하단 floating — Phoenix support-chat 스타일) ── */
.dock-panel-toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0;
    width: 56px;
    height: 56px;
    background: var(--phoenix-primary, #3874ff);
    color: #fff;
    border: 0;
    border-radius: 50%;
    box-shadow: 0 6px 20px rgba(56, 116, 255, 0.32);
    cursor: pointer;
    font-size: 22px;
    font-weight: 700;
    pointer-events: auto;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    overflow: visible;
}
.dock-panel-toggle:hover {
    background: #2862e8;
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(56, 116, 255, 0.42);
}
.dock-panel-toggle .dock-panel-toggle-label {
    display: none;
}
.dock-panel-toggle-ic {
    font-size: 22px;
    line-height: 1;
    color: #fff;
}
.dock-panel-toggle .dock-panel-toggle-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--phoenix-danger, #fa3b1d);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    line-height: 1;
    border: 2px solid #fff;
}
.dock-panel-toggle .dock-panel-toggle-badge.is-zero { display: none; }

/* 닫힘 상태에서만 toggle 표시 */
.dock-panel-container:not(.is-open) .dock-panel-toggle { display: flex; }
.dock-panel-container.is-open .dock-panel-toggle { display: none; }

/* ── 리사이즈 중 (body 전체 cursor + 텍스트 선택 막기) ──────────── */
body.dock-panel-resizing,
body.dock-panel-resizing * {
    cursor: ew-resize !important;
    user-select: none !important;
}

/* ── 반응형 — 좁은 화면 (모바일) 에서 floating 카드 폭 좁힘 ── */
@media (max-width: 575.98px) {
    .dock-panel {
        right: 12px;
        bottom: 12px;
        width: calc(100vw - 24px);
        height: calc(100vh - 80px);
        max-width: none;
    }
    .dock-panel-toggle {
        right: 16px;
        bottom: 16px;
    }
}
