/* HTML Table 기반 주식 테이블 스타일 (페이지네이션 제거 버전) */

.table-container {
    overflow-x: auto;
    width: 100%;
    min-width: 0;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.stock-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    min-width: 600px;
    border: none !important;
    outline: none !important;
}

/* 기본 셀 스타일 (완전 보더리스) */
.stock-table th,
.stock-table td {
    text-align: center;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    white-space: nowrap;
    vertical-align: middle;
    padding: 12px 8px;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* 헤더 스타일 (완전 보더리스) */
.stock-table th {
    background-color: var(--bg-header);
    color: var(--text-primary);
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 16px 8px;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Sticky 컬럼 공통 스타일 (완전 보더리스) */
.sticky-col {
    position: sticky;
    z-index: 4;
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Sticky 컬럼 zebra 스타일 */
tr.row-2 .sticky-col {
    background-color: var(--bg-secondary) !important;
}

/* 헤더의 Sticky 컬럼 (완전 보더리스) */
.stock-table th.sticky-col {
    background-color: var(--bg-header) !important;
    color: var(--text-primary) !important;
    z-index: 5;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* 번호 컬럼 - 첫 번째 고정 */
.sticky-number {
    left: 0;
    min-width: 40px;
    width: 40px;
}

/* 티커 컬럼 - 두 번째 고정 */
.sticky-ticker {
    left: 40px;
    min-width: 80px;
    width: 80px;
}

/* 두 번째 행 배경 */
.row-2 td {
    background-color: var(--bg-secondary);
}

/* 행 호버 상태 */
.stock-table tr.row-hover td {
    background-color: var(--row-hover) !important;
}

/* 토글 가능한 컬럼들 기본 스타일 */
.toggle-col {
    min-width: 80px;
}

/* 티커 아이콘 시스템 */
.company-info {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-start;
}

.company-logo {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #76b900, #9dd600);
    flex-shrink: 0;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.company-logo .logo-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.company-logo img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    z-index: 2;
}

.company-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50px;
    color: var(--text-primary);
}

/* 숫자 컬럼 우측 정렬 */
.stock-table th[data-column="price"],
.stock-table th[data-column="change"],
.stock-table th[data-column="rsi"],
.stock-table th[data-column="bollinger"],
.stock-table th[data-column="macd1"],
.stock-table th[data-column="macd2"],
.stock-table th[data-column="ema20"],
.stock-table th[data-column="ema50"],
.stock-table th[data-column="ema200"],
.stock-table th[data-column="dividend"],
.stock-table th[data-column="marketcap"],
.stock-table td[data-column="price"],
.stock-table td[data-column="change"],
.stock-table td[data-column="rsi"],
.stock-table td[data-column="bollinger"],
.stock-table td[data-column="macd1"],
.stock-table td[data-column="macd2"],
.stock-table td[data-column="ema20"],
.stock-table td[data-column="ema50"],
.stock-table td[data-column="ema200"],
.stock-table td[data-column="dividend"],
.stock-table td[data-column="marketcap"] {
    text-align: right;
}

/* 티커 셀과 설명 셀 좌측 정렬 */
.stock-table td[data-column="ticker"],
.stock-table td[data-column="description"] {
    text-align: left;
}

/* 정렬 가능한 헤더 스타일 */
.sortable-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.sortable-header:hover {
    background-color: var(--bg-secondary) !important;
}

/* 정렬 표시기 스타일 */
.sort-indicator {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 4px;
    display: inline-block;
    min-width: 12px;
    text-align: center;
}

.sortable-header:hover .sort-indicator {
    color: var(--text-primary);
}

/* 스크롤바 스타일링 */
.table-container::-webkit-scrollbar {
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* 색상 클래스 - theme.css 변수 사용 */
.change-positive {
    color: var(--green) !important;
    font-weight: 500;
}

.change-negative {
    color: var(--red) !important;
    font-weight: 500;
}

.change-neutral {
    color: var(--text-primary) !important;
    font-weight: 500;
}

/* 추가: 테이블 전체 텍스트 색상 강제 지정 */
.table-container,
.table-container * {
    color: var(--text-primary);
}

/* 추가: 모든 보더와 아웃라인 완전 제거 */
.table-container,
.table-container *,
.stock-table,
.stock-table *,
.stock-table thead,
.stock-table tbody,
.stock-table tr,
.stock-table th,
.stock-table td {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* 특별히 문제되는 첫 번째, 두 번째 컬럼 강화 */
.sticky-number,
.sticky-ticker,
.stock-table th.sticky-number,
.stock-table th.sticky-ticker,
.stock-table td.sticky-number,
.stock-table td.sticky-ticker {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    border-left: none !important;
    border-right: none !important;
}

/* 모바일 (0-479px) */
@media (max-width: 479px) {
    .stock-table th,
    .stock-table td {
        padding: 8px 6px;
        font-size: 11px;
        min-height: 40px;
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
    }
    
    .stock-table th {
        padding: 14px 6px;
        min-height: 46px;
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
    }
    
    .company-info {
        gap: 6px;
    }
    
    .company-logo {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
    
    .stock-table [data-column="macd1"], 
    .stock-table [data-column="macd2"],
    .stock-table [data-column="ema20"],
    .stock-table [data-column="ema50"],
    .stock-table [data-column="ema200"] {
        min-width: 120px;
    }
    
    /* 모바일 sticky 컬럼 보더 제거 */
    .sticky-col,
    .sticky-number,
    .sticky-ticker,
    .stock-table th.sticky-col,
    .stock-table td.sticky-col {
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
        border-left: none !important;
        border-right: none !important;
    }
    
    /* 모바일 브라우저 추가 대응 */
    .table-container,
    .table-container *,
    .stock-table,
    .stock-table * {
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
        -webkit-border-radius: 0 !important;
        -moz-border-radius: 0 !important;
        border-radius: 0 !important;
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
        -webkit-box-shadow: none !important;
        -moz-box-shadow: none !important;
    }
	/* 아이콘과 CROSS 박스는 라운딩 유지 */
		.company-logo,
		.company-logo img,
		.stock-table td span[style*="background:"],
		.stock-table td span[style*="border-radius"] {
		    border-radius: 4px !important;
	}
    
    /* 모바일 터치 시 나타나는 하이라이트 제거 */
    .stock-table th,
    .stock-table td {
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        -moz-user-select: none !important;
        -ms-user-select: none !important;
        user-select: none !important;
    }
}

/* 데스크톱 (800px+) */
@media (min-width: 800px) {
    .stock-table th,
    .stock-table td {
        padding: 8px 6px;
        font-size: 14px;
        min-height: 40px;
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
    }
    
    .stock-table th {
        padding: 14px 6px;
        min-height: 46px;
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
    }
    
    .sticky-number {
        min-width: 40px;
        width: 40px;
    }
    
    .sticky-ticker {
        left: 40px;
        min-width: 80px;
        width: 80px;
    }
    
    .toggle-col {
        min-width: 80px;
    }
    
    .company-info {
        gap: 6px;
    }
    
    .company-logo {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
    
    .company-name {
        max-width: 50px;
    }
    
    .stock-table [data-column="macd1"], 
    .stock-table [data-column="macd2"],
    .stock-table [data-column="ema20"],
    .stock-table [data-column="ema50"],
    .stock-table [data-column="ema200"] {
        min-width: 120px;
    }
    
    /* 데스크톱 sticky 컬럼 보더 제거 */
    .sticky-col,
    .sticky-number,
    .sticky-ticker,
    .stock-table th.sticky-col,
    .stock-table td.sticky-col {
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
        border-left: none !important;
        border-right: none !important;
    }
}

/* 테이블 로딩 상태 (옵션) */
.table-container.loading {
    opacity: 0.7;
    pointer-events: none;
}

.table-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
    z-index: 10;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 테이블 에러 상태 (옵션) */
.table-container.error {
    background: var(--bg-secondary);
    border: 1px solid var(--red);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: var(--red);
}

.table-container.error h3 {
    margin: 0 0 10px 0;
    color: var(--red);
}

.table-container.error p {
    margin: 0;
    color: var(--text-secondary);
}

/* 접근성 개선 */
.stock-table th:focus,
.stock-table td:focus {
    outline: 2px solid var(--green);
    outline-offset: 2px;
}

.stock-table th:focus:not(:focus-visible),
.stock-table td:focus:not(:focus-visible) {
    outline: none;
}

/* 고대비 모드 지원 */
@media (prefers-contrast: high) {
    .stock-table th,
    .stock-table td {
        border: 1px solid var(--text-primary) !important;
    }
    
    .sticky-col {
        border: 2px solid var(--text-primary) !important;
    }
    
    .company-logo {
        border: 1px solid var(--text-primary);
    }
}

/* 다크모드 최적화 */
@media (prefers-color-scheme: dark) {
    .table-container {
        background: var(--bg-primary, #1a1a1a);
    }
    
    .stock-table th {
        background: var(--bg-header, #2a2a2a);
        color: var(--text-primary, #ffffff);
    }
    
    .stock-table td {
        background: var(--bg-primary, #1a1a1a);
        color: var(--text-primary, #ffffff);
    }
    
    .row-2 td {
        background: var(--bg-secondary, #222222);
    }
    
    .sticky-col {
        background: var(--bg-primary, #1a1a1a) !important;
    }
    
    tr.row-2 .sticky-col {
        background: var(--bg-secondary, #222222) !important;
    }
}

