/**
 * layout_overrides.css — AXIA Layout Foundation Rebuild OS
 * Phase 3+4+5: Absolute排除 / VH統一 / Overflow監査
 *
 * このファイルは style.css の問題箇所を上書きする。
 * layout_foundation.css の後に読み込む。
 * 将来的に style.css を整理した際は削除可能。
 */

/* ═══════════════════════════════════════════════════════════
   Phase 3: position:absolute / position:fixed 乱用排除
   ═══════════════════════════════════════════════════════════ */

/* input-area: position:fixed を完全廃止 */
.input-area {
  position: relative !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  z-index: 50 !important;
  width: 100% !important;
  flex-shrink: 0 !important;
}

/* モバイルでも fixed 禁止（layout_foundation.css の flex で管理） */
@media (max-width: 768px) {
  .chat-input-area,
  .input-area,
  #chatInputWrapper,
  .chat-input-wrapper {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    top: auto !important;
    z-index: 50 !important;
    margin: 0 !important;
    padding: 10px 12px 14px !important;
    pointer-events: auto !important;
  }
}

/* workspace-panel: PC でも fixed 廃止（flex子要素として配置） */
.workspace-panel,
#workspacePanel {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
}

/* workspace-open 時の input-area right 調整を廃止 */
.workspace-open .input-area {
  right: auto !important;
}

/* ═══════════════════════════════════════════════════════════
   Phase 4: height / VH 統一
   ═══════════════════════════════════════════════════════════ */

/* body の min-height:100vh を無効化（overflow:hidden で管理） */
html, body {
  min-height: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
}

/* app-wrapper の min-height:100vh を無効化 */
.app,
.app-wrapper {
  min-height: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
}

/* page-body / main-wrapper の 100vh を無効化 */
.page-body,
.main-wrapper {
  min-height: 0 !important;
  height: auto !important;
  overflow: visible !important;
}

/* calc(100vh - xxx) の乱用を無効化 */
.chat-area,
#chatArea {
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  flex: 1 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  /* padding-bottom: 160px を廃止 → CSS変数で管理 */
  padding-bottom: var(--input-area-height, 80px) !important;
}

/* ═══════════════════════════════════════════════════════════
   Phase 5: Overflow 監査・統一
   ═══════════════════════════════════════════════════════════ */

/* scroll可能なのは以下のみ */

/* 1. ChatScrollArea */
.chat-area,
#chatArea {
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* 2. Timeline内部 */
.uw-timeline,
.timeline-content,
.stream-log,
#streamLog {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  max-height: 200px;
}

/* 3. Files内部 */
.uw-files,
.files-content,
[class*="files-list"] {
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* 4. Thread Sidebar内部 */
.thread-list,
.sidebar-content {
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* それ以外は overflow:hidden */
.chat-layout,
.center-chat,
.main-content,
.workspace-panel,
#workspacePanel {
  overflow: hidden !important;
}

/* ═══════════════════════════════════════════════════════════
   scroll領域の多重化を防ぐ
   ═══════════════════════════════════════════════════════════ */

/* body scroll 完全禁止 */
body {
  overflow: hidden !important;
  overflow-y: hidden !important;
}

/* workspace全体scroll禁止 */
.workspace-panel,
#workspacePanel,
.unified-workspace-panel {
  overflow: hidden !important;
  overflow-y: hidden !important;
}

/* ═══════════════════════════════════════════════════════════
   chat-area の padding-bottom 修正
   （position:fixed の input-area を廃止したため不要になるが
     念のため小さめに設定）
   ═══════════════════════════════════════════════════════════ */

.chat-area,
#chatArea {
  padding-bottom: 16px !important;
}
