:root {
    --primary-color: #3b65f1;
    --text-color: #1e1e1e;
    --text-gray: #767676;
    --bg-color: #f2f4f7;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --up-color: #d2322d;
    --down-color: #0a5cdb;
    --header-height: 60px;
}

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

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

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Header */
.header {
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    height: var(--header-height);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.inner-header {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.logo {
    color: var(--primary-color);
    font-size: 24px;
    font-weight: 700;
    margin-right: 40px;
    letter-spacing: -1px;
}

.gnb ul {
    display: flex;
    gap: 20px;
}

.gnb a {
    font-weight: 500;
    font-size: 16px;
    padding: 18px 0;
    display: block;
}

.gnb li.active a {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
}

/* Search Section */
.search-section {
    background-color: #fff;
    padding: 30px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.search-box {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    display: flex;
}

.search-box input {
    width: 100%;
    padding: 15px 20px;
    font-size: 16px;
    border: 2px solid var(--primary-color);
    border-right: none;
    outline: none;
    border-radius: 4px 0 0 4px;
}

.search-box button {
    padding: 0 25px;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 0 4px 4px 0;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid var(--border-color);
    border-top: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 10;
    max-height: 300px;
    overflow-y: auto;
}

.search-item {
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.search-item:hover {
    background-color: #f8f9fa;
}

.search-item .code {
    color: var(--text-gray);
    font-size: 13px;
}

.hidden {
    display: none !important;
}

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

/* Dashboard */
.grid-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.full-width {
    grid-column: span 2;
}

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

.card-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.more {
    font-size: 13px;
    color: var(--text-gray);
}

/* Stock Lists/Tables */
.stock-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.stock-table th {
    text-align: left;
    color: var(--text-gray);
    font-weight: 400;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.stock-table td {
    padding: 12px 0;
    vertical-align: middle;
}

.stock-table tr:not(:last-child) td {
    border-bottom: 1px solid #f5f5f5;
}

.news-list li {
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
}

.news-list li:last-child {
    border-bottom: none;
}

.news-list a {
    display: block;
    font-size: 15px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.news-source {
    font-size: 12px;
    color: var(--text-gray);
    margin-top: 4px;
    display: block;
}

/* Theme Chips */
.theme-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chip {
    background: #f0f4ff;
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.chip:hover {
    background: #dde5ff;
}

/* Stock Detail View */
.stock-detail {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.stock-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 30px;
    border-bottom: 2px solid #222;
    padding-bottom: 20px;
}

.stock-title h2 {
    font-size: 28px;
    display: inline-block;
    margin-right: 10px;
}

.stock-title .code {
    color: var(--text-gray);
    font-size: 16px;
}

.stock-price .price {
    font-size: 32px;
    font-weight: 700;
    color: var(--up-color); /* Default to red, JS will toggle */
}

.stock-price .change {
    font-size: 14px;
    margin-left: 10px;
    font-weight: 500;
}

.change.up { color: var(--up-color); }
.change.down { color: var(--down-color); }

.stock-content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.mock-chart {
    background: #f9fafe;
    height: 300px;
    border: 1px dashed #ccd3e0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: 4px;
}

.chart-line {
    width: 80%;
    height: 2px;
    background: var(--primary-color);
    transform: rotate(-10deg);
    position: absolute;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 40px 0;
    background: #fff;
    color: var(--text-gray);
    text-align: center;
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .grid-row {
        grid-template-columns: 1fr;
    }
    .full-width {
        grid-column: span 1;
    }
    .stock-content-grid {
        grid-template-columns: 1fr;
    }
}
