/* static/css/components/splitter.css
 * Splitter Design v2 — Iteration 5 "Interactive Delight"
 *
 * 設計原則：
 *   靜止：透明背景 + 低調膠囊手柄（隱而不失）
 *   Hover：暖橘光暈漸現 + 膠囊展開變亮
 *   拖動：品牌橘全亮 + glow 光暈
 *   放開：0.25s ease-out 平滑回歸
 *
 * 動畫曲線：cubic-bezier(0.4, 0, 0.2, 1)（Material Standard）
 */

/* ============================================================================
   Vertical Splitter — 上下分割（報價表格 vs 走勢圖）
   ============================================================================ */
.vertical-splitter {
    height: 6px;
    background: transparent;
    cursor: row-resize;
    position: relative;
    flex-shrink: 0;
    z-index: 10;
    border-top: 1px solid var(--color-border-subtle, rgba(0,0,0,0.06));
    border-bottom: 1px solid var(--color-border-subtle, rgba(0,0,0,0.06));
    transition:
        background 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 膠囊形手柄（取代三線 grip） */
.vertical-splitter::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 4px;
    background: var(--color-text-muted, #A8A29E);
    border-radius: 2px;
    opacity: 0.35;
    transition:
        width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        background 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover：暖橘光暈 + 膠囊展開 */
.vertical-splitter:hover {
    background: radial-gradient(
        ellipse 60px 100% at center,
        rgba(249, 115, 22, 0.07) 0%,
        transparent 70%
    );
    border-color: var(--color-border-default, #E8E5E0);
}

.vertical-splitter:hover::before {
    width: 48px;
    opacity: 0.7;
    background: var(--color-secondary, #78716C);
}

/* 拖動中：品牌橘全亮 + glow */
.vertical-splitter.dragging {
    background: radial-gradient(
        ellipse 90px 100% at center,
        rgba(249, 115, 22, 0.12) 0%,
        transparent 70%
    );
    border-color: var(--color-border-default, #E8E5E0);
}

.vertical-splitter.dragging::before {
    width: 48px;
    opacity: 1;
    background: var(--color-accent, #F97316);
    box-shadow: 0 0 8px rgba(249, 115, 22, 0.3);
}

/* Dark Mode 加強 */
[data-theme="dark"] .vertical-splitter {
    border-top-color: rgba(255, 255, 255, 0.04);
    border-bottom-color: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .vertical-splitter::before {
    opacity: 0.3;
}

[data-theme="dark"] .vertical-splitter:hover {
    background: radial-gradient(
        ellipse 60px 100% at center,
        rgba(249, 115, 22, 0.10) 0%,
        transparent 70%
    );
}

[data-theme="dark"] .vertical-splitter:hover::before {
    opacity: 0.65;
}

[data-theme="dark"] .vertical-splitter.dragging {
    background: radial-gradient(
        ellipse 90px 100% at center,
        rgba(251, 146, 60, 0.18) 0%,
        transparent 70%
    );
}

[data-theme="dark"] .vertical-splitter.dragging::before {
    background: var(--color-accent, #FB923C);
    box-shadow: 0 0 12px rgba(251, 146, 60, 0.4);
}

/* ============================================================================
   Splitter Handle 內部結構（保留 DOM 相容性）
   ============================================================================ */
.splitter-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;  /* 點擊穿透到 splitter 本體 */
}

.splitter-line {
    display: none;  /* 由 ::before 膠囊取代 */
}

/* ============================================================================
   拖動覆蓋層 + 比例標籤
   ============================================================================ */
.splitter-drag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.05);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

[data-theme="dark"] .splitter-drag-overlay {
    background-color: rgba(0, 0, 0, 0.15);
}

.drag-label {
    background-color: var(--color-bg-elevated, #FFFFFF);
    color: var(--color-text-primary, #1C1917);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', system-ui, sans-serif;
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.12));
    border: 1px solid var(--color-border-default, #E8E5E0);
}

[data-theme="dark"] .drag-label {
    background-color: var(--color-bg-tertiary, #292524);
    border-color: var(--color-border-strong, rgba(255,255,255,0.16));
}

/* ============================================================================
   Horizontal Splitter — 左右分割（聊天區 vs 右側面板）
   ============================================================================ */
.horizontal-splitter,
.resize-handle.horizontal-splitter {
    cursor: col-resize;
    position: absolute;
    top: 0;
    bottom: 0;
    background: transparent;
    border-left: 1px solid var(--color-border-subtle, rgba(0,0,0,0.06));
    box-shadow: none;
    transition:
        background 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 膠囊形手柄（垂直方向） */
.horizontal-splitter::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 40px;
    background: var(--color-text-muted, #A8A29E);
    border-radius: 2px;
    opacity: 0.35;
    transition:
        height 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        background 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover：暖橘光暈 + 膠囊展開 */
.horizontal-splitter:hover,
.resize-handle.horizontal-splitter:hover {
    background: radial-gradient(
        ellipse 100% 60px at center,
        rgba(249, 115, 22, 0.07) 0%,
        transparent 70%
    );
    border-left-color: var(--color-border-default, #E8E5E0);
}

.horizontal-splitter:hover::before {
    height: 48px;
    opacity: 0.7;
    background: var(--color-secondary, #78716C);
}

/* 拖動中：品牌橘全亮 + glow */
.horizontal-splitter.dragging,
.resize-handle.horizontal-splitter.dragging {
    background: radial-gradient(
        ellipse 100% 90px at center,
        rgba(249, 115, 22, 0.12) 0%,
        transparent 70%
    );
    border-left-color: var(--color-border-default, #E8E5E0);
}

.horizontal-splitter.dragging::before {
    height: 48px;
    opacity: 1;
    background: var(--color-accent, #F97316);
    box-shadow: 0 0 8px rgba(249, 115, 22, 0.3);
}

/* Dark Mode 加強 */
[data-theme="dark"] .horizontal-splitter,
[data-theme="dark"] .resize-handle.horizontal-splitter {
    border-left-color: rgba(255, 255, 255, 0.04);
    box-shadow: none;
}

[data-theme="dark"] .horizontal-splitter::before {
    opacity: 0.3;
}

[data-theme="dark"] .horizontal-splitter:hover,
[data-theme="dark"] .resize-handle.horizontal-splitter:hover {
    background: radial-gradient(
        ellipse 100% 60px at center,
        rgba(249, 115, 22, 0.10) 0%,
        transparent 70%
    );
}

[data-theme="dark"] .horizontal-splitter:hover::before {
    opacity: 0.65;
}

[data-theme="dark"] .horizontal-splitter.dragging,
[data-theme="dark"] .resize-handle.horizontal-splitter.dragging {
    background: radial-gradient(
        ellipse 100% 90px at center,
        rgba(251, 146, 60, 0.18) 0%,
        transparent 70%
    );
}

[data-theme="dark"] .horizontal-splitter.dragging::before {
    background: var(--color-accent, #FB923C);
    box-shadow: 0 0 12px rgba(251, 146, 60, 0.4);
}

/* ============================================================================
   拖動中的全域游標
   ============================================================================ */
body.resizing {
    cursor: col-resize !important;
    user-select: none;
}

/* ============================================================================
   Panel 基礎樣式
   ============================================================================ */
.split-view-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.top-panel,
.bottom-panel {
    overflow: auto;
}

.top-panel {
    flex: 0.4 0 0;
    min-height: 200px;
}

.bottom-panel {
    flex: 0.6 0 0;
    min-height: 300px;
}
