/* 모바일 차트/호가 전환 탭 - PC에 영향 없음! */
.mobile-chart-orderbook-tabs {
    display: none; /* 기본적으로 숨김 */
}

/* 모바일에서만 표시 */
@media (max-width: 768px) {
    .mobile-chart-orderbook-tabs {
        display: flex;
        gap: 8px;
        padding: 8px 12px;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
    }
    
    .mobile-tab-btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 10px;
        background: var(--bg-tertiary);
        border: 1px solid var(--border-color);
        border-radius: 6px;
        color: var(--text-secondary);
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s;
    }
    
    .mobile-tab-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .mobile-tab-btn.active {
        background: var(--bg-hover);
        border-color: var(--color-brand);
        color: var(--color-brand);
    }
    
    .mobile-tab-btn:hover:not(.active) {
        background: var(--bg-hover);
    }
    
    /* 모바일에서 기본적으로 차트는 보이고, 호가창은 숨김 */
    .chart-container {
        display: block !important;
    }
    
    .orderbook-section {
        display: none !important;
    }
    
    /* 호가 버튼 클릭 시 - 차트 헤더, 컨트롤, 컨테이너만 숨김 */
    .chart-section[data-mobile-view="orderbook"] .chart-header,
    .chart-section[data-mobile-view="orderbook"] .chart-controls,
    .chart-section[data-mobile-view="orderbook"] .chart-container {
        display: none !important;
    }
    
    /* 호가 모드에서 차트 섹션은 탭만 표시 */
    .chart-section[data-mobile-view="orderbook"] {
        flex: 0 0 auto;
        min-height: auto;
        height: auto;
    }
    
    /* 모바일 탭을 헤더 바로 아래에 고정 */
    .chart-section[data-mobile-view="orderbook"] .mobile-chart-orderbook-tabs {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        z-index: 101;
        background: var(--bg-secondary);
    }
    
    /* 호가 모드에서 메인 컨테이너 조정 */
    .main-container:has(.chart-section[data-mobile-view="orderbook"]) {
        position: relative;
        height: calc(100vh - var(--header-height));
    }
    
    /* 호가창이 전체 화면을 사용하도록 */
    .chart-section[data-mobile-view="orderbook"] + .orderbook-section .orderbook {
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    /* 호가창 헤더 */
    .chart-section[data-mobile-view="orderbook"] + .orderbook-section .orderbook-header {
        flex-shrink: 0;
    }
    
    /* 호가창 컨텐츠가 남은 공간을 모두 사용 */
    .chart-section[data-mobile-view="orderbook"] + .orderbook-section .orderbook-content {
        flex: 1;
        height: auto;
        overflow: auto;
    }
    
    /* 모바일 탭을 헤더 바로 아래에 고정 */
    .chart-section[data-mobile-view="orderbook"] .mobile-chart-orderbook-tabs {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        z-index: 101;
        background: var(--bg-secondary);
    }
    
    /* 호가창을 탭 아래에 위치 */
    .chart-section[data-mobile-view="orderbook"] + .orderbook-section {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        top: calc(var(--header-height) + 52px); /* 헤더 + 탭 높이 */
        left: 0;
        right: 0;
        bottom: 56px; /* 바텀 네비게이션 높이 */
        width: 100%;
        margin: 0;
        border: none;
        background: var(--bg-primary);
        z-index: 100;
    }
}

/* PC에서는 기본 레이아웃 유지 */
@media (min-width: 769px) {
    .orderbook-section {
        display: block !important; /* PC에서는 항상 보임 */
    }
    
    .mobile-chart-orderbook-tabs {
        display: none !important; /* PC에서는 절대 안보임 */
    }
}

/* 모바일에서 차트 높이 보정 */
@media (max-width: 768px) {
    /* 차트 섹션 기본 설정 */
    .chart-section {
        display: flex;
        flex-direction: column;
        background: var(--bg-primary);
    }
    
    /* 차트 컨테이너 기본 설정 */
    .chart-container {
        flex: 1;
        background: var(--bg-primary);
        position: relative;
    }
    
    /* 차트 요소가 제대로 표시되도록 */
    #candlestick-chart {
        width: 100% !important;
        height: 100% !important;
        position: relative;
        background: var(--bg-primary);
    }
    
    /* 호가창 슬라이드로 이동했으므로 기본적으로 숨김 */
    .orderbook-section {
        display: none;
    }
}
