/* 
 * TravelLog Map - Frontend 2025 Design 
 */
:root {
    --jmp-accent: #FF6B00;
    /* Vibrant Travel Orange */
    --jmp-accent-hover: #E65A00;
    --jmp-glass-bg: rgba(255, 255, 255, 0.7);
    --jmp-glass-border: rgba(255, 255, 255, 0.3);
    --jmp-text-dark: #0F172A;
    --jmp-text-muted: #475569;
    --jmp-radius: 16px;
    --jmp-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Base plugin wrapper styles (allow parent to handle overflow) */
.jmp-frontend-wrapper {
    position: relative;
    width: 100%;
}

.jmp-atlas-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #f8fafc;
}

.jmp-atlas-fullscreen .map-container {
    height: 100%;
}

.jmp-atlas-back {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1002;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--jmp-text-dark);
    padding: 10px 14px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
    border: 1px solid rgba(15, 23, 42, 0.12);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.jmp-atlas-back::before {
    content: "←";
    font-weight: 900;
}
.jmp-atlas-back:hover {
    border-color: rgba(255, 107, 0, 0.35);
    transform: translateY(-1px);
}

.travel-map {
    width: 100%;
    height: 100%;
    /* Fill container */
    min-height: 500px;
    background: #f8fafc;
}

.jmp-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(248, 250, 252, 0.8);
    color: #0f172a;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.03em;
    z-index: 950;
}

/* Full Screen Template Override */
.jmp-full-screen .travel-map {
    height: 100vh;
}

/* Glassmorphism Stats Box */
.journey-stats {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 900;
    /* Lower than header */
    max-width: 280px;
    background: var(--jmp-glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 12px 18px;
    border-radius: 12px;
    border: 1px solid var(--jmp-glass-border);
    box-shadow: var(--jmp-shadow);
    transition: all 0.3s ease;
}

/* Minimal Mode for Shortcode */
.jmp-minimal-mode .journey-stats,
.jmp-minimal-mode .stats-toggle-btn,
.jmp-minimal-mode .jmp-control-panel {
    display: none !important;
}

/* Minimal Mode Play Button - Hidden by Default, Shown in Minimal Mode */
.jmp-minimal-play-btn {
    display: none;
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: linear-gradient(135deg, #FF6B00, #FF8C42);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(255, 107, 0, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.jmp-minimal-play-btn:hover {
    background: linear-gradient(135deg, #FF8C42, #FFAA66);
    transform: translateX(-50%) scale(1.05) translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 107, 0, 0.5);
}

.jmp-minimal-mode .jmp-minimal-play-btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

.jmp-minimal-play-btn .jmp-play-icon {
    font-size: 16px;
}

.jmp-minimal-play-btn.is-complete {
    background: linear-gradient(135deg, #475569, #64748B);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Homepage CTA under map (only injected on front page) */
.jmp-home-cta {
    margin-top: 14px;
    display: flex;
    justify-content: center;
}
.jmp-home-cta-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(15, 23, 42, 0.14);
    color: #0f172a;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: 0.02em;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}
.jmp-home-cta-link:hover {
    border-color: rgba(255, 107, 0, 0.35);
    transform: translateY(-1px);
}


.journey-stats:hover {
    background: rgba(255, 255, 255, 0.85);
    transform: translateY(-2px);
}

.journey-stats h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--jmp-text-dark);
    letter-spacing: -0.01em;
    line-height: 1.2;
}

/* Control Panel */
.jmp-control-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 900;
    width: 280px;
    background: var(--jmp-glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--jmp-glass-border);
    box-shadow: var(--jmp-shadow);
    color: var(--jmp-text-dark);
}

.jmp-hidden {
    display: none !important;
}
.jmp-control-section {
    margin-bottom: 14px;
}

.jmp-control-section:last-child {
    margin-bottom: 0;
}

.jmp-control-title {
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.jmp-control-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
}

.jmp-control-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.08);
    background: rgba(255,255,255,0.8);
    font-size: 13px;
}

.jmp-search-results {
    margin-top: 6px;
    max-height: 160px;
    overflow-y: auto;
    border-radius: 8px;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(0,0,0,0.05);
    display: none;
}

.jmp-search-item {
    padding: 8px 10px;
    font-size: 13px;
    cursor: pointer;
}

.jmp-search-item:hover {
    background: rgba(255,107,0,0.1);
}

.jmp-filter-group {
    margin-bottom: 10px;
}

.jmp-filter-title {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
}

.jmp-filter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.jmp-checkbox {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.75);
    border: 1px solid rgba(0,0,0,0.06);
    padding: 4px 8px;
    border-radius: 999px;
    cursor: pointer;
}

