/**
 * 🔥 SECTION: Coin List Styles START
 * 코인 리스트 관련 스타일
 * - 코인 리스트 컨테이너
 * - 코인 테이블 스타일
 * - 코인 탭 스타일
 * - 뷰 모드 그룹 스타일
 * - 실시간 가격 업데이트 스타일
 */

/* ==========================================================================
   코인 리스트 컨테이너
   ========================================================================== */

.coin-list-container { 
    max-height: none; 
    overflow-y: auto; 
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.coin-list-container .table-container {
    flex-grow: 1;
    overflow-y: auto;
    position: relative;
}

.coin-list-container .table {
    margin-bottom: 0;
}

.coin-list-container .table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: table-header-group;
}

.coin-list-container .table thead th {
    border-top: none;
    border-bottom: 2px solid #dee2e6;
    display: table-cell;
    visibility: visible;
    color: #333 !important;
    font-weight: 600;
}

/* ==========================================================================
   뷰 모드 그룹 스타일
   ========================================================================== */

.view-mode-group {
    background: #ffffff;
    border: 1px solid #47a3ff;
    border-radius: 8px;
    padding: 6px 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    min-width: fit-content;
}

.view-mode-title {
    font-size: 10px;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 4px;
    text-align: center;
}

.view-mode-options {
    display: flex;
    gap: 2px;
    flex-wrap: nowrap;
}

.view-mode-options input[type="radio"] {
    display: none;
}

.view-mode-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 6px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 50px;
    font-size: 10px;
    white-space: nowrap;
}

.view-mode-label:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.view-mode-label i {
    font-size: 12px;
    margin-bottom: 1px;
    color: #6c757d;
}

.view-mode-label span {
    color: #495057;
    font-weight: 500;
    font-size: 9px;
}

.view-mode-options input[type="radio"]:checked + .view-mode-label {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.view-mode-options input[type="radio"]:checked + .view-mode-label i,
.view-mode-options input[type="radio"]:checked + .view-mode-label span {
    color: #ffffff;
}

/* 작은 화면에서 더 컴팩트하게 */
@media (max-width: 768px) {
    .view-mode-group {
        padding: 4px 6px;
    }
    
    .view-mode-title {
        font-size: 9px;
        margin-bottom: 2px;
    }
    
    .view-mode-label {
        padding: 3px 4px;
        min-width: 40px;
        font-size: 9px;
    }
    
    .view-mode-label i {
        font-size: 10px;
        margin-bottom: 0;
    }
    
    .view-mode-label span {
        font-size: 8px;
    }
}

/* 매우 작은 화면에서는 아이콘만 표시 */
@media (max-width: 480px) {
    .view-mode-label span {
        display: none;
    }
    
    .view-mode-label {
        min-width: 30px;
        padding: 4px;
    }
    
    .view-mode-label i {
        margin-bottom: 0;
        font-size: 12px;
    }
}

/* ==========================================================================
   코인 테이블 스타일 (#sidebar 내부)
   ========================================================================== */

#sidebar .coin-table thead {
    display: table-header-group !important;
    visibility: visible !important;
}

#sidebar .coin-table thead th {
    display: table-cell !important;
    visibility: visible !important;
}

#sidebar .coin-table tbody tr { 
    cursor: pointer; 
    border-bottom: 1px solid #f1f3f4; 
}

#sidebar .coin-table tbody tr:hover { 
    background-color: #f8f9fa; 
}

#sidebar .coin-table tbody tr.active { 
    background-color: #e8f4fd !important; 
    border-left: 3px solid #0d6efd; 
}

#sidebar .coin-table tbody tr.active td { 
    background-color: transparent !important; 
}

#sidebar .coin-table .ticker-symbol { 
    font-size: 0.8em; 
    color: #6c757d; 
}

#sidebar .coin-table tbody tr.active .ticker-symbol { 
    color: #6c757d; 
    font-weight: 600; 
}

#sidebar .coin-table tbody tr.active span { 
    font-weight: 600 !important; 
}

#sidebar .coin-table th { 
    white-space: nowrap; 
    font-size: 0.8rem; 
    cursor: pointer; 
    position: relative; 
    padding: 10px 12px;
    background-color: #fafbfc;
    border-bottom: 1px solid #e1e4e8;
    color: #333 !important;
    font-weight: 600;
}

/* 오른쪽 정렬된 헤더(거래대금 등)는 화살표 공간을 더 확보 */
#sidebar .coin-table th.text-end {
    padding-right: 25px;
}

#sidebar .coin-table th:hover { 
    background-color: #f8f9fa; 
}

