@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

:root {
    --primary-color: #003366;
    --secondary-color: #007bff;
    --accent-color: #d9534f;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #dee2e6;
    --sidebar-bg: #f1f3f5;
    --header-height: 60px;
}

body.dark-mode {
    --primary-color: #4dabf7;
    --secondary-color: #74c0fc;
    --accent-color: #ff8787;
    --bg-light: #121212;
    --bg-white: #1e1e1e;
    --text-main: #e9ecef;
    --text-muted: #adb5bd;
    --border-color: #343a40;
    --sidebar-bg: #1a1a1a;
}

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

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.7;
    transition: background-color 0.3s, color 0.3s;
}

/* Header */
#site-header {
    height: var(--header-height);
    background-color: var(--primary-color);
    color: white;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: none; /* Hidden by default, shown when main content active */
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 20px;
    justify-content: space-between;
}

#logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

#logo span {
    color: var(--secondary-color);
}

.search-wrapper {
    flex: 1;
    max-width: 500px;
    margin: 0 40px;
    display: flex;
    position: relative;
}

#search-input {
    width: 100%;
    padding: 8px 15px;
    border-radius: 20px;
    border: none;
    background-color: rgba(255,255,255,0.15);
    color: white;
    outline: none;
    transition: background-color 0.2s;
}

#search-input:focus {
    background-color: rgba(255,255,255,0.25);
}

#search-input::placeholder {
    color: rgba(255,255,255,0.6);
}

#search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
}

/* Theme Switch */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255,255,255,0.3);
    transition: .4s;
    border-radius: 34px;
}

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

input:checked + .slider { background-color: var(--secondary-color); }
input:checked + .slider:before { transform: translateX(22px); }

/* Landing Page */
#landing-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, #001f3f 100%);
    color: white;
    text-align: center;
    padding: 20px;
}

.quote-container {
    max-width: 800px;
    margin-bottom: 50px;
}

.quote {
    font-size: 2rem;
    font-weight: 300;
    margin-bottom: 20px;
    line-height: 1.4;
}

.author {
    font-size: 1.2rem;
    opacity: 0.8;
}

#fact-check-btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 700;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

#fact-check-btn:hover {
    transform: translateY(-3px);
    background-color: #0056b3;
}

/* Main Content Layout */
#main-content {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
    background-color: var(--bg-white);
}

#sidebar {
    width: 300px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
}

.sidebar-header {
    padding: 0 20px 15px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

#category-list li {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background-color 0.2s;
    list-style: none;
}

#category-list li:hover {
    background-color: rgba(0,0,0,0.05);
}

#category-list li.active {
    background-color: var(--secondary-color);
    color: white;
    font-weight: 600;
}

#critical-thinking-section {
    margin: 30px 20px;
    padding: 15px;
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
}

#critical-thinking-section h3 {
    font-size: 0.95rem;
    color: var(--secondary-color);
}

/* QA Container */
#qa-container {
    flex: 1;
    padding: 40px 60px;
    background-color: var(--bg-white);
}

#content-header {
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

#current-category-title {
    font-size: 2rem;
    font-weight: 800;
}

/* Article Styling */
.article-item {
    margin-bottom: 60px;
}

.article-item h2 {
    font-size: 1.75rem;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

.article-content h3 {
    font-size: 1.3rem;
    margin: 25px 0 15px;
    padding-left: 10px;
    border-left: 4px solid var(--primary-color);
}

.article-content h4 {
    font-size: 1.1rem;
    margin: 20px 0 10px;
    color: var(--secondary-color);
}

.article-content p {
    margin-bottom: 1.2rem;
    text-align: justify;
}

.article-content strong {
    color: var(--accent-color);
}

/* Wiki Infobox */
.infobox {
    float: right;
    width: 300px;
    margin-left: 20px;
    margin-bottom: 20px;
    background-color: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    padding: 15px;
    font-size: 0.9rem;
}

.infobox-title {
    font-weight: 800;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
    padding-bottom: 5px;
    background-color: var(--primary-color);
    color: white;
    margin: -15px -15px 10px -15px;
    padding: 8px;
}

.infobox table {
    width: 100%;
}

.infobox td {
    padding: 5px 0;
    vertical-align: top;
}

.infobox td:first-child {
    font-weight: 700;
    width: 80px;
}

/* References */
.references {
    margin-top: 40px;
    padding: 20px;
    background-color: var(--sidebar-bg);
    border-top: 2px solid var(--border-color);
}

.references h4 {
    margin-bottom: 10px;
    font-size: 1rem;
}

.references ul {
    padding-left: 20px;
    font-size: 0.9rem;
}

.references a {
    color: var(--secondary-color);
    text-decoration: none;
}

.references a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 1024px) {
    #sidebar { width: 240px; }
    #qa-container { padding: 30px 40px; }
    .infobox { width: 250px; }
}

@media (max-width: 768px) {
    #main-content { flex-direction: column; }
    #sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    #qa-container { padding: 20px; }
    .infobox {
        float: none;
        width: 100%;
        margin-left: 0;
    }
}
