/* Gemini Canvas 스타일링 - Surgical Parity */

#canvas-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 50%;
    height: 100vh;
    background: #1e1e1e; /* 코드 모드 기본 배경 */
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
    overflow: hidden; /* 절대 위치 자식 패널이 뷰포트에 노출되는 것 차단 */
}

#canvas-panel.active {
    transform: translateX(0);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}

.canvas-header {
    height: 64px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #2b2b2b;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.canvas-title {
    font-size: 1.1rem;
    color: #e0e0e0;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}

.canvas-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

#canvas-editor-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.document-editor {
    height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 32px 48px;
    background: #ffffff;
    color: #202124;
    font-size: 15px;
    line-height: 1.75;
    font-family: 'Google Sans', 'Noto Sans KR', sans-serif;
    outline: none;
}

.document-editor h1,
.document-editor h2,
.document-editor h3 {
    color: #202124;
    font-weight: 600;
    margin: 1.2em 0 0.4em;
    line-height: 1.3;
}

.document-editor h1 { font-size: 1.7rem; }
.document-editor h2 { font-size: 1.3rem; }
.document-editor h3 { font-size: 1.1rem; }

.document-editor p  { margin: 0.6em 0; color: #3c4043; }

.document-editor ul,
.document-editor ol {
    padding-left: 1.6em;
    margin: 0.5em 0;
    color: #3c4043;
}

.document-editor li { margin: 0.25em 0; }

.document-editor code {
    background: #f1f3f4;
    color: #c0392b;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Consolas', 'Monaco', monospace;
}

.document-editor blockquote {
    border-left: 3px solid #dadce0;
    margin: 0.8em 0;
    padding: 0.4em 1em;
    color: #5f6368;
}

.document-editor a { color: #1a73e8; text-decoration: none; }
.document-editor a:hover { text-decoration: underline; }

.document-editor hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 1.5em 0;
}

/* 문서 모드 스타일 (추후 전환 시 적용) */
#canvas-panel.document-mode {
    background: #ffffff;
}

#canvas-panel.document-mode .canvas-header {
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

#canvas-panel.document-mode .canvas-title {
    color: #202124;
}

/* 미리 보기 버튼 활성 상태 */
#canvas-preview-btn.active {
    color: #4b90ff;
    background: rgba(75, 144, 255, 0.12);
}

/* 미리 보기 영역 스타일 */
.canvas-preview {
    height: 45%;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    background: #fff;
}

/* ── 캔버스 카드 (채팅 내 인라인 카드) ────────────────────── */
.canvas-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin-top: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition-fast);
    max-width: 380px;
    user-select: none;
}

.canvas-card:hover {
    background: var(--card-hover);
    border-color: var(--accent-blue);
}

.canvas-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(75, 144, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent-blue);
}

.canvas-card-icon svg {
    width: 20px;
    height: 20px;
}

.canvas-card-body {
    flex: 1;
    min-width: 0;
}

.canvas-card-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.canvas-card-meta {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 3px;
}

.canvas-card-arrow {
    color: var(--text-dim);
    flex-shrink: 0;
    display: flex;
}

.canvas-card-arrow svg {
    width: 18px;
    height: 18px;
}

/* ── 문서 모드 플로팅 도구 모음 (FAB) ──────────────────── */
.canvas-doc-fab {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    z-index: 100;
    pointer-events: auto;
    animation: fab-in 0.2s cubic-bezier(0.2, 0, 0, 1);
}

@keyframes fab-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fab-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 18px;
    background: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    color: #3c4043;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06);
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
    white-space: nowrap;
    font-family: 'Google Sans', 'Noto Sans KR', sans-serif;
    user-select: none;
}

.fab-chip:hover {
    background: #f1f3f4;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16), 0 1px 4px rgba(0, 0, 0, 0.08);
}

.fab-chip:active { transform: scale(0.97); }

.fab-chip-arrow {
    font-size: 10px;
    opacity: 0.6;
    line-height: 1;
}

/* ── 슬라이더 팝업 공통 (어조 / 길이) ─────────────────── */
.canvas-tone-slider-popup {
    position: absolute;
    bottom: 140px;
    right: 24px;
    width: 280px;
    background: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.16), 0 1px 4px rgba(0, 0, 0, 0.08);
    padding: 16px 20px 12px;
    z-index: 101;
    animation: popup-in-fade 0.15s cubic-bezier(0.2, 0, 0, 1);
}

.tone-slider-track {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tone-slider-label {
    font-size: 11px;
    color: #5f6368;
    line-height: 1.35;
    text-align: center;
    flex-shrink: 0;
}

.tone-slider-bar {
    flex: 1;
    position: relative;
}

.tone-slider-bar input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: linear-gradient(to right, #1a73e8, #1a73e8);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.tone-slider-bar input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1a73e8;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: transform 0.1s;
}

.tone-slider-bar input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.tone-slider-ticks {
    display: flex;
    justify-content: space-between;
    padding: 0 2px;
    margin-top: 4px;
}

.tone-slider-ticks span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #dadce0;
    display: block;
}

.tone-slider-desc {
    text-align: center;
    font-size: 12px;
    color: #1a73e8;
    font-weight: 500;
    margin: 8px 0 0;
    letter-spacing: 0.01em;
}

/* 반응형 대응 */
@media (max-width: 1024px) {
    #canvas-panel {
        width: 100%;
    }
}