#sidebar .coin-table th.sortable::after {
    content: '↕';
    position: absolute;
    right: 5px;
    color: #999;
    font-size: 0.8em;
}

/* 오른쪽 정렬된 헤더의 화살표는 더 오른쪽으로 이동 */
#sidebar .coin-table th.text-end.sortable::after,
#sidebar .coin-table th.text-end.sort-asc::after,
#sidebar .coin-table th.text-end.sort-desc::after {
    right: 8px;
}

#sidebar .coin-table th.sort-asc::after {
    content: '↑';
    color: #007bff;
    right: 5px;
}

#sidebar .coin-table th.sort-desc::after {
    content: '↓';
    color: #007bff;
    right: 5px;
}

#sidebar .coin-table td { 
    padding: 8px 12px; 
    vertical-align: middle;
    border-top: 1px solid #f1f3f4;
    overflow: hidden;
}

/* 첫 번째 셀(코인명)만 줄바꿈 방지, 나머지는 정상 줄바꿈 */
#sidebar .coin-table td:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 나머지 셀들은 줄바꿈 허용 */
#sidebar .coin-table td:not(:first-child) {
    white-space: nowrap;
}

#sidebar .coin-table .coin-logo {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background-color: #f0f0f0;
    border: 1px solid #e0e0e0;
}

/* 코인명 영역 텍스트 오버플로우 처리 */
#sidebar .coin-table td:first-child > div {
    min-width: 0;
    overflow: hidden;
}

#sidebar .coin-table .coin-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

#sidebar .coin-table .coin-symbol {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    display: block;
}

#sidebar .coin-table { 
    table-layout: fixed; 
    width: 100%; 
    font-size: 0.85rem; 
}

#sidebar .coin-table th:nth-child(1) { width: 35%; }
#sidebar .coin-table th:nth-child(2) { width: 22%; }
#sidebar .coin-table th:nth-child(3) { width: 25%; }
#sidebar .coin-table th:nth-child(4) { width: 18%; }

/* ==========================================================================
   코인 탭 스타일
   ========================================================================== */

.coin-tabs { 
    margin-top: 0.5rem; 
}

.coin-tabs .nav-tabs { 
    border-bottom: 1px solid #dee2e6; 
    justify-content: center;
}

.coin-tabs .nav-link { 
    font-size: 0.95em; 
    padding: 0.5rem 1rem; 
    color: #6c757d; 
    border: none; 
    border-bottom: 2px solid transparent;
    background: none;
    font-weight: 500;
}

.coin-tabs .nav-link:hover { 
    color: #495057; 
    border-bottom-color: #dee2e6;
    background: none;
}

.coin-tabs .nav-link.active { 
    color: #007bff; 
    border-bottom-color: #007bff;
    background: none;
    font-weight: 600;
}

/* ==========================================================================
   실시간 가격 업데이트 스타일
   ========================================================================== */

.price-update-flash { 
    transition: all 0.3s ease !important; 
}

.price-up { 
    background-color: rgba(248, 73, 96, 0.1) !important; 
    color: #f84960 !important; 
}

.price-down { 
    background-color: rgba(66, 133, 244, 0.1) !important; 
    color: #4285f4 !important; 
}

.realtime-indicator { 
    width: 8px; 
    height: 8px; 
    border-radius: 50%; 
    background-color: #4caf50; 
    animation: pulse 2s infinite; 
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* ==========================================================================
   다크 모드 스타일
   ========================================================================== */

body.theme-dark .coin-tabs .nav-link {
    color: #9ca3af;
}

body.theme-dark .coin-tabs .nav-link:hover {
    color: #e5e7eb;
}

body.theme-dark .coin-tabs .nav-link.active {
    background-color: #1f2937;
    color: #e5e7eb;
    border-color: #374151 #374151 #1f2937;
}

body.theme-dark .coin-table {
    color: #e5e7eb;
    background-color: #1f2937;
}

body.theme-dark .coin-table th {
    background-color: #1f2937;
    color: #9ca3af;
    border-bottom-color: #374151;
}

body.theme-dark .coin-table td {
    background-color: #1f2937;
    color: #e5e7eb;
    border-bottom-color: #374151;
}

body.theme-dark .coin-table tbody tr:hover td {
    background-color: #374151;
    color: #ffffff;
}

/* Scrollbars in Dark Mode */
body.theme-dark .coin-list-container::-webkit-scrollbar-track {
    background: #111827;
}

body.theme-dark .coin-list-container::-webkit-scrollbar-thumb {
    background: #4b5563;
}

body.theme-dark .coin-list-container::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/**
 * 🔥 SECTION: Coin List Styles END
 */

