:root {
    --bg-color: #131722;
    --panel-color: #1e222d;
    --text-primary: #d1d4dc;
    --text-secondary: #8c92a2;
    --border-color: #2a2e39;
    --price-up: #089981; /* BUY color */
    --price-down: #f23645; /* SELL color */
    --accent-color: #f7a600; /* Bybit yellow/orange for Entry/My orders */
    --buy: #089981; /* Alias for price-up */
    --sell: #f23645; /* Alias for price-down */
    --muted: #5e6673; /* For muted text */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Added to space out elements */
    padding: 0 20px;
    height: 50px;
    background-color: var(--panel-color);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-weight: bold;
    font-size: 20px;
    margin-right: 20px; /* Added margin to separate from other info */
}

.header-info {
    display: flex;
    align-items: center;
    gap: 20px; /* Space between balance and ticker */
}

#balance-display {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-primary);
}

.ticker-info {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px; /* Space between symbol and price */
}

/* Specific colors for bid/ask */
#bid-price {
    color: var(--price-down); /* Traditionally red for bid */
    font-weight: bold;
}

#ask-price {
    color: var(--price-up); /* Traditionally green for ask */
    font-weight: bold;
}

.price-up {
    color: var(--price-up);
}

.price-down {
    color: var(--price-down);
}

.trading-layout {
    display: flex;
    padding: 15px;
    gap: 15px;
}

.layout-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.panel-trading {
    flex: 1;
}

.panel-data {
    flex: 2;
}

.panel {
    background-color: var(--panel-color);
    border-radius: 4px;
    overflow: hidden;
}

.panel-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
}

.panel-header h3 {
    margin: 0;
}

#order-form {
    padding: 15px;
}

.tabs {
    display: flex;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.tab-btn:first-child {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

.tab-btn:last-child {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    border-left: 0;
}

.tab-btn.active {
    background-color: var(--accent-color);
    color: var(--text-primary);
    border-color: var(--accent-color);
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 12px;
}

.input-group input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 4px;
    font-size: 14px;
}

.buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

#buy-btn, #sell-btn {
    padding: 12px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    color: white;
    transition: filter 0.2s ease;
}

#buy-btn {
    background-color: var(--price-up);
}

#sell-btn {
    background-color: var(--price-down);
}

#buy-btn:hover, #sell-btn:hover {
    filter: brightness(1.2);
}

.table-container {
    max-height: 250px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

th {
    color: var(--text-secondary);
    font-weight: normal;
    text-transform: uppercase;
    font-size: 11px;
}

tbody tr:last-child td {
    border-bottom: none;
}

.cancel-btn, .close-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

/* Order Book and Tape specific styles */
.ob-wrap{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}

.ob-table{
  width:100%;
  border-collapse:collapse;
  font-size:12px;
}

.ob-table th, .ob-table td{
  padding:6px 8px;
  border-bottom:1px solid var(--border-color); /* Use general border color */
  text-align:right;
}

.ob-row{
  cursor:pointer;
}

.ob-row:hover{
  background: rgba(255,255,255,0.04);
}

.ob-own{
  outline: 1px solid rgba(247,166,0,0.55); /* Bybit accent yellow/orange */
  background: rgba(247,166,0,0.10);
}

.ob-ask{
  color: var(--sell);
}

.ob-bid{
  color: var(--buy);
}

.muted{
  color: var(--muted);
}

/* Depth bar (잔량 막대) */
.ob-cell{
  position: relative;
  overflow: hidden;
}

.ob-bar{
  position:absolute;
  top:0; bottom:0;
  width: var(--w, 0%);
  opacity: 0.18;
  pointer-events:none;
}

.ob-bar.ask{ right:0; background: var(--sell); }
.ob-bar.bid{ left:0;  background: var(--buy);  }

.ob-text{
  position: relative;
  z-index: 1;
}

/* 내 주문 뱃지 */
.ob-badge{
  display:inline-block;
  margin-left:6px;
  padding:1px 6px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.6;
  background: rgba(247,166,0,0.15);
  color: var(--accent-color); /* Use general accent color */
  border: 1px solid rgba(247,166,0,0.35);
}

/* 체결/업데이트 깜빡임 */
 @keyframes flashUp { 0%{background: rgba(14,203,129,.22);} 100%{background: transparent;} }
 @keyframes flashDn { 0%{background: rgba(246,70,93,.22);} 100%{background: transparent;} }

.flash-up{ animation: flashUp 450ms ease-out; }
.flash-dn{ animation: flashDn 450ms ease-out; }


/* Chart specific styles */
.line-tag{
  position:absolute;
  right:10px;
  transform: translateY(-50%);
  font-size:12px;
  padding:3px 8px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.35);
  pointer-events:none;
}
.line-tag.tp{ color: var(--buy); }
.line-tag.sl{ color: var(--sell); }
.line-tag.entry{ color: var(--accent-color); } /* Use accent color for consistency */

.dragging { cursor: ns-resize !important; }