/* Explore The Globe - Premium Exploration Experience System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;600;700;800&display=swap');

:root {
    --bg-dark: #030712;
    --bg-card: rgba(10, 18, 32, 0.94);
    --bg-glass: rgba(8, 14, 26, 0.80);
    --border-glow: rgba(56, 176, 0, 0.35);
    --border-subtle: rgba(255, 255, 255, 0.08);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-green: #38b000;
    --accent-emerald: #00ff87;
    --accent-cyan: #00f2ff;
    --accent-gold: #ffb703;
    --accent-pink: #ff2a6d;
    
    --font-heading: 'Outfit', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;
    --radius-full: 9999px;
    
    --shadow-glow: 0 0 30px rgba(56, 176, 0, 0.25);
    --shadow-card: 0 20px 40px rgba(0, 0, 0, 0.6);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
}

/* App Canvas Container */
#app-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-dark);
}

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

/* Star background — drawn once to canvas, always behind globe */
#star-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    display: block;
}

/* Header & Brand Navbar */
.app-header {
    position: absolute;
    top: 20px;
    left: 24px;
    right: 24px;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 10px 22px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-glow);
    box-shadow: var(--shadow-glow);
    pointer-events: auto;
}

.brand-icon {
    width: 26px;
    height: 26px;
    color: var(--accent-green);
}

.brand-title {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #ffffff 0%, var(--accent-emerald) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Search & Continent Filters Bar - Clean Stacking Context */
.search-filter-bar {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 520px;
    width: calc(100% - 340px);
}

.search-box {
    position: relative;
    z-index: 50;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 12px 18px 12px 46px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.25s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.search-input:focus {
    border-color: var(--accent-green);
    box-shadow: 0 0 20px rgba(56, 176, 0, 0.35);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    pointer-events: none;
}

/* Search Results Dropdown - High Z-Index & Layering Fix */
.autocomplete-list {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-md);
    max-height: 280px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.85);
}

.autocomplete-list.active {
    display: block;
}

.autocomplete-item {
    padding: 11px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.2s ease;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover, .autocomplete-item.selected {
    background: rgba(0, 242, 255, 0.12);
}

.autocomplete-item.not-found {
    color: var(--text-muted);
    font-style: italic;
    cursor: default;
    justify-content: center;
    padding: 14px;
}

.autocomplete-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.autocomplete-flag {
    font-size: 1.4rem;
    line-height: 1;
}

.autocomplete-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.autocomplete-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.autocomplete-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Continent Filter Chips - Layered Below Search Dropdown */
.continent-chips {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 4px;
}

.continent-chip {
    padding: 6px 14px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.continent-chip:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.continent-chip.active {
    background: rgba(56, 176, 0, 0.2);
    border-color: var(--accent-green);
    color: var(--accent-emerald);
    box-shadow: 0 0 12px rgba(56, 176, 0, 0.3);
}

/* Globe Control HUD Buttons */
.globe-hud {
    position: absolute;
    bottom: 24px;
    right: 24px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hud-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glow);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.hud-btn:hover {
    background: rgba(56, 176, 0, 0.25);
    border-color: var(--accent-green);
    color: var(--accent-emerald);
    transform: scale(1.08);
}

.hud-btn svg {
    width: 20px;
    height: 20px;
}

/* Hover Tooltip */
.globe-tooltip {
    position: fixed;
    z-index: 30;
    background: rgba(10, 18, 32, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 242, 255, 0.4);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    display: none;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.05s ease-out;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 15px rgba(0, 242, 255, 0.2);
    white-space: nowrap;
}

.globe-tooltip.visible {
    opacity: 1;
}

/* Interactive Country Explorer Side Panel / Drawer */
.country-drawer {
    position: absolute;
    top: 100px;          /* clear header (20px) + brand/search bar (~56px) + gap */
    bottom: 20px;
    right: 24px;
    width: 380px;
    z-index: 18;
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card), var(--shadow-glow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(420px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.country-drawer.open {
    transform: translateX(0);
}

.drawer-header-accent {
    height: 4px;
    width: 100%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan));
}

.drawer-header {
    padding: 20px 24px 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-subtle);
}

.country-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.country-flag-name {
    display: flex;
    align-items: center;
    gap: 12px;
}

.country-flag {
    font-size: 2rem;
    line-height: 1;
}

.country-name {
    font-family: var(--font-heading);
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text-primary);
}

