/* ==========================================================================
   KOSODO INVESTMENT – IBKR Institutional Quant Terminal
   Modular Stylesheet (styles.css)
   ========================================================================== */

:root {
  --tv-bg-main: #0b0e14;
  --tv-bg-panel: #131722;
  --tv-bg-elevated: #1e222d;
  --tv-border: #2a2e39;
  --tv-text-primary: #d1d4dc;
  --tv-text-muted: #787b86;
  --tv-accent-blue: #2962ff;
  --tv-accent-green: #089981;
  --tv-accent-red: #f23645;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--tv-bg-main);
  color: var(--tv-text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.font-mono,
.tabular-nums {
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
}

/* === TradingView 1px Hairline Grid Borders === */
.tv-border { border: 1px solid var(--tv-border); }
.tv-b-t { border-top: 1px solid var(--tv-border); }
.tv-b-b { border-bottom: 1px solid var(--tv-border); }
.tv-b-l { border-left: 1px solid var(--tv-border); }
.tv-b-r { border-right: 1px solid var(--tv-border); }

/* === Institutional Order Entry Buttons === */
.btn-tv-buy {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  border: 1px solid #34d399;
  color: #ffffff;
  transition: filter 0.15s ease, transform 0.1s ease;
}
.btn-tv-buy:hover { filter: brightness(1.08); }
.btn-tv-buy:active { transform: scale(0.99); }

.btn-tv-sell {
  background: linear-gradient(180deg, #f43f5e 0%, #e11d48 100%);
  border: 1px solid #fb7185;
  color: #ffffff;
  transition: filter 0.15s ease, transform 0.1s ease;
}
.btn-tv-sell:hover { filter: brightness(1.08); }
.btn-tv-sell:active { transform: scale(0.99); }

/* === Color Swatch Input === */
input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
  padding: 0;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch {
  border: 1px solid #2a2e39;
  border-radius: 4px;
}

/* === Minimal Dark Scrollbars === */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: #0b0e14; }
::-webkit-scrollbar-thumb { background: #2a2e39; }
::-webkit-scrollbar-thumb:hover { background: #434651; }

/* ==========================================================================
   iOS 26 / TradingView Liquid Glass Bottom Dock
   ========================================================================== */
.ios-frosted-dock {
  background: rgba(24, 28, 39, 0.78);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
}

.ios-frosted-dock button {
  position: relative;
  z-index: 2;
  color: #5f6874;
  transition: color 0.18s ease, transform 0.18s ease;
}

.ios-frosted-dock button:hover {
  color: #ffffff;
  background: radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.04) 60%, rgba(255, 255, 255, 0.12) 100%);
  backdrop-filter: blur(4px) brightness(1.3);
  -webkit-backdrop-filter: blur(4px) brightness(1.3);
  border-radius: 9999px;
  box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.65), inset 0 -1px 2px rgba(56, 189, 248, 0.40);
}

/* 單一圖示切換規則：未選中顯示空心圖示，選中只顯示實心圖示（消除上下雙圖示） */
.ios-frosted-dock button .dock-icon-solid,
.ios-frosted-dock button svg:nth-of-type(2) {
  display: none;
}

.ios-frosted-dock button.active .dock-icon-outline,
.ios-frosted-dock button.active svg:nth-of-type(1) {
  display: none;
}

.ios-frosted-dock button.active .dock-icon-solid,
.ios-frosted-dock button.active svg:nth-of-type(2) {
  display: block;
}

/* 選中狀態（Active）：底色全透明，只將圖示與文字點亮為亮藍白色 */
.ios-frosted-dock button.active {
  color: #38bdf8 !important;
  background: transparent !important;
  box-shadow: none !important;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.80);
}

/* 懸浮移動水滴放大鏡（極低不透明度，只做玻璃光圈折射） */
/* 純淨透明水滴玻璃鏡：中央全透明（0% 白底），只保留邊緣折射高光與微光暈 */
.liquid-glass-lens {
  position: absolute;
  z-index: 3;
  border-radius: 9999px;
  pointer-events: none;
  overflow: hidden;
  background: radial-gradient(
    ellipse at 32% 20%,
    rgba(255, 255, 255, 0.14) 0%,
    rgba(255, 255, 255, 0.00) 58%,
    rgba(56, 189, 248, 0.08) 100%
  ) !important;
  backdrop-filter: brightness(1.18) saturate(135%) !important;
  -webkit-backdrop-filter: brightness(1.18) saturate(135%) !important;
  border: 1px solid rgba(255, 255, 255, 0.45) !important;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.85),
    inset 0 -2px 3px rgba(56, 189, 248, 0.55),
    inset 1.5px 0 2px rgba(244, 114, 182, 0.35),
    inset -1.5px 0 2px rgba(52, 211, 153, 0.35),
    0 4px 12px rgba(0, 0, 0, 0.35) !important;
  transition:
    left 0.26s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.26s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.2s ease;
}

.liquid-glass-lens.visible {
  transform: scale(1.06);
}

/* ==================== EXECUTION BAR (T BAR) ==================== */
.exec-bar { display: flex !important; align-items: stretch !important; width: 100% !important; overflow: hidden; }
.exec-btn-sell { position: relative; flex: 1 1 0%; min-width: 0; background: #f23645; display: flex; align-items: center; justify-content: center; transition: background 0.15s; cursor: pointer; }
.exec-btn-sell:hover:not(:disabled) { background: #d92b3a; }
.exec-btn-buy { position: relative; flex: 1 1 0%; min-width: 0; background: #2962ff; display: flex; align-items: center; justify-content: center; transition: background 0.15s; cursor: pointer; }
.exec-btn-buy:hover:not(:disabled) { background: #1e53e5; }
.exec-btn-sell:disabled, .exec-btn-buy:disabled { opacity: 0.45; cursor: not-allowed; }
.exec-tag { position: absolute; top: 5px; left: 10px; font-size: 9px; opacity: 0.85; letter-spacing: 0.05em; pointer-events: none; font-weight: bold; }
.exec-price { display: flex; align-items: baseline; justify-content: center; pointer-events: none; }

/* ==================== RESIZE SPLITTER (拖拉線) ==================== */
.tv-splitter-h { 
  height: 4px; 
  width: 100%; 
  background-color: #1e222d; 
  cursor: ns-resize; 
  transition: background-color 0.2s; 
  flex-shrink: 0; 
  z-index: 10; 
}
.tv-splitter-h:hover, .tv-splitter-h.dragging { 
  background-color: #2962ff; 
}

/* 鎖定當前選中分頁（dock-active-tab）永遠保持純白圖示、純白文字與 Liquid Glass 光圈 */
#expandedFrostedDock button.dock-active-tab,
#expandedFrostedDock button.dock-active-tab span {
  color: #ffffff !important;
}

#expandedFrostedDock button.dock-active-tab {
  background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06) 70%) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), 0 4px 12px rgba(0, 0, 0, 0.35) !important;
}

#expandedFrostedDock button.dock-active-tab .dock-icon-outline {
  display: none !important;
}

#expandedFrostedDock button.dock-active-tab .dock-icon-solid {
  display: block !important;
  color: #ffffff !important;
}