.jmp-reset-btn {
    width: 100%;
    margin-top: 10px;
    background: #111827;
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}

@media (max-width: 900px) {
    .jmp-control-panel {
        position: relative;
        top: auto;
        right: auto;
        margin: 10px auto;
        width: calc(100% - 20px);
    }
}

/* Close & Toggle Buttons */
.journey-stats-header:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.journey-stats-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.stats-toggle-btn {
    position: absolute;
    top: 30px;
    left: 30px;
    z-index: 901;
    /* Lower than header */
    background: var(--jmp-accent);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--jmp-shadow);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stats-toggle-btn:hover {
    transform: scale(1.05);
    background: var(--jmp-accent-hover);
}

/* Legend */
.jmp-legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 900;
    background: var(--jmp-glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--jmp-glass-border);
    box-shadow: var(--jmp-shadow);
    font-size: 12px;
    color: var(--jmp-text-dark);
    max-width: 260px;
}

.jmp-legend-title {
    font-weight: 800;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.jmp-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.jmp-legend-item:last-child {
    margin-bottom: 0;
}

.jmp-legend-swatch {
    width: 16px;
    height: 3px;
    border-radius: 999px;
    background: var(--jmp-accent);
}

@media (max-width: 900px) {
    .jmp-legend {
        position: relative;
        left: auto;
        bottom: auto;
        margin: 10px auto;
        width: calc(100% - 20px);
    }
}

/* Transitions for Hideable Box */
.journey-stats.collapsed {
    transform: translateX(-120%);
    opacity: 0;
    pointer-events: none;
}

/* Modern Controls */
.year-selector {
    margin-bottom: 12px;
}

.year-selector select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    color: var(--jmp-text-dark);
    cursor: pointer;
    transition: border 0.2s;
}

.year-selector select:focus {
    border-color: var(--jmp-accent);
    outline: none;
}

.play-btn {
    width: 100%;
    padding: 14px;
    background: var(--jmp-accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.2);
}

.play-btn:hover {
    background: var(--jmp-accent-hover);
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(255, 107, 0, 0.3);
}

/* Progress & Stats */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    margin-top: 12px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--jmp-accent);
    width: 0%;
    transition: width 0.3s ease;
}

.stats-grid {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--jmp-text-muted);
}

.stat-icon {
    font-size: 18px;
    opacity: 0.9;
}

/* Map Elements */
.jmp-emoji-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.vehicle-bubble {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

/* Modern Popups */
.leaflet-popup-content-wrapper {
    padding: 0;
    overflow: hidden;
    border-radius: 16px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
}

.journey-popup-inner {
    padding: 16px 20px;
}

.journey-popup h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--jmp-text-dark);
}

/* Map Interactions */
.inactive-country {
    /* Keep this light: heavy SVG filters can make highlights look "broken" and hurt performance. */
    transition: fill-opacity 0.35s ease, opacity 0.35s ease, stroke-opacity 0.35s ease, stroke-width 0.35s ease;
}

.active-country {
    fill: var(--jmp-accent);
    stroke: var(--jmp-accent);
}

/* Responsive Overrides */
@media screen and (max-width: 600px) {
    .journey-stats {
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

/* Watermark */
/* Watermark */
.jmp-watermark {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    /* Match Leaflet controls */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 11px;
    color: #555;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.7);
    padding: 0 5px;
    pointer-events: auto;
    transition: all 0.2s;
    line-height: normal;
    border-radius: 4px;
}

.jmp-watermark:hover {
    color: var(--jmp-accent);
    background: #fff;
    opacity: 1;
}

/* Ensure it sticks to top right even in full screen */
.jmp-full-screen .jmp-watermark {
    position: fixed;
    top: 10px;
    right: 10px;
    bottom: auto;
}

@media (max-width: 768px) {
    .journey-stats {
        top: auto;
        bottom: 20px;
        left: 20px;
        right: 20px;
        width: auto;
        max-width: none;
        padding: 24px;
        border-radius: 20px;
        transform: translateY(0);
    }

    .stats-toggle-btn {
        top: auto;
        bottom: 20px;
        left: 20px;
    }

    .journey-stats.collapsed {
        transform: translateY(120%);
        opacity: 0;
        pointer-events: none;
    }

    .stats-grid {
        flex-direction: row;
        justify-content: space-around;
        margin-top: 20px;
        padding-top: 15px;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
    }

    .stat {
        flex-direction: column;
        text-align: center;
        gap: 5px;
    }
}
