/* 전체 페이지 레이아웃 및 폰트 설정 */
body { margin: 0; padding: 0; display: flex; height: 100vh; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; overflow: hidden; }

/* 좌측 사이드바 (종목 목록) 스타일 */
#sidebar { 
    width: 250px; 
    background: #f7f7f7;
    border-right: 1px solid #e0e0e0;
    display: flex; flex-direction: column; flex-shrink: 0; 
}

/* 사이드바 헤더 */
#sidebar-header { 
    padding: 10px 15px; 
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}
#scan-header-row1 { display: flex; align-items: center; gap: 5px; margin-bottom: 8px; }
#scan-header-row1 label { font-size: 12px; white-space: nowrap; }
#scan-header-row1 input { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid #ccc; border-radius: 4px; cursor: pointer; background-color: #fff; }
#scan-header-row1 button { padding: 5px 10px; font-size: 12px; background: #007bff; color: white; border: none; border-radius: 4px; cursor: pointer; white-space: nowrap; }
#scan-header-row1 button:hover { background: #0056b3; }
#scan-header-row1 button:disabled { background: #ccc; cursor: not-allowed; }
#scan-header-row2 select { width: 100%; padding: 5px; border: 1px solid #ccc; border-radius: 4px; }

/* 스캔 진행상황 표시 */
#scan-progress {
    padding: 10px 15px;
    font-size: 12px; color: #666;
    border-top: 1px solid #e0e0e0;
}

/* 예시: 스캔 중일 때 버튼 스타일 (회색) */
#scan-button.is-scanning {
    background-color: #808080; /* 회색 */
    color: white;
    /* 필요 시 border 등 다른 스타일 추가 */
}


/* 종목 목록 리스트 */
#watchlist { flex: 1; overflow-y: auto; list-style: none; padding: 0; margin: 0; }
#watchlist li { 
    padding: 12px 15px; cursor: pointer; 
    border-bottom: 1px solid #eee;
    font-size: 14px; 
}
#watchlist li:hover { background: #eef; }
#watchlist li.active { 
    background: #dbeafe;
    font-weight: bold; 
    color: #1e40af;
}

/* 메인 컨텐츠 영역 */
#main { flex: 1; display: flex; flex-direction: column; position: relative; min-width: 0; touch-action: none; }

/* 상단바 */
#topbar { 
    padding: 10px; 
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    display: flex; align-items: center; gap: 10px; 
}

/* 차트 및 툴바 래퍼 */
#content-wrapper { flex: 1; display: flex; min-height: 0; position: relative; touch-action: none;}

/* 좌측 그리기 도구 툴바 */
#toolbar { 
    width: 46px; 
    background: #fff;
    border-right: 1px solid #e0e0e0;
    display: flex; flex-direction: column; align-items: center; padding: 10px 0; gap: 8px; flex-shrink: 0; overflow-y: auto; 
}
#toolbar::-webkit-scrollbar { display: none; }

#toolbar button { 
    width: 36px; height: 36px; padding: 0; 
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer; border-radius: 4px; display: flex; justify-content: center; align-items: center; 
    font-size: 18px; 
    color: #555;
}
#toolbar button:hover { background: #f5f5f5; color: #000; }
#toolbar button.active { background: #e6f7ff; border-color: #1890ff; color: #1890ff; }

/* 차트 컨테이너 */
#chart-container { 
    flex: 1; position: relative; min-height: 0; overflow: hidden; 
    -webkit-user-select: none !important;
    user-select: none !important;
    touch-action: none !important; 
    -webkit-tap-highlight-color: transparent;
}
#chart-container canvas { touch-action: none !important; }

/* 로딩 메시지 */
.loading { 
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); 
    font-size: 14px; color: #666; display: none; 
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    body { flex-direction: column; }
    #sidebar { 
        width: 100%; height: 35%; 
        border-right: none; 
        border-bottom: 1px solid #e0e0e0;
    } 
    #main { height: 65%; }
    #watchlist li { padding: 15px; font-size: 16px; }
    #current-symbol { font-size: 14px; }
}

/* Flatpickr 커스텀 */
.flatpickr-day.flatpickr-disabled, 
.flatpickr-day.flatpickr-disabled:hover {
    color: #aaaaaa !important;
    opacity: 1 !important;
}
