/* 탭 네비게이션 스타일 */
.tab-navigation {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    margin-bottom: 30px;
}

.tab-btn {
    padding: 12px 30px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border-color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* 탭 컨텐츠 스타일 */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 테마 카드 스타일 */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.theme-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.theme-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.theme-card-title {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.theme-card-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.theme-card-description {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.theme-card-stats {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #999;
}

.theme-card-stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 순위 테이블 스타일 */
.ranking-table {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ranking-table table {
    width: 100%;
    border-collapse: collapse;
}

.ranking-table th {
    background: #667eea;
    color: white;
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.ranking-table th:last-child {
    border-right: none;
}

.ranking-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.ranking-table tbody tr {
    transition: background-color 0.2s ease;
}

.ranking-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* 토글 가능한 행 */
.theme-description-row {
    background-color: #f8f9fa !important;
    display: none;
}

.theme-description-row.active {
    display: table-row;
}

.theme-description-cell {
    padding: 20px !important;
    border-left: 4px solid #667eea;
}

.theme-description-content {
    font-size: 14px;
    line-height: 1.8;
    color: #555;
}

/* 아코디언 내부 종목 테이블 스타일 */
.theme-description-content table {
    margin-top: 0;
}

.theme-description-content table thead th {
    background: #f8f9fa;
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
}

.theme-description-content table tbody tr:hover {
    background: #f0f0f0 !important;
}

.toggle-icon {
    margin-left: 8px;
    font-size: 11px;
    color: #667eea;
    transition: transform 0.3s ease;
}

.toggle-icon.active {
    transform: rotate(180deg);
}

.ranking-table tr:hover {
    background: #f8f9fa;
}

.ranking-table .rank-number {
    font-weight: 700;
    font-size: 18px;
    color: #667eea;
}

.ranking-table .change-positive {
    color: #dc3545;
    font-weight: 600;
}

.ranking-table .change-negative {
    color: #0066ff;
    font-weight: 600;
}

/* 검색 박스 스타일 */
.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-box input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.search-box button {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-box button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* 로딩 메시지 */
.loading-message {
    text-align: center;
    padding: 50px;
    color: #667eea;
    font-size: 16px;
    font-weight: 500;
}

/* 단일 레이아웃 (전체 너비) */
.single-column-layout {
    background: white;
    border-radius: 12px;
    overflow: visible;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 아코디언 확장 영역 */
.theme-expanded-content {
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.theme-expanded-content.active {
    max-height: 2000px;
    padding: 20px;
}

.theme-description-box {
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}

.theme-description-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.theme-description-text {
    font-size: 14px;
    color: #666;
    line-height: 1.8;
}

/* 2단 레이아웃 (테마사전용으로 유지) */
.two-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    min-height: 600px;
}

.left-panel {
    background: white;
    border-radius: 12px;
    overflow: visible;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.right-panel {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: visible;
}

.right-panel .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.theme-detail-header {
    border-bottom: 2px solid #667eea;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.theme-detail-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.theme-detail-description {
    font-size: 14px;
    color: #666;
    line-height: 1.8;
    margin-bottom: 15px;
}

.theme-detail-section {
    margin-bottom: 30px;
}

.theme-detail-section-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stock-list {
    list-style: none;
    padding: 0;
}

.stock-item {
    padding: 15px 12px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
}

.stock-item:hover {
    background: #f8f9fa;
}

.stock-item:last-child {
    border-bottom: none;
}

.stock-name {
    font-weight: 600;
    color: #333;
}

.stock-code {
    color: #999;
    font-size: 13px;
}

.naver-link-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #03c75a;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.naver-link-btn:hover {
    background: #02b350;
    transform: translateY(-2px);
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .tab-navigation {
        flex-direction: column;
        gap: 8px;
        padding: 15px;
    }

    .tab-btn {
        width: 100%;
        text-align: center;
    }

    .theme-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .ranking-table {
        overflow-x: auto;
    }

    .two-column-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .right-panel {
        max-height: none;
        padding: 20px;
    }

    /* 데스크탑 메뉴 숨기기, 모바일 메뉴 표시 */
    .desktop-menu,
    .desktop-auth {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .mobile-menu-overlay {
        display: block;
        visibility: visible;
    }
}

/* ================================
   뉴스 탭 스타일 (테이블 형식)
   ================================ */

/* 뉴스 날짜 선택 */
.news-date-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.news-date-selector label {
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.news-date-selector select {
    flex: 1;
    max-width: 200px;
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.news-date-selector select:focus {
    outline: none;
    border-color: #667eea;
}

.btn-load-news {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-load-news:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 뉴스 헤더 바 */
.news-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
}

.news-count {
    font-size: 16px;
    font-weight: 600;
}

.btn-refresh {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-refresh:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* 뉴스 테이블 래퍼 */
.news-table-wrapper {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #eee;
}

/* 뉴스 테이블 */
.news-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.news-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.news-table th {
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
}

.news-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
}

.news-table tbody tr:hover {
    background: #f8f9ff;
}

.news-table tbody tr:last-child {
    border-bottom: none;
}

.news-table td {
    padding: 14px 12px;
    vertical-align: middle;
}

/* 컬럼 너비 */
.col-time {
    width: 80px;
    color: #888;
    font-size: 13px;
    white-space: nowrap;
}

.col-title {
    min-width: 300px;
}

.col-title a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    line-height: 1.4;
    display: block;
}

.col-title a:hover {
    color: #667eea;
}

.col-stock {
    width: 150px;
}

.col-theme {
    width: 200px;
}

.col-press {
    width: 100px;
    color: #666;
    font-size: 13px;
}

/* 종목 링크 */
.stock-link {
    color: #667eea;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.2s;
}

.stock-link:hover {
    color: #5a6fd6;
    text-decoration: underline;
}

/* 테마 배지 */
.theme-badge {
    display: inline-block;
    padding: 3px 8px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 11px;
    font-weight: 500;
    border-radius: 12px;
    margin: 2px;
    white-space: nowrap;
}

/* 뉴스 탭 반응형 */
@media (max-width: 1024px) {
    .news-table-wrapper {
        overflow-x: auto;
    }

    .news-table {
        min-width: 800px;
    }
}

@media (max-width: 768px) {
    .news-header-bar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .col-title {
        min-width: 200px;
    }

    .news-table th,
    .news-table td {
        padding: 10px 8px;
        font-size: 13px;
    }

    .theme-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
}