.country-official {
    font-size: 0.85rem;
    color: var(--accent-emerald);
    font-weight: 500;
    margin-top: 2px;
}

.close-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--border-subtle);
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.drawer-content {
    padding: 20px 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
}

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

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2px;
}

/* Section Tabs Navigation Bar */
.section-tabs-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 10px;
    margin-top: 4px;
    scrollbar-width: none;
}

.section-tab {
    padding: 7px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.section-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.section-tab.active {
    background: rgba(56, 176, 0, 0.18);
    border-color: var(--accent-green);
    color: var(--accent-emerald);
}

/* Category Content Container */
.drawer-section-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 180px;
}

/* Card Image Styles */
.card-img-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.place-card:hover .card-img, .food-card:hover .card-img {
    transform: scale(1.04);
}

.card-placeholder-banner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(56, 176, 0, 0.08));
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    gap: 6px;
    padding: 12px;
}

.placeholder-icon {
    font-size: 1.8rem;
    opacity: 0.8;
}

.placeholder-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: center;
}

/* Places Cards */
.place-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.25s ease;
}

.place-card:hover {
    background: rgba(56, 176, 0, 0.08);
    border-color: rgba(56, 176, 0, 0.3);
    transform: translateY(-2px);
}

.place-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.place-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.location-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: rgba(0, 242, 255, 0.12);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 242, 255, 0.25);
}

.place-desc {
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.significance-pill {
    font-size: 0.8rem;
    color: var(--accent-emerald);
    background: rgba(56, 176, 0, 0.1);
    padding: 8px 12px;
    border-left: 3px solid var(--accent-green);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    line-height: 1.4;
}

/* Food Cards */
.food-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.25s ease;
}

.food-card:hover {
    background: rgba(255, 183, 3, 0.08);
    border-color: rgba(255, 183, 3, 0.3);
    transform: translateY(-2px);
}

.food-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.food-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.region-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: rgba(255, 183, 3, 0.12);
    color: var(--accent-gold);
    border: 1px solid rgba(255, 183, 3, 0.3);
}

.food-desc {
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* Culture Grid */
.culture-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 12px;
}

.culture-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.culture-card-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-emerald);
}

.culture-card-text {
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Vertical History Timeline */
.history-timeline {
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
    padding-left: 24px;
    margin-top: 6px;
}

.history-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: linear-gradient(180deg, var(--accent-green), var(--accent-cyan));
}

.timeline-step {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.timeline-node {
    position: absolute;
    left: -24px;
    top: 4px;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-emerald);
    box-shadow: 0 0 10px var(--accent-green);
}

.timeline-era {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timeline-period {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.timeline-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.timeline-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Fact Cards & Non-Intrusive Fallback */
.fact-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.55;
    transition: all 0.25s ease;
}

.fact-card:hover {
    background: rgba(56, 176, 0, 0.08);
    border-color: rgba(56, 176, 0, 0.25);
}

.info-fallback {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.86rem;
    font-style: italic;
}

/* Responsive Viewport Layouts */
@media (max-width: 900px) {
    .search-filter-bar {
        width: calc(100% - 48px);
        max-width: 100%;
        top: 70px;
    }

    .country-drawer {
        width: calc(100% - 32px);
        right: 16px;
        left: 16px;
        top: auto;
        bottom: 16px;
        height: 65vh;
        transform: translateY(110%);
    }

    .country-drawer.open {
        transform: translateY(0);
    }
}
