/* 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    height: 100%;
    font-family: 'Noto Sans KR', sans-serif;
    background-color: #0f0f1a;
    color: #e0e0e0;
    overflow: hidden;
}

/* 타임라인 내비게이션 */
.timeline-navigation {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    background-color: rgba(20, 20, 40, 0.8);
    padding: 10px 20px;
    border-radius: 30px;
    z-index: 100;
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.5);
}

.era {
    padding: 8px 20px;
    margin: 0 5px;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.era:hover {
    background-color: rgba(0, 150, 200, 0.3);
}

.era.active {
    background-color: rgba(0, 200, 255, 0.3);
    box-shadow: 0 0 10px rgba(0, 200, 255, 0.7);
}

/* 3D 장면 컨테이너 */
#library-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#scene-container {
    width: 100%;
    height: 100%;
    position: absolute;
}

/* 오버레이 스타일 */
.overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 15, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
    z-index: 50;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

.overlay-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
    background: rgba(20, 20, 40, 0.8);
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.3);
}

.overlay-content h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: #00c8ff;
    text-shadow: 0 0 10px rgba(0, 200, 255, 0.7);
}

.overlay-content p {
    font-size: 1.2em;
    margin-bottom: 30px;
    line-height: 1.6;
}

button {
    background-color: #00a0cf;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.1em;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans KR', sans-serif;
}

button:hover {
    background-color: #0080a0;
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.7);
    transform: translateY(-2px);
}

/* 시대 정보 패널 */
#era-info {
    position: absolute;
    top: 90px;
    left: 20px;
    background: rgba(20, 20, 40, 0.8);
    padding: 20px;
    border-radius: 10px;
    max-width: 300px;
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.3);
    transition: all 0.3s ease;
}

#era-info h2 {
    color: #00c8ff;
    margin-bottom: 10px;
}

#era-info p {
    line-height: 1.5;
}

/* 책장 스타일 */
#book-shelf {
    position: absolute;
    right: 20px;
    top: 90px;
    background: rgba(20, 20, 40, 0.8);
    padding: 20px;
    border-radius: 10px;
    width: 300px;
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.3);
    max-height: 70vh;
    overflow-y: auto;
}

#book-shelf h3 {
    color: #00c8ff;
    margin-bottom: 15px;
    text-align: center;
}

.books-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.book {
    background: rgba(30, 30, 60, 0.8);
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.book:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 200, 255, 0.5);
}

.book h4 {
    font-size: 1em;
    margin-bottom: 5px;
    color: #00c8ff;
}

.book p {
    font-size: 0.8em;
    color: #c0c0c0;
}

/* 역사적 인물과의 채팅 */
#historical-chat {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 350px;
    background: rgba(20, 20, 40, 0.9);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.4);
}

.chat-header {
    background: rgba(0, 160, 207, 0.7);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#historical-figure-name {
    font-weight: bold;
    font-size: 1.1em;
}

.close-chat {
    background: none;
    padding: 5px;
    color: white;
}

.close-chat:hover {
    background: none;
    box-shadow: none;
    transform: none;
}

.chat-messages {
    height: 300px;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.message {
    margin-bottom: 10px;
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 80%;
    word-break: break-word;
}

.user-message {
    background-color: #2979ff;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.figure-message {
    background-color: #455a64;
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-input {
    display: flex;
    padding: 10px;
    background: rgba(30, 30, 60, 0.8);
}

.chat-input input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    margin-right: 10px;
    background: rgba(60, 60, 100, 0.8);
    color: white;
}

.chat-input button {
    padding: 10px;
    background: #00a0cf;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 시간 여행자 컬렉션 */
.time-traveler-collection {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 100;
}

#toggle-collection {
    background-color: #7b2cbf;
}

#toggle-collection:hover {
    background-color: #5a189a;
}

#collection-panel {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 300px;
    background: rgba(20, 20, 40, 0.9);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(123, 44, 191, 0.5);
    max-height: 400px;
    overflow-y: auto;
    transition: all 0.3s ease;
}

#collection-panel h3 {
    color: #9d4edd;
    margin-bottom: 15px;
    text-align: center;
}

#collected-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.collected-item {
    background: rgba(30, 30, 60, 0.8);
    padding: 10px;
    border-radius: 8px;
    border-left: 3px solid #9d4edd;
}

.collected-item h4 {
    font-size: 0.9em;
    margin-bottom: 5px;
    color: #9d4edd;
}

.collected-item p {
    font-size: 0.75em;
    color: #c0c0c0;
}

/* 유틸리티 클래스 */
.hidden {
    display: none !important;
}

/* 시대별 테마 색상 - 각 시대에 맞게 UI 색상 변경용 */
.ancient-theme {
    --primary-color: #cd853f;
    --secondary-color: #8b4513;
    --accent-color: #daa520;
}

.medieval-theme {
    --primary-color: #6a0dad;
    --secondary-color: #483d8b;
    --accent-color: #800080;
}

.renaissance-theme {
    --primary-color: #b8860b;
    --secondary-color: #cd5c5c;
    --accent-color: #daa520;
}

.modern-theme {
    --primary-color: #4682b4;
    --secondary-color: #5f9ea0;
    --accent-color: #00bfff;
}

.future-theme {
    --primary-color: #00ced1;
    --secondary-color: #7fffd4;
    --accent-color: #40e0d0;
}

/* 반응형 스타일 */
@media (max-width: 768px) {
    .timeline-navigation {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    #era-info, #book-shelf, #historical-chat {
        width: 90%;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
    }
    
    #book-shelf {
        top: 170px;
    }
    
    #historical-chat {
        bottom: 80px;
    }
    
    .time-traveler-collection {
        left: 20px;
        right: auto;
    }
    
    #collection-panel {
        left: 0;
        right: auto;
    }
}
