body.page-template-page-stock-layout .naver-stock-layout {
    font-family: 'Malgun Gothic', 'Dotum', sans-serif;
    color: #333;
    background-color: #f0f2f5; /* Light grey background for the overall layout */
    padding: 20px 0;
}

body.page-template-page-stock-layout .content-area {
    max-width: 1280px; /* Wider content area to match screenshot */
    margin: 0 auto;
    padding: 0 20px;
}

body.page-template-page-stock-layout .site-main {
    background-color: transparent; /* Main content area background should be transparent */
    padding: 0;
    box-shadow: none;
}

body.page-template-page-stock-layout .entry-header {
    text-align: center;
    margin-bottom: 20px;
    padding-top: 20px;
}

body.page-template-page-stock-layout .entry-title {
    font-size: 28px;
    color: #222;
    margin-top: 0;
    margin-bottom: 20px;
}

section {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    padding: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.section-header h2 {
    font-size: 20px;
    color: #222;
    margin: 0;
}

.tabs span {
    display: inline-block;
    padding: 5px 10px;
    margin-left: 5px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    color: #666;
}

.tabs span.active {
    background-color: #f0f2f5;
    border-color: #c9c9c9;
    font-weight: bold;
    color: #222;
}

/* --- Section: Key Indices/Major Indicators --- */
.section-major-indicators {
    padding-bottom: 0; /* Adjust padding for cards */
}

.indicators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px; /* Smaller gap */
    margin-top: 10px;
}

.indicator-card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    text-align: left;
    box-shadow: none; /* Remove extra shadow */
}

