:root {
    --bg-color: #0b0f19;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;

    /* Map Colors */
    --map-ocean: #0b0f19;
    /* matches bg for clean look */
    --map-land: #1e293b;
    --map-land-hover: #334155;
    --map-stroke: #0f172a;

    /* Visit Timelines Colors - handled by D3 JS scale now */

    /* Glassmorphism settings */
    --glass-bg: rgba(15, 23, 42, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.app-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: radial-gradient(circle at 50% -20%, #1e293b 0%, var(--bg-color) 60%);
}

.header {
    position: absolute;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10;
    pointer-events: none;
    /* Let clicks pass through to map */
}

.header h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #e2e8f0 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.25rem;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

.header p {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.header .subtitle {
    font-size: 0.85rem;
    opacity: 0.7;
    font-weight: 300;
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2.25rem;
    }

    .header p {
        font-size: 0.95rem;
        padding: 0 1rem;
    }

    .legend {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
}

.legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--glass-bg);
    padding: 0.5rem 1rem;
    border-radius: 100px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: auto;
    /* Re-enable for the glass pill */
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.legend-gradient {
    width: 150px;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(to right, #1e3a8a, #2563eb, #3b82f6, #06b6d4, #0d9488, #10b981, #22c55e, #84cc16, #eab308, #f59e0b, #ea580c, #ef4444, #b91c1c);
}

.map-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    cursor: grab;
}

.map-container:active {
    cursor: grabbing;
}

#world-map {
    width: 100%;
    height: 100%;
    outline: none;
}

/* SVG Elements */
.country {
    fill: var(--map-land);
    stroke: var(--map-stroke);
    stroke-width: 0.5;
    transition: fill 0.3s ease, filter 0.3s ease, stroke-width 0.3s ease;
}

.country:hover {
    fill: var(--map-land-hover);
    stroke-width: 1;
    z-index: 10;
}

.country.visited {
    cursor: pointer;
}

.country.visited:hover {
    filter: brightness(1.3) drop-shadow(0 0 12px rgba(255, 255, 255, 0.4));
    stroke-width: 1.5;
    stroke: #ffffff;
}

/* Glassmorphism Tooltip */
.tooltip {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    width: 320px;
    max-width: 90vw;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    opacity: 1;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.1s linear;
    z-index: 100;
}

.tooltip.hidden {
    opacity: 0;
    transform: scale(0.95);
}

.tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.tooltip-header h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    margin: 0;
}

.badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Timeline vertical line */
.timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 5px;
    /* Ensure line spans full scroll height, not just visible height */
    height: calc(100% - 10px);
    width: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* Custom Scrollbar for Timeline */
.timeline::-webkit-scrollbar {
    width: 4px;
}

.timeline::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.timeline::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.timeline::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.timeline-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    position: relative;
}

/* Timeline dots */
.tl-dot {
    position: absolute;
    left: 0;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    /* Colors and shadows are applied inline via JS based on the year */
}

.tl-content {
    margin-left: 20px;
}

.tl-year {
    font-weight: 800;
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 0.15rem;
}

.tl-notes {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    font-weight: 300;
}

.tl-note-line {
    color: #94a3b8;
    /* Grey text */
    padding-bottom: 2px;
}

.tl-note-line:before {
    content: "• ";
    opacity: 0.6;
    margin-right: 4px;
}