:root {
    --bg-color: #f9f9f9;
    --text-color: #333;
    --card-bg: #fff;
    --accent-color: #007acc;
    --fail-bg: #ffe5e5;
}

body.dark {
    --bg-color: #1e1e1e;
    --text-color: #ddd;
    --card-bg: #2a2a2a;
    --accent-color: #4ea9ff;
    --fail-bg: #402020;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    transition: background 0.3s, color 0.3s;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#themeToggle {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: var(--text-color);
}

input#searchInput {
    width: 100%;
    padding: 10px;
    font-size: 1em;
    border-radius: 6px;
    border: 1px solid #ccc;
    margin-bottom: 20px;
    background: var(--card-bg);
    color: var(--text-color);
}

.source-group {
    margin-bottom: 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: var(--card-bg);
    padding: 10px 0;
}

.group-header {
    font-size: 1.1em;
    font-weight: bold;
    padding: 10px 15px;
    background-color: rgba(0,0,0,0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.toggle-icon {
    font-size: 0.8em;
    margin-right: 8px;
    transition: transform 0.2s ease;
}

.news-list {
    padding: 10px 15px;
}

.news-card {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 8px;
    background: var(--card-bg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.news-title {
    display: block;
    font-weight: bold;
    font-size: 1.1em;
    color: var(--accent-color);
    text-decoration: none;
    margin-bottom: 4px;
}

.news-title:hover {
    text-decoration: underline;
}


.news-date {
    font-size: 0.85em;
    color: #777;
    margin-bottom: 6px;
}

.news-summary {
    font-size: 0.95em;
    color: #666; /* 흐릿한 회색 */
    font-style: italic;
    line-height: 1.6;
    margin-top: 6px;
    white-space: pre-line;
}

.news-summary.collapse {
    max-height: 6.5em;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: max-height 0.3s ease;
}

.toggle-summary {
    display: inline-block;
    color: var(--accent-color);
    cursor: pointer;
    font-size: 0.85em;
    margin-top: 4px;
}

.failed-feeds {
    background-color: var(--fail-bg);
    padding: 10px;
    border-radius: 6px;
    color: #f99;
    margin-top: 20px;
}

.theme-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 반응형 */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .news-title {
        font-size: 1em;
    }

    .group-header {
        font-size: 1em;
    }

    #themeToggle {
        font-size: 1em;
    }
}

/* 검색창을 뉴스 카드 너비와 일치시키기 */
.search-container {
    max-width: 720px;
    margin: 0 auto 20px auto;
}

#searchInput {
    width: 100%;
    padding: 10px;
    font-size: 1em;
    border-radius: 6px;
    border: 1px solid #ccc;
    background: var(--card-bg);
    color: var(--text-color);
    box-sizing: border-box;
}

/* 토글 스위치 스타일 */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0;
    right: 0; bottom: 0;
    background-color: #ccc;
    border-radius: 24px;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

/* 체크 시 다크 모드로 */
.theme-switch input:checked + .slider {
    background-color: #4ea9ff;
}

.theme-switch input:checked + .slider:before {
    transform: translateX(24px);
}
