* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary: #2a3f5f;
    --primary-light: #435d8b;
    --secondary: #e63946;
    --accent: #f9c74f;
    --text-dark: #1a1a2e;
    --text-light: #f7f7f9;
    --background: #f8f9fa;
    --card-bg: rgba(255, 255, 255, 0.95);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    
    --origin-color: #f5c542;
    --early-color: #3ca55c;
    --middle-color: #4169e1;
    --later-color: #ff6b6b;
    --modern-color: #9370db;
    
    --transition-standard: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background-color: var(--background);
    color: var(--text-dark);
    line-height: 1.6;
    font-weight: 400;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    background-color: var(--primary);
    color: var(--text-light);
    padding: 20px;
    height: 100vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 10;
}

.app-title {
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 20px;
}

.app-title h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.app-title p {
    font-size: 14px;
    opacity: 0.8;
    font-weight: 300;
}

.period-selection {
    margin-bottom: 30px;
}

.period-selection h2 {
    font-size: 18px;
    margin-bottom: 15px;
    font-weight: 600;
}

.period-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.period-option {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-standard);
    position: relative;
    overflow: hidden;
}

.period-option::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.1;
    z-index: -1;
    transition: var(--transition-standard);
}

.period-option:hover::before {
    opacity: 0.2;
}

.period-option.active::before {
    opacity: 0.3;
}

.period-option.all::before {
    background-color: white;
}

.period-option.origin::before {
    background-color: var(--origin-color);
}

.period-option.early::before {
    background-color: var(--early-color);
}

.period-option.middle::before {
    background-color: var(--middle-color);
}

.period-option.later::before {
    background-color: var(--later-color);
}

.period-option.modern::before {
    background-color: var(--modern-color);
}

.period-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
}

.period-color.all {
    background: linear-gradient(45deg, 
        var(--origin-color) 0%, 
        var(--early-color) 25%, 
        var(--middle-color) 50%, 
        var(--later-color) 75%, 
        var(--modern-color) 100%);
}

.period-color.origin {
    background-color: var(--origin-color);
}

.period-color.early {
    background-color: var(--early-color);
}

.period-color.middle {
    background-color: var(--middle-color);
}

.period-color.later {
    background-color: var(--later-color);
}

.period-color.modern {
    background-color: var(--modern-color);
}

.period-info {
    flex-grow: 1;
}

.period-name {
    font-weight: 500;
    font-size: 16px;
}

.period-years {
    font-size: 12px;
    opacity: 0.8;
}

.location-info-panel {
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.info-panel-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--accent);
}

.selected-location {
    margin-bottom: 20px;
}

.location-header {
    margin-bottom: 10px;
}

.location-name {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 5px;
}

.location-period {
    font-size: 14px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.location-period-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.location-description {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.key-figures {
    margin-top: 20px;
}

.key-figures h3 {
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: 600;
}

.figure-item {
    margin-bottom: 15px;
    padding-left: 15px;
    border-left: 2px solid rgba(255, 255, 255, 0.2);
}

.figure-name {
    font-weight: 500;
    font-size: 14px;
}

.figure-description {
    font-size: 12px;
    opacity: 0.8;
}

.related-migrations {
    margin-top: 20px;
}

.related-migrations h3 {
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: 600;
}

.migration-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    padding: 8px;
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.05);
}

.migration-direction {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.controls-bar {
    background-color: white;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 5;
    height: 60px;
}

.view-modes {
    display: flex;
    gap: 5px;
}

.view-mode {
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition-standard);
    border: 1px solid #e0e0e0;
}

.view-mode:hover {
    background-color: #f5f5f5;
}

.view-mode.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.time-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.time-slider-container {
    width: 300px;
}

.time-slider {
    width: 100%;
    cursor: pointer;
}

.time-display {
    min-width: 100px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

.playback-controls {
    display: flex;
    gap: 10px;
}

.control-button {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-standard);
    background-color: white;
    border: 1px solid #e0e0e0;
}

.control-button:hover {
    background-color: #f5f5f5;
}

.view-container {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    height: calc(100vh - 60px); /* Subtract the controls bar height */
}

#globe-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 10px 15px;
    box-shadow: var(--shadow);
    font-size: 13px;
    max-width: 250px;
    color: var(--text-dark);
    transform: translate(-50%, -100%);
    margin-top: -15px;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tooltip-header {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 14px;
}

.tooltip-period {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    margin-bottom: 5px;
}

.tooltip-period-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.tooltip-description {
    font-size: 12px;
    line-height: 1.4;
}

.tooltip-arrow {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
}

/* Search and information panel */
.search-container {
    padding: 0 20px 20px;
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    border-radius: 6px;
    border: none;
    outline: none;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
    transition: var(--transition-standard);
}

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

.search-input:focus {
    background-color: rgba(255, 255, 255, 0.15);
}

.historical-context {
    margin-top: 30px;
}

.historical-context h2 {
    font-size: 18px;
    margin-bottom: 15px;
    font-weight: 600;
}

.timeline-container {
    position: relative;
    padding-left: 20px;
    margin-top: 20px;
}

.timeline-line {
    position: absolute;
    top: 0;
    left: 6px;
    width: 2px;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.2);
}

.timeline-event {
    position: relative;
    margin-bottom: 20px;
}

.timeline-dot {
    position: absolute;
    left: -20px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--accent);
}

.timeline-year {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 5px;
}

.timeline-description {
    font-size: 13px;
    line-height: 1.5;
}

/* Loading screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: white;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.loading-subtitle {
    font-size: 16px;
    opacity: 0.8;
    margin-bottom: 40px;
}

.loader {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-progress {
    margin-top: 30px;
    width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    width: 0;
    background-color: white;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 14px;
}

/* Responsive design */
@media (max-width: 1200px) {
    .app-container {
        grid-template-columns: 280px 1fr;
    }
}

@media (max-width: 992px) {
    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }
    
    .sidebar {
        height: 100%;
        position: fixed;
        left: -320px;
        width: 320px;
        transition: var(--transition-standard);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .sidebar-toggle {
        position: absolute;
        top: 20px;
        right: -50px;
        width: 40px;
        height: 40px;
        background-color: var(--primary);
        border-radius: 0 8px 8px 0;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: var(--shadow);
    }
    
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        padding: 15px;
    }
    
    .time-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .time-slider-container {
        width: 100%;
    }
    
    .playback-controls {
        justify-content: center;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.animate-fade {
    animation: fadeIn 0.5s ease forwards;
}

.animate-slide {
    animation: slideUp 0.5s ease forwards;
}

/* Timeline slider customization */
input[type=range] {
    -webkit-appearance: none;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    outline: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: var(--transition-standard);
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

input[type=range]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: var(--transition-standard);
    border: none;
}

input[type=range]::-moz-range-thumb:hover {
    transform: scale(1.1);
}

/* Etymology panel styles */
.etymology-panel {
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    padding: 20px;
    margin-top: 30px;
    margin-bottom: 20px;
}

.etymology-panel h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--accent);
}

.etymology-panel h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 15px 0 10px;
}

.etymology-panel p {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.distribution-list {
    list-style: none;
    padding: 0;
}

.distribution-list li {
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.distribution-list .region {
    font-weight: 600;
    margin-right: 5px;
}
