/* ModuloAI — "Clean" 밝은 테마 (조립 설명서 스타일)
   main.css 뒤에 불러오며, <body class="theme-clean"> 일 때만 적용된다. (main.css 는 그대로 = 어두운 테마)
   색은 변수로 모아 두었으니 여기 값만 바꾸면 전체 분위기가 바뀐다. */
body.theme-clean {
    --c-bg: #f5f2ea;          /* 화면 바탕(크림) */
    --c-panel: #ffffff;       /* 패널/카드 */
    --c-soft: #efece3;        /* 옅은 채움 */
    --c-line: #e4dfd2;        /* 경계선 */
    --c-text: #111111;
    --c-sub: #5f5b52;
    --c-mute: #8a8578;
    --c-ink: #111111;         /* 주 버튼(검정) */
    --c-accent: #ffd400;      /* 포인트(노랑) */
    --c-ok: #0f9d6e;
    --c-bad: #d92d20;
    --shadow: 0 1px 2px rgba(17, 17, 17, .06), 0 6px 18px rgba(17, 17, 17, .06);
    background: var(--c-bg);
    color: var(--c-text);
}
.theme-clean html, html:has(body.theme-clean) { background: #f5f2ea; }
.theme-clean #app-container { background: var(--c-bg); }
.theme-clean ::selection { background: var(--c-accent); color: #111; }

/* ---------- 상단 헤더 ---------- */
.theme-clean #top-header { background: var(--c-bg); border-bottom: 1px solid var(--c-line); }
.theme-clean .brand-title { color: var(--c-text); }
.theme-clean .brand-subtitle { color: var(--c-mute); }
.theme-clean .nav-item { color: var(--c-sub); border: 1px solid transparent; border-radius: 0; padding: 8px 12px; }
.theme-clean .nav-item:hover { color: var(--c-text); background: transparent; }
.theme-clean .nav-item.active { color: var(--c-text); background: transparent; border: 0; box-shadow: inset 0 -2px 0 var(--c-text); }
.theme-clean .header-actions .nav-item { border: 1px solid var(--c-line); border-radius: 999px; background: var(--c-panel); box-shadow: none; padding: 7px 14px; }
.theme-clean .header-actions .nav-item:hover { border-color: var(--c-text); }
.theme-clean .user-profile { background: var(--c-panel); border: 1px solid var(--c-line); color: var(--c-text); }

/* ---------- 좌측 파츠 트리 ---------- */
.theme-clean #left-sidebar { background: var(--c-panel); border-right: 1px solid var(--c-line); }
.theme-clean .sidebar-header { color: var(--c-sub); border-bottom: 1px solid var(--c-line); }
.theme-clean #grouping-level-select { background: var(--c-soft) !important; color: var(--c-text) !important; border: 1px solid var(--c-line) !important; border-radius: 8px !important; }
.theme-clean .sidebar-hide-btn, .theme-clean #sidebar-toggle { background: var(--c-panel); color: var(--c-sub); border-color: var(--c-line); }
.theme-clean .sidebar-hide-btn:hover, .theme-clean #sidebar-toggle:hover { color: var(--c-text); border-color: var(--c-text); }
.theme-clean .part-item { background: transparent; color: var(--c-sub); border-radius: 10px; }
.theme-clean .part-item:hover { background: var(--c-soft); color: var(--c-text); }
.theme-clean .part-item.selected { background: var(--c-accent) !important; color: #111 !important; border: 1px solid transparent; font-weight: 700; }
.theme-clean .part-item.faulty { background: #fee4e2 !important; color: var(--c-bad) !important; border: 1px solid #fda29b; }
.theme-clean .part-item.is-group { color: var(--c-text); background: var(--c-soft); }
.theme-clean .toggle-icon { color: var(--c-mute); }
.theme-clean .tree-child-group { border-left: 1px solid var(--c-line); }

/* ---------- 중앙 3D 뷰포트 ---------- */
.theme-clean #center-viewport-container { background: radial-gradient(circle at 50% 42%, #fffdf7 0%, #f5f2ea 62%, #ece8dc 100%); }
.theme-clean .viewport-search-box, .theme-clean .chip, .theme-clean #steering-ui, .theme-clean #dpad-ui {
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border: 1px solid var(--c-line); box-shadow: var(--shadow); color: var(--c-text);
}
.theme-clean .viewport-search-box { border-radius: 999px; }
.theme-clean .viewport-search-box input { color: var(--c-text); }
.theme-clean .viewport-search-box span { color: var(--c-mute) !important; }
.theme-clean .chip { color: var(--c-sub); border-radius: 999px; }
.theme-clean .chip:hover { background: var(--c-text); color: #fff; border-color: var(--c-text); }
.theme-clean .chip[style*="239, 68, 68"] { color: var(--c-bad) !important; border-color: #fda29b !important; }
.theme-clean .chip[style*="239, 68, 68"]:hover { background: var(--c-bad); color: #fff !important; }
.theme-clean #dpad-ui > div:first-child { color: var(--c-mute) !important; }
.theme-clean .dpad-btn { background: var(--c-soft); border: 1px solid var(--c-line); color: var(--c-text); }
.theme-clean .dpad-btn:hover { background: var(--c-text); color: #fff; }
.theme-clean #steering-ui input[type=range] { accent-color: #111 !important; }
.theme-clean #steering-angle-text { color: var(--c-text) !important; }

/* ---------- 3D 핫스팟 마커: 번호 원 + 마우스를 올리면 이름 ---------- */
.theme-clean .part-marker { gap: 0; }
.theme-clean .part-marker:hover { z-index: 60; }
.theme-clean .marker-badge {
    width: 24px; height: 24px; background: #fff; color: #111; border: 2px solid #111; font-size: 0; box-shadow: 0 1px 4px rgba(17, 17, 17, .25); position: relative;
}
.theme-clean .marker-badge::before { content: attr(data-n); font-size: 11px; font-weight: 800; line-height: 1; }
.theme-clean .part-marker:hover .marker-badge { transform: scale(1.15); background: var(--c-accent); }
.theme-clean .marker-label {
    position: absolute; left: 100%; top: 50%; transform: translate(6px, -50%); opacity: 0; pointer-events: none; transition: opacity .12s;
    background: #111; color: #fff; border: 0; border-radius: 8px; padding: 5px 10px; font-size: 11px; font-weight: 600; box-shadow: var(--shadow);
}
.theme-clean .part-marker:hover .marker-label { opacity: 1; }
.theme-clean .part-marker.marker-left .marker-label { left: auto; right: 100%; transform: translate(-6px, -50%); }

/* ---------- 우측 채팅 패널 ---------- */
.theme-clean #right-chat-drawer { background: var(--c-panel); border-left: 1px solid var(--c-line); box-shadow: none; }
.theme-clean .drawer-header { background: var(--c-panel); border-bottom: 1px solid var(--c-line); }
.theme-clean .drawer-title { color: var(--c-text); }
.theme-clean .drawer-title span { color: var(--c-text) !important; }
.theme-clean .drawer-header button { color: var(--c-sub) !important; }
.theme-clean .message-bubble { background: var(--c-soft); border: 0; color: var(--c-text); border-radius: 14px; }
.theme-clean .user .message-bubble { background: var(--c-ink); color: #fff; }
.theme-clean .user .avatar { background: var(--c-ink); }
.theme-clean .assistant .avatar { background: var(--c-accent); color: #111; }
.theme-clean .fault-badge { background: #fee4e2; color: var(--c-bad); border: 1px solid #fda29b; }
.theme-clean .chat-message [style*="e2e8f0"] { color: var(--c-text) !important; }
.theme-clean .chat-message [style*="94a3b8"] { color: var(--c-sub) !important; }
.theme-clean .btn { background: var(--c-panel); }
.theme-clean .btn-primary { background: var(--c-panel); border: 1px solid var(--c-line); color: var(--c-text); box-shadow: none; }
.theme-clean .btn-primary:hover { background: var(--c-ink); color: #fff; border-color: var(--c-ink); }
.theme-clean .chat-message button[onclick^="openRepairModal"] { background: var(--c-ink) !important; border-color: var(--c-ink) !important; color: #fff !important; border-radius: 999px !important; }
.theme-clean .drawer-footer { background: var(--c-panel); border-top: 1px solid var(--c-line); }
.theme-clean .prompt-input-box { background: var(--c-soft); border: 1px solid var(--c-line); border-radius: 999px; padding: 6px 8px 6px 14px; }
.theme-clean #prompt-textarea { color: var(--c-text); }
.theme-clean #mic-btn { color: var(--c-sub) !important; }
.theme-clean .send-btn, .theme-clean .guide-action-btn { background: var(--c-ink); color: #fff; border-radius: 999px; }
.theme-clean .send-btn:hover, .theme-clean .guide-action-btn:hover { background: #333; }

/* ---------- 로딩 / 퀵서치 ---------- */
.theme-clean #loading-overlay { background: rgba(245, 242, 234, .92); }
.theme-clean #loading-title { color: var(--c-text) !important; }
.theme-clean #loading-status { color: var(--c-sub); }
.theme-clean .spinner { border-color: rgba(17, 17, 17, .12); border-top-color: #111; }
.theme-clean .progress-container { background: rgba(17, 17, 17, .1); }
.theme-clean .progress-bar { background: #111; }
.theme-clean #quick-search-overlay { background: rgba(245, 242, 234, .85); }
.theme-clean .qs-container { background: var(--c-panel); border: 1px solid var(--c-line); box-shadow: var(--shadow); }
.theme-clean .qs-header { border-bottom: 1px solid var(--c-line); }
.theme-clean .qs-title { color: var(--c-text); }
.theme-clean .qs-title svg { stroke: #111; }
.theme-clean .qs-close-btn { color: var(--c-sub); }
.theme-clean .qs-close-btn:hover { color: var(--c-text); background: var(--c-soft); }
.theme-clean .qs-group-title { color: var(--c-sub); }
.theme-clean .qs-card { background: var(--c-panel); border: 1px solid var(--c-line); color: var(--c-sub); }
.theme-clean .qs-card:hover { background: var(--c-soft); color: var(--c-text); border-color: var(--c-text); }
.theme-clean .qs-card.active { background: var(--c-ink); border-color: var(--c-ink); color: #fff; }
.theme-clean .qs-submit-btn { background: var(--c-ink); color: #fff; }
.theme-clean .qs-submit-btn:hover { background: #333; }

/* ---------- 상세(부품) 팝업 ---------- */
.theme-clean #detail-modal { background: rgba(245, 242, 234, .88) !important; }
.theme-clean #detail-modal > div { background: var(--c-panel) !important; border: 1px solid var(--c-line) !important; box-shadow: var(--shadow); }
.theme-clean #detail-modal [style*="#0b0d12"] { background: var(--c-soft) !important; }
.theme-clean #detail-modal [style*="#12151e"] { background: var(--c-panel) !important; border-color: var(--c-line) !important; }
.theme-clean #detail-modal [style*="color: #fff"], .theme-clean #modal-title, .theme-clean #slide-title { color: var(--c-text) !important; }
.theme-clean #detail-modal [style*="94a3b8"], .theme-clean #detail-modal [style*="cbd5e1"] { color: var(--c-sub) !important; }
.theme-clean #detail-modal [style*="rgba(255,255,255,0.08)"] { border-color: var(--c-line) !important; }
.theme-clean .detail-thumb { background: var(--c-soft); }
.theme-clean .detail-part-row { background: var(--c-panel); border: 1px solid var(--c-line); }
.theme-clean .detail-part-row:hover { background: var(--c-soft); }
.theme-clean .detail-part-row.selected { background: var(--c-accent); border-color: var(--c-accent); color: #111; }
.theme-clean .detail-part-id { color: var(--c-text); }
.theme-clean .detail-part-row.selected .detail-part-id { color: #111; }
.theme-clean .anim-chip-btn { background: var(--c-panel); color: var(--c-sub); border: 1px solid var(--c-line); border-radius: 999px; }
.theme-clean .anim-chip-btn:hover { background: var(--c-soft); color: var(--c-text); }
.theme-clean .anim-chip-btn.active { background: var(--c-ink); color: #fff; border-color: var(--c-ink); }
.theme-clean .detail-tab { color: var(--c-sub); }
.theme-clean .detail-tab.active { color: var(--c-text); border-bottom-color: var(--c-text); }
.theme-clean #slide-text { color: var(--c-sub); }

/* ---------- 정비 가이드(/repair) 팝업 틀 ---------- */
.theme-clean #repair-modal { background: rgba(245, 242, 234, .88) !important; }
.theme-clean #repair-modal > div { background: var(--c-panel) !important; border: 1px solid var(--c-line) !important; box-shadow: var(--shadow); }

/* ---------- 스크롤바 ---------- */
.theme-clean ::-webkit-scrollbar-thumb { background: rgba(17, 17, 17, .18); }

/* ---------- 테마 전환 버튼 (두 테마 공통) ---------- */
#theme-toggle { width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: 50% !important; font-size: 15px; line-height: 1; }