.indicator-name {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.indicator-value {
    font-size: 20px;
    font-weight: bold;
    color: #222;
    margin-bottom: 5px;
}

.indicator-change {
    font-size: 13px;
    font-weight: bold;
}

.indicator-change.positive {
    color: #ff4d4f; /* Red for increase */
}

.indicator-change.negative {
    color: #1890ff; /* Blue for decrease */
}

.indicator-chart {
    font-size: 12px;
    color: #ccc; /* Placeholder for chart visual */
    margin-top: 10px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f9f9f9;
    border-radius: 3px;
}

/* --- Section: News/Articles --- */
.section-news {
    display: flex;
    gap: 20px;
    background-color: transparent; /* No background for this section itself */
    box-shadow: none;
    padding: 0;
    margin-bottom: 20px;
}

.news-main {
    flex: 2; /* Main news takes more space */
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 20px;
}

.news-global-ranking {
    flex: 1; /* Ranking sidebar */
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 20px;
}

.news-meta {
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
}

.news-title {
    font-size: 22px;
    font-weight: bold;
    color: #222;
    margin-bottom: 10px;
    line-height: 1.4;
}

.news-summary {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.news-image-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.news-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.news-item img {
    width: 80px; /* Smaller image size */
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.news-item-title {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin: 0 0 5px 0;
    line-height: 1.3;
}

.news-item-excerpt {
    font-size: 12px;
    color: #777;
    margin: 0;
    line-height: 1.4;
}

.news-time {
    font-size: 11px;
    color: #aaa;
    display: block;
    margin-top: 5px;
}

.news-global-ranking h3 {
    font-size: 16px;
    color: #222;
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.news-global-ranking ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.news-global-ranking li {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
}

.news-global-ranking .rank {
    font-weight: bold;
    margin-right: 10px;
    color: #555;
}

.news-global-ranking .stock-name {
    color: #1a0dab;
}

/* --- Section: Global Trading Ranking --- */
.section-global-ranking .section-header {
    margin-bottom: 10px;
}

.section-global-ranking .tabs span {
    background-color: #f8f8f8;
    border-color: #ddd;
}

.section-global-ranking .tabs span.active {
    background-color: #fff;
    border-color: #999;
}

.ranking-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.ranking-list {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    padding: 20px;
}

.ranking-list h3 {
    font-size: 18px;
    color: #222;
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.ranking-list ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ranking-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
    border-bottom: 1px dotted #eee;
    padding-bottom: 8px;
}

.ranking-list li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.rank-item-name {
    flex: 1;
    color: #1a0dab; /* Link color */
    margin-right: 10px;
}

.rank-item-value {
    font-weight: bold;
    color: #222;
    margin-right: 5px;
}

.rank-item-change {
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

/* --- Section: Global Popular Theme --- */
.section-popular-theme {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    padding: 20px;
}

.section-popular-theme .section-header {
    border-bottom: none;
    margin-bottom: 15px;
}

.section-popular-theme .section-header h2 {
    font-size: 20px;
    color: #222;
}

.section-popular-theme .tabs {
    flex-grow: 0; /* Prevent tabs from taking full width */
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.theme-card {
    background-color: #f8f8f8;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
}

.theme-card h3 {
    font-size: 16px;
    color: #333;
    margin-top: 0;
    margin-bottom: 10px;
}

.theme-change {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 10px;
}

.theme-sentiment {
    display: flex;
    justify-content: center;
    gap: 10px;
    font-size: 13px;
    color: #666;
}

.sentiment-up {
    color: #ff4d4f;
}

.sentiment-down {
    color: #1890ff;
}

/* --- Section: Today's Popularity --- */
.section-today-popularity {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    padding: 20px;
}

.section-today-popularity h2 {
    font-size: 20px;
    color: #222;
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.section-today-popularity .time {
    font-size: 13px;
    color: #999;
    font-weight: normal;
    margin-left: 10px;
}

.popularity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.popularity-card {
    background-color: #fdfdfd;
    border: 1px solid #e9e9e9;
    border-radius: 6px;
    padding: 15px;
}

.popularity-card h3 {
    font-size: 16px;
    color: #1a0dab;
    margin-top: 0;
    margin-bottom: 8px;
}

.popularity-card p {
    font-size: 13px;
    color: #555;
    line-height: 1.5;
    height: 40px; /* Limit height for consistent look */
    overflow: hidden;
    margin-bottom: 10px;
}

.popularity-card .card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #888;
    border-top: 1px solid #eee;
    padding-top: 10px;
    margin-top: 10px;
}

.popularity-card .card-footer span:first-child {
    font-weight: bold;
    color: #333;
}

/* --- Section: Crypto/Virtual Assets --- */
.section-crypto-assets {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    padding: 20px;
}

.section-crypto-assets h2 {
    font-size: 20px;
    color: #222;
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.crypto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.crypto-card {
    background-color: #f8f8f8;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
}

.crypto-name {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.crypto-value {
    font-size: 18px;
    font-weight: bold;
    color: #222;
    margin-bottom: 5px;
}

.crypto-change {
    font-size: 13px;
    font-weight: bold;
}

/* --- Section: ETFs --- */
.section-etfs {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    padding: 20px;
}

.section-etfs .section-header {
    border-bottom: none;
    margin-bottom: 15px;
}

.etf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.etf-card {
    background-color: #f8f8f8;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 15px;
}

.etf-card h3 {
    font-size: 16px;
    color: #222;
    margin-top: 0;
    margin-bottom: 10px;
}

.etf-card p {
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
}

.etf-change {
    font-weight: bold;
    font-size: 14px;
}

/* --- Section: NPay User Investment Stocks --- */
.section-npay-investments {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 20px;
}

.section-npay-investments .section-header {
    border-bottom: none;
    margin-bottom: 15px;
}

.npay-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.npay-category {
    background-color: #f8f8f8;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 15px;
}

.npay-category h3 {
    font-size: 16px;
    color: #222;
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px dotted #ddd;
    padding-bottom: 10px;
}

.npay-category ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.npay-category li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.npay-category .stock-name {
    color: #1a0dab;
}

.npay-category .stock-value {
    font-weight: bold;
    color: #222;
    margin-left: auto; /* Push value to the right */
    margin-right: 5px;
}

.npay-category .stock-change {
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

/* General utility classes */
.positive {
    color: #ff4d4f; /* Red */
}

.negative {
    color: #1890ff; /* Blue */
}
/* ============================================================
   다크모드 대응 (sw-simple-dark-mode 플러그인, body.dark-mode 토글)
   - 플러그인이 section 배경은 #1e1e1e, span/제목/링크 텍스트는 #e0e0e0 을
     !important 로 강제 → 흰 배경을 유지하는 div/a 카드와 span 등락색만 재지정.
   ============================================================ */

/* 페이지 전체 레이아웃 배경 */
body.dark-mode.page-template-page-stock-layout .naver-stock-layout {
    background-color: #121212 !important;
    color: #e0e0e0 !important;
}

/* 공용 탭 버튼 (.tabs span — 랭킹/업종테마/ETF/경제기사 공통) */
body.dark-mode .naver-stock-layout .tabs span {
    border-color: #444 !important;
    color: #aaa !important;
    background-color: transparent !important;
}
body.dark-mode .naver-stock-layout .tabs span.active {
    background-color: #2f333a !important;
    border-color: #666 !important;
    color: #ffffff !important;
}
body.dark-mode .naver-stock-layout .section-header {
    border-bottom-color: #333 !important;
}

/* 주요 지표 탭(.tab-item, page-stock.php 인라인 스타일 대응) + 캐러셀 스크롤바 */
body.dark-mode .section-major-indicators .tabs .tab-item {
    color: #aaa !important;
}
body.dark-mode .section-major-indicators .tabs .tab-item:hover {
    background-color: #2a2a2a !important;
    color: #e0e0e0 !important;
}
body.dark-mode .section-major-indicators .tabs .tab-item.active {
    background-color: #0073aa !important;
    border-color: #0073aa !important;
    color: #ffffff !important;
}
body.dark-mode .section-major-indicators .tabs {
    border-bottom-color: #333 !important;
}
body.dark-mode .indicators-grid-container .tab-content {
    scrollbar-color: #555 transparent !important;
}
body.dark-mode .indicators-grid-container .tab-content::-webkit-scrollbar-thumb {
    background: #555 !important;
}

/* 등락 색 — 플러그인이 span 을 #e0e0e0 로 강제하므로 밝은 변형으로 복원 */
body.dark-mode .naver-stock-layout .positive { color: #ff6b6b !important; }
body.dark-mode .naver-stock-layout .negative { color: #4dabf7 !important; }

/* 글로벌 랭킹 리스트 카드 */
body.dark-mode .ranking-list {
    background-color: #23272e !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4) !important;
}
body.dark-mode .ranking-list h3 {
    border-bottom-color: #3a3f47 !important;
}
body.dark-mode .ranking-list li {
    border-bottom-color: #3a3f47 !important;
}
body.dark-mode .rank-item-name { color: #8ab4f8 !important; }
body.dark-mode .rank-item-value { color: #f5f5f5 !important; }
body.dark-mode .rank-item-change.positive { color: #ff6b6b !important; }
body.dark-mode .rank-item-change.negative { color: #4dabf7 !important; }

/* 업종·테마 카드 */
body.dark-mode .theme-card {
    background-color: #23272e !important;
    border-color: #3a3f47 !important;
}
body.dark-mode .theme-change.positive { color: #ff6b6b !important; }
body.dark-mode .theme-change.negative { color: #4dabf7 !important; }
body.dark-mode .theme-sentiment { color: #999 !important; }
body.dark-mode .sentiment-up { color: #ff6b6b !important; }
body.dark-mode .sentiment-down { color: #4dabf7 !important; }

/* 경제 톱 기사 카드 (a 태그 카드 — 플러그인 a 색 강제 대응) */
body.dark-mode .popularity-card {
    background-color: #23272e !important;
    border-color: #3a3f47 !important;
}
body.dark-mode .popularity-card h3 { color: #8ab4f8 !important; }
body.dark-mode .popularity-card p { color: #bbb !important; }
body.dark-mode .popularity-card .card-footer {
    border-top-color: #3a3f47 !important;
    color: #999 !important;
}
body.dark-mode .popularity-card .card-footer span { color: #999 !important; }
