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

body {
    font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
    background: white;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
}

.container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: row;
    position: relative;
}

.main-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

/* 데스크톱에서 타임라인이 열릴 때 */
@media (min-width: 769px) {
    .container {
        padding-left: 180px;
        transition: padding-left 0.3s ease;
    }

    .container.timeline-hidden {
        padding-left: 0;
    }
}

.header {
    background: linear-gradient(135deg, #fff5e6 0%, #e6f2ff 100%);
    color: #2d3748;
    padding: 25px 30px;
    text-align: center;
    position: relative;
}

.header h1 {
    font-size: 2em;
    margin-bottom: 5px;
    font-weight: bold;
}

.header p {
    font-size: 1em;
    opacity: 0.8;
}

.header-link {
    font-size: 0.9em;
    margin-top: 8px;
}

.header-link a {
    color: #667eea;
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.2s;
}

.header-link a:hover {
    color: #5568d3;
}

/* 타임라인 토글 책갈피 버튼 */
.timeline-toggle-bookmark {
    position: fixed;
    left: 180px;
    top: 20px;
    width: 40px;
    height: 80px;
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    outline: none;
    border-radius: 0 50px 50px 0;
    padding: 0;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1001;
    box-shadow: 4px 0 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-toggle-bookmark:hover {
    background: #cbd5e0;
    box-shadow: 6px 0 12px rgba(0, 0, 0, 0.2);
}

/* 타임라인이 숨겨졌을 때 버튼 위치 */
.timeline-toggle-bookmark.collapsed {
    left: 0;
    background: #ff9a56;
    color: white;
}

.timeline-toggle-bookmark.collapsed:hover {
    background: #ff8040;
}

.search-section {
    padding: 20px 30px;
    background: #f7fafc;
}

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

.search-results {
    width: 100%;
    margin: 15px 0 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.year-badge {
    display: inline-block;
    padding: 8px 15px;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.year-badge:hover {
    background: #f0f4ff;
    border-color: #5568d3;
    color: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.toggle-before-1000 {
    display: inline-block;
    padding: 8px 15px;
    background: #e2e8f0;
    color: #4a5568;
    border: 2px solid #cbd5e0;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-before-1000:hover {
    background: #cbd5e0;
    border-color: #a0aec0;
    color: #2d3748;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(160, 174, 192, 0.2);
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    font-size: 1em;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    transition: all 0.3s;
}

/* 브라우저 기본 검색창 X 버튼 숨기기 */
.search-box input[type="search"]::-webkit-search-cancel-button {
    display: none;
    -webkit-appearance: none;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.search-box button {
    padding: 12px 25px;
    font-size: 1em;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.search-box button:hover {
    background: #5568d3;
}

.search-box .clear-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    padding: 5px;
    font-size: 1.2em;
    background: transparent;
    color: #718096;
    border-radius: 50%;
    min-width: auto;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: auto;
}

.search-box .clear-btn:hover {
    background: #e2e8f0;
    color: #2d3748;
}

/* 타임라인 사이드바 */
.timeline-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 180px;
    height: 100vh;
    background: #e2e8f0;
    color: #2d3748;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    transition: transform 0.3s ease;
    box-shadow: 4px 0 8px rgba(0, 0, 0, 0.15);
    /* 스크롤바 숨기기 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* 스크롤바 숨기기 (Chrome, Safari, Opera) */
.timeline-sidebar::-webkit-scrollbar {
    display: none;
}

.timeline-sidebar.hidden {
    transform: translateX(-100%);
}

.timeline-container {
    position: relative;
    padding: 20px 0;
    min-height: 100%;
}

.timeline-line {
    position: absolute;
    left: 40px;
    top: 20px;
    bottom: 20px;
    width: 3px;
    background: linear-gradient(180deg, #a0aec0 0%, #718096 100%);
    pointer-events: none;
    z-index: 0;
}

.timeline-year {
    position: relative;
    padding: 15px 20px 15px 60px;
    cursor: pointer;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.timeline-year:hover {
    background: rgba(160, 174, 192, 0.2);
}

.timeline-year.active {
    background: rgba(160, 174, 192, 0.3);
    border-left-color: #718096;
}

.timeline-dot {
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: #e2e8f0;
    border: 3px solid #718096;
    border-radius: 50%;
    transition: all 0.3s;
    z-index: 1;
}

.timeline-year:hover .timeline-dot,
.timeline-year.active .timeline-dot {
    background: #718096;
    transform: translateY(-50%) scale(1.3);
    box-shadow: 0 0 15px rgba(113, 128, 150, 0.5);
}

.timeline-year-text {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 3px;
}

.timeline-ganzhi {
    font-size: 0.85em;
    opacity: 0.8;
}

/* 메인 컨텐츠 영역 */
.content-area {
    flex: 0 0 auto;
    padding: 30px;
    background: #f8f9fa;
}

.no-selection {
    text-align: center;
    padding: 100px 20px;
    color: #718096;
    font-size: 1.3em;
}

/* 연도 헤더 컨테이너 */
.year-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 20px 30px;
    background: linear-gradient(135deg, #4299e1 0%, #667eea 100%);
}

/* 네비게이션 박스 (이전/다음) */
.nav-box {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 150px;
}

.nav-box:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.nav-box.disabled {
    opacity: 0;
    pointer-events: none;
}

.nav-arrow {
    font-size: 2.5em;
    font-weight: bold;
    line-height: 1;
}

.nav-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-box-year {
    font-size: 1.05em;
    font-weight: bold;
    line-height: 1.2;
}

.nav-box-ganzhi {
    font-size: 0.85em;
    opacity: 0.9;
    line-height: 1.2;
}

/* 연도 카드 */
.year-detail {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.year-header {
    flex: 1;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
}

.year-header .main-year {
    font-size: 2.2em;
    font-weight: bold;
}

.year-header .sub-info {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.year-header .badge {
    background: rgba(255,255,255,0.25);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.95em;
}

.regions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 0;
}

.region {
    padding: 25px;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

.region:last-child {
    border-right: none;
}

.region-title {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 3px solid;
    text-align: center;
}

.region.korea .region-title {
    color: #e53e3e;
    border-color: #e53e3e;
}

.region.china .region-title {
    color: #d69e2e;
    border-color: #d69e2e;
}

.region.japan .region-title {
    color: #38a169;
    border-color: #38a169;
}

.country-info {
    margin-bottom: 15px;
}

.country-name {
    font-weight: bold;
    color: #2d3748;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.no-data {
    color: #a0aec0;
    font-style: italic;
    padding: 10px;
    text-align: center;
}

.info-row {
    margin: 5px 0;
    padding: 8px 12px;
    background: #f7fafc;
    border-radius: 8px;
    font-size: 0.95em;
}

.info-label {
    font-weight: bold;
    color: #4a5568;
    margin-right: 8px;
}

/* 푸터 */
.footer {
    padding: 20px 30px;
    background: #f8f9fa;
    text-align: center;
    font-size: 0.9em;
    color: #718096;
}

.footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.footer a:hover {
    color: #5568d3;
    text-decoration: underline;
}

.footer-separator {
    margin: 0 12px;
    color: #cbd5e0;
}

@media (max-width: 768px) {
    .timeline-sidebar {
        width: 250px;
    }

    .timeline-toggle-bookmark {
        left: 250px;
        width: 35px;
        height: 70px;
        font-size: 1.3em;
        top: 15px;
        background: #ff9a56;
        color: white;
    }

    .timeline-toggle-bookmark:hover {
        background: #ff8040;
    }

    .timeline-toggle-bookmark.collapsed {
        left: 0;
    }

    .main-wrapper {
        max-width: 100%;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .header p {
        font-size: 0.9em;
    }

    .search-box {
        flex-direction: column;
        gap: 8px;
    }

    .search-box input {
        padding: 10px 12px;
    }

    .search-box .clear-btn {
        right: 10px;
        top: 10px;
        transform: none;
    }

    .year-header-container {
        flex-direction: row;
        align-items: stretch;
        gap: 10px;
        padding: 15px;
    }

    .nav-box {
        min-width: auto;
        padding: 0;
        width: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .nav-arrow {
        font-size: 2em;
    }

    .nav-info {
        display: none;
    }

    .year-header {
        flex: 1;
    }

    .year-header .main-year {
        font-size: 1.5em;
    }

    .year-header .sub-info {
        flex-direction: row;
        gap: 8px;
        font-size: 0.85em;
    }

    .year-header .badge {
        padding: 5px 10px;
        font-size: 0.8em;
    }

    .regions {
        grid-template-columns: 1fr;
    }

    .region {
        border-right: none;
    }

    .content-area {
        padding: 15px;
    }

    .footer {
        padding: 30px 20px 50px 20px;
    }
}
