:root {
    --primary-color: #1a73e8;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --group-1-bg: #f1f7ff; /* 은은한 블루 */
    --group-2-bg: #f0fdf4; /* 은은한 그린 */
    --text-main: #202124;
    --text-sub: #5f6368;
    --border-color: #dadce0;
    --nav-bg: #ffffff;
    --shadow: 0 1px 3px rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15);
    --header-gradient: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
}

.light-mode {
    --primary-color: #1a73e8;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --group-1-bg: #f1f7ff;
    --group-2-bg: #f0fdf4;
    --text-main: #202124;
    --text-sub: #5f6368;
    --border-color: #dadce0;
    --nav-bg: #ffffff;
}

body:not(.light-mode) {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --group-1-bg: #1e293b; /* 어두운 블루 */
    --group-2-bg: #14532d22; /* 아주 연한 어두운 그린 */
    --text-main: #e8eaed;
    --text-sub: #9aa0a6;
    --border-color: #3c4043;
    --nav-bg: #202124;
    --primary-color: #8ab4f8;
    --shadow: 0 4px 6px rgba(0,0,0,0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.7;
    transition: background-color 0.3s, color 0.3s;
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    padding: 10px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 25px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Header */
header {
    background: var(--header-gradient);
    color: white;
    padding: 80px 20px;
    text-align: center;
}

body:not(.light-mode) header {
    background: #1e1e1e;
    border-bottom: 1px solid var(--border-color);
}

.header-content h1 {
    font-size: 3rem;
    font-family: 'Playfair Display', serif;
    margin-bottom: 15px;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 30px;
}

.date-selector {
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.date-selector input {
    padding: 10px 15px;
    border-radius: 6px;
    border: none;
    font-family: inherit;
    font-size: 1rem;
}

.date-text {
    font-weight: 500;
    font-size: 1.1rem;
    margin-bottom: 25px;
}

/* Market Indices */
.market-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.market-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    padding: 12px 20px;
    border-radius: 10px;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.2s;
}

body:not(.light-mode) .market-card {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

.market-card:hover {
    transform: translateY(-2px);
}

.market-label {
    font-size: 0.8rem;
    font-weight: 700;
    opacity: 0.9;
    margin-bottom: 4px;
}

.market-value {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.market-change {
    font-size: 0.85rem;
    font-weight: 500;
}

.up {
    color: #ff5252; /* Red for up in Korea */
}

.down {
    color: #448aff; /* Blue for down in Korea */
}

body:not(.light-mode) .up {
    color: #ff8a80;
}

body:not(.light-mode) .down {
    color: #82b1ff;
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.news-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

@media (max-width: 992px) {
    .news-grid {
        grid-template-columns: 1fr;
    }
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.favicon {
    width: 24px;
    height: 24px;
}

.news-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.news-item {
    background-color: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
    display: block;
    transition: all 0.2s ease;
}

/* 5개씩 배경색 구분 */
.news-item:nth-child(-n+5) {
    background-color: var(--group-1-bg);
    border-left: 5px solid var(--primary-color);
}

.news-item:nth-child(n+6) {
    background-color: var(--group-2-bg);
    border-left: 5px solid #34a853; /* 그린 계열 보조색 */
}

.news-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.news-item h3 {
    font-size: 1.2rem;
    margin-bottom: 12px;
    line-height: 1.4;
    color: var(--text-main);
}

.news-item .meta {
    font-size: 0.85rem;
    color: var(--text-sub);
}

/* Info Sections */
.divider {
    margin: 60px 0;
    border: 0;
    border-top: 1px solid var(--border-color);
}

.info-section {
    margin-bottom: 50px;
    max-width: 800px;
}

.info-section h2 {
    margin-bottom: 20px;
    font-family: 'Playfair Display', serif;
}

.info-section p {
    margin-bottom: 15px;
    color: var(--text-sub);
}

/* Footer */
.footer {
    background-color: var(--nav-bg);
    border-top: 1px solid var(--border-color);
    padding: 50px 0;
    margin-top: 80px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 30px;
}

.footer-info {
    max-width: 600px;
}

.footer-info p {
    font-size: 0.9rem;
    color: var(--text-sub);
    margin-bottom: 10px;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    text-decoration: none;
    color: var(--text-sub);
    font-size: 0.85rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary-color);
}

#theme-btn {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-sub);
    font-style: italic;
}
