/* table-container의 overflow:hidden이 차트를 자르지 않도록 오버라이드 */
.table-container {
    overflow: visible !important;
}

/* 대신 border-radius 클리핑은 thead에서 처리 */
.table-container table {
    border-radius: 8px;
    overflow: hidden;
}

/* ══════════════════════════════════════════════════
   Chart Panel - 테이블 인라인 행 확장
══════════════════════════════════════════════════ */

tbody tr[data-symbol] {
    cursor: pointer;
}

tbody tr[data-symbol].chart-selected td {
    background: rgba(57, 208, 216, 0.06);
    border-bottom: none;
}

tbody tr[data-symbol].chart-selected td:first-child {
    box-shadow: inset 2px 0 0 #39d0d8;
}

/* ══════════════════════════════════════════════════
   확장 행
   ★ 핵심 전략:
   td는 display:contents → 자신은 box를 생성하지 않음
   → nth-child width 규칙도, colspan도 모두 무의미해짐
   → 내부의 .chart-inline-panel이 tr 자식처럼 올라와
      tr의 전체 너비를 그대로 사용
══════════════════════════════════════════════════ */

tr.chart-expand-row td {
    display: contents;
}

tr.chart-expand-row .chart-inline-panel {
    /* display:contents 덕에 tr의 직접 자식처럼 동작
       grid/flex가 아닌 일반 flow이므로 width:100% = tr 너비 */
    display: block;
    width: 100%;
    border-bottom: 2px solid #39d0d8;
    background: #0d1117;
    box-sizing: border-box;
}

/* 애니메이션 래퍼 */
.chart-inline-panel {
    width: 100%;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-inline-panel.open {
    max-height: 380px;
    overflow: visible;
}

/* 헤더 */
.chart-inline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #131722;
    border-bottom: 1px solid #1e2a38;
    height: 52px;
    box-sizing: border-box;
}

.chart-inline-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-inline-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    background: #2a3441;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #e6edf3;
    flex-shrink: 0;
}

.chart-inline-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chart-inline-name {
    font-size: 14px;
    font-weight: 700;
    color: #e6edf3;
}

.chart-inline-symbol {
    font-size: 11px;
    color: #636e7c;
    margin-left: 4px;
}

.chart-inline-premium {
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.chart-inline-premium.high    { background: rgba(63,185,80,0.15);  color: #3fb950; display: none; }
.chart-inline-premium.low     { background: rgba(248,81,73,0.15);  color: #f85149; }
.chart-inline-premium.neutral { background: rgba(139,149,168,0.1); color: #8b95a8; }

/* 탭 */
.chart-inline-tabs {
    display: flex;
    gap: 3px;
    background: #0d1117;
    border-radius: 6px;
    padding: 3px;
}

.chart-inline-tab {
    padding: 4px 14px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    color: #636e7c;
}

.chart-inline-tab.active {
    background: #1c2333;
    color: #39d0d8;
}

.chart-inline-tab:hover:not(.active) {
    color: #8b95a8;
}

/* 닫기 */
.chart-inline-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #1c2333;
    border-radius: 50%;
    cursor: pointer;
    color: #636e7c;
    transition: all 0.2s;
    margin-left: 8px;
    flex-shrink: 0;
}

.chart-inline-close:hover {
    background: #2a3441;
    color: #e6edf3;
}

.chart-inline-close svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
    display: block;
}

/* 차트 영역 */
.chart-inline-body {
    position: relative;
    width: 100%;
    height: 320px;
    min-height: 320px;
    background: #131722;
    display: block;
}

.chart-inline-body > div,
.chart-inline-body iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: none;
}

/* 로딩 */
.chart-inline-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #131722;
    z-index: 2;
}

.chart-inline-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #2a3441;
    border-top-color: #39d0d8;
    border-radius: 50%;
    animation: cpSpin 0.75s linear infinite;
}

.chart-inline-loading span {
    font-size: 12px;
    color: #636e7c;
}

@keyframes cpSpin {
    to { transform: rotate(360deg); }
}

/* 모바일 */
@media (max-width: 768px) {
    .chart-inline-panel.open { max-height: 460px; overflow: visible; }
    .chart-inline-body       { height: 400px; min-height: 400px; }
    .chart-inline-header     { padding: 8px 10px; flex-wrap: wrap; gap: 6px; height: auto; }
    .chart-inline-tab        { padding: 3px 10px; font-size: 11px; }
    .chart-inline-name       { font-size: 13px; }
}

@media (max-width: 480px) {
    .chart-inline-panel.open { max-height: 400px; overflow: visible; }
    .chart-inline-body       { height: 345px; min-height: 345px; }
}
