/* ===================
   MAP.CSS - Map Interface Styles
   =================== */

/* Sidebar */
.sidebar {
    position: fixed;
    top: 20px; /* Float above the map with margin */
    left: 20px; /* Add left margin for floating effect */
    width: 350px;
    height: auto;
    max-height: calc(100vh - 40px); /* Account for top/bottom margins */
    background: rgba(26, 26, 26, 0.93);
    backdrop-filter: blur(15px);
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1500;
    box-shadow: 3px 0 15px rgba(0, 0, 0, 0.2);
    /* Hide scrollbar while keeping scroll functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer and Edge */
    border-radius: 12px; /* Full rounded corners for floating effect */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4); /* Enhanced shadow for floating effect */
}

/* Hide scrollbar for webkit browsers */
.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar.collapsed {
    transform: translateX(-390px); /* Move completely off screen including margins */
}

.sidebar:not(.collapsed) {
    box-shadow: 3px 0 25px rgba(0, 0, 0, 0.3);
}

/* Sidebar Header */
.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.02);
}

.sidebar-header h2 {
    color: #e0e0e0;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 6px 0;
    line-height: 1.2;
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #a0a0a0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    position: relative;
    z-index: 1600;
}

.sidebar-toggle:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.4);
    color: #667eea;
}

.sidebar-toggle i {
    transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

/* Company Branding */
.company-branding {
    padding: 24px 16px 24px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.company-name {
    color: #e6b800;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    text-align: center;
    opacity: 1;
    line-height: 1.2;
}

/* Portfolio Statistics */
.portfolio-stats {
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-box:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

.stat-number {
    font-size: 16px;
    font-weight: 600;
    color: #e0e0e0;
    line-height: 1.2;
    margin-bottom: 2px;
}

.stat-label {
    font-size: 10px;
    color: #8b8b8b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Filter Section */
.filter-section {
    padding: 16px;
}

.filter-section h3 {
    color: #e0e0e0;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 6px 0;
    line-height: 1.2;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}





/* Category Filters */
.category-filters {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.category-filter {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.03);
}

.category-filter:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

.category-header {
    display: flex;
    align-items: flex-start;
    padding: 10px;
    cursor: pointer;
    gap: 10px;
}

.category-checkbox {
    position: relative;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.category-checkbox input {
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    margin: 0;
}

.category-checkbox .checkmark {
    position: absolute;
    top: 0;
    left: 0;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.1);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.category-checkbox input:checked + .checkmark {
    background: #e6b800;
    border-color: #e6b800;
}

.category-checkbox .checkmark::after {
    content: '';
    position: absolute;
    display: none;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.category-checkbox input:checked + .checkmark::after {
    display: block;
}

.category-icon {
    width: 28px;
    height: 28px;
    background: rgba(230, 184, 0, 0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
            color: #e6b800;
    font-size: 12px;
    flex-shrink: 0;
}

.category-info {
    flex: 1;
    min-width: 0;
}

.category-name {
    color: #e0e0e0;
    font-size: 13px;
    font-weight: 500;
    word-break: break-word;
    line-height: 1.3;
    margin-bottom: 2px;
}

.category-count {
    color: #8b8b8b;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.expand-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #a0a0a0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    flex-shrink: 0;
}

.expand-btn:hover {
    color: #e0e0e0;
    background: rgba(255, 255, 255, 0.1);
}

.expand-btn i {
    transition: transform 0.3s ease;
}

.expand-btn.expanded i {
    transform: rotate(180deg);
}

/* Subcategory Filters */
.subcategory-filters {
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.subcategory-filters.collapsed {
    max-height: 0;
    padding: 0;
    overflow: hidden;
}

.subcategory-checkbox {
    display: flex;
    align-items: center;
    padding: 10px 20px 10px 48px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.subcategory-checkbox::before {
    content: '';
    position: absolute;
    left: 32px;
    top: 50%;
    width: 8px;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%);
}

.subcategory-checkbox:hover {
    background: rgba(255, 255, 255, 0.05);
}

.subcategory-checkbox input {
    width: 16px;
    height: 16px;
    opacity: 0;
    margin: 0;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
}

.subcategory-checkbox input::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.subcategory-checkbox input:checked::before {
    background: #e6b800;
    border-color: #e6b800;
}

.subcategory-checkbox input:checked::after {
    content: '✓';
    position: absolute;
    left: 3px;
    top: 0px;
    font-size: 11px;
    color: white;
    font-weight: bold;
}

.subcategory-name {
    color: #c0c0c0;
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

.subcategory-count {
    color: #8b8b8b;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.category-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}





/* Map Container */
.map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* Map Controls Styling (Google Maps style) */
.mapboxgl-ctrl-group {
    background: rgba(255, 255, 255, 0.9) !important;
    border: none !important;
    border-radius: 4px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
    overflow: hidden !important;
}

.mapboxgl-ctrl-group button {
    width: 28px !important;
    height: 28px !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
    background-color: transparent !important;
    transition: background-color 0.2s ease !important;
}

.mapboxgl-ctrl-group button span {
    transform: scale(0.8) !important;
}

.mapboxgl-ctrl-group button:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
}

.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass {
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-bottom: none !important;
    order: 1 !important;  /* Ensure compass is at the bottom */
}

/* Make compass button more visible */
.mapboxgl-ctrl-compass {
    cursor: pointer !important;
}

.mapboxgl-ctrl-compass:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
}

/* Custom reset view button */
.mapboxgl-ctrl-reset-view {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
}

/* Scale control styling */
.mapboxgl-ctrl-scale {
    border: 2px solid #666 !important;
    border-top: none !important;
    background-color: rgba(255, 255, 255, 0.75) !important;
    padding: 0 5px !important;
    color: #666 !important;
    font-size: 10px !important;
    border-radius: 0 0 3px 3px !important;
}

/* Container for the compass - move up to clear black overlay and fit in clean rectangle */
.mapboxgl-ctrl-bottom-right {
    margin-right: 10px !important;
    margin-bottom: 70px !important; /* Move up slightly more to fit in clean rectangle */
}

/* Container for the left-side controls - move up to clear black overlay */
.mapboxgl-ctrl-bottom-left {
    margin-left: 10px !important;
    margin-bottom: 60px !important; /* Move up significantly to clear black overlay */
}

/* Compass hint indication */
.compass-hint {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #e6b800;
    font-size: 10px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.compass-hint i {
    margin-right: 4px;
    font-size: 9px;
}

/* Show hint on compass hover */
.mapboxgl-ctrl-group:hover .compass-hint {
    opacity: 1;
}

/* Global Impact Section */
.global-impact-section {
    padding: 0 16px 16px 16px;
    margin-top: -8px;
}

.global-impact-toggle {
    width: 100%;
    background: rgba(26, 26, 26, 0.95);
    border: 2px solid #ffff00;
    border-radius: 8px;
    color: #ffff00;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.global-impact-toggle:hover {
    background: rgba(26, 26, 26, 1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 0, 0.2);
}

.global-impact-toggle.active {
    background: #ffff00;
    color: #1a1a1a;
    border-color: #1a1a1a;
}

.global-impact-toggle .highlight-status {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.global-impact-toggle i {
    font-size: 18px;
}

.map {
    width: 100%;
    height: 100vh; /* Full viewport height since no header */
    position: relative;
}

/* Map Controls - Top Right */
.map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.user-info-floating {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    color: #e0e0e0;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.user-info-floating i {
    color: #e6b800;
    font-size: 12px;
}

.map-control-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e0e0e0;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.map-control-btn:hover {
    background: rgba(26, 26, 26, 1);
    border-color: rgba(230, 184, 0, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.map-control-btn i {
    color: #e6b800;
    font-size: 12px;
    width: 14px;
    text-align: center;
}

.map-control-btn.lock-btn:hover {
    border-color: rgba(255, 165, 0, 0.3);
    color: #ffa500;
}

.map-control-btn.lock-btn:hover i {
    color: #ffa500;
}

.map-control-btn.logout-btn:hover {
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.map-control-btn.logout-btn:hover i {
    color: #ef4444;
}

/* Map Portfolio Disclaimer */
.map-disclaimer {
    position: absolute;
    bottom: 15px; /* Back to original position - DO NOT MOVE */
    right: 65px; /* Leave space for Mapbox navigation controls */
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 900;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    letter-spacing: 0.2px;
    backdrop-filter: blur(4px);
    pointer-events: none;
    user-select: none;
    transition: opacity 0.3s ease;
}

.map-disclaimer:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.5);
}

/* Floating Toggle Button */
.floating-toggle {
    position: fixed;
    top: 20px; /* Align with sidebar top margin */
    left: 20px;
    width: 48px;
    height: 48px;
    background: rgba(26, 26, 26, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #667eea;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    z-index: 1600;
}

/* Position floating toggle outside sidebar when sidebar is open - add spacing */
.sidebar:not(.collapsed) ~ .map-container .floating-toggle {
    left: 390px; /* Add 20px spacing between sidebar and toggle button */
}

.floating-toggle:hover {
    background: rgba(26, 26, 26, 0.95);
    border-color: rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Notification Badge on Floating Toggle */
.toggle-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: #e6b800;
    border: 2px solid rgba(26, 26, 26, 0.9);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
    animation: gentlePulse 2.5s ease-in-out infinite;
}

.floating-toggle.has-notification .toggle-notification-badge {
    opacity: 1;
    transform: scale(1);
}

/* Gentle pulse animation for notification badge */
@keyframes gentlePulse {
    0%, 80%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    40% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Hide badge on hover to avoid visual conflicts */
.floating-toggle:hover .toggle-notification-badge {
    opacity: 0.5;
}

/* Map Style Selector */
.map-style-selector {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(26, 26, 26, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
    min-width: 200px;
}

.style-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #e0e0e0;
    font-size: 14px;
    font-weight: 500;
}

.style-option:hover {
    background: rgba(102, 126, 234, 0.1);
}

.style-option.active {
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
}

.style-option i {
    width: 20px;
    text-align: center;
    color: #667eea;
}

/* Mapbox Customizations */
.mapboxgl-popup {
    z-index: 1001;
}

/* Fix for marker positioning stability on globe projection */
.mapboxgl-marker {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    will-change: transform;
    opacity: 1;
    transition: opacity .2s;
}

.mapboxgl-popup-content {
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #e0e0e0;
    padding: 0;
    max-width: 300px;
}

.mapboxgl-popup-close-button {
    color: #a0a0a0;
    font-size: 20px;
    padding: 8px;
}

.mapboxgl-popup-close-button:hover {
    color: #e0e0e0;
}

.mapboxgl-popup-tip {
    border-top-color: rgba(26, 26, 26, 0.95);
}

/* Map Container Adjustments */
.main-content {
    position: relative;
    height: calc(100vh - 60px);
}

.map-container {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Sidebar Overlay Effect - DISABLED */
/* .sidebar:not(.collapsed) ~ .map-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    z-index: 1000;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.4s ease;
} */

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        top: 60px;
        height: calc(100vh - 60px);
    }
    
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
    
    .portfolio-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .floating-toggle {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
    
    .toggle-notification-badge {
        width: 10px;
        height: 10px;
        top: -3px;
        right: -3px;
    }
    
    .map-style-selector {
        right: 16px;
        top: 16px;
        min-width: 180px;
    }
    
    /* Mobile adjustments - move up to clear black overlay */
    .mapboxgl-ctrl-bottom-right {
        margin-right: 8px !important;
        margin-bottom: 60px !important; /* Move up to clear black overlay and fit clean rectangle on mobile */
    }
    
    .mapboxgl-ctrl-bottom-left {
        margin-left: 8px !important;
        margin-bottom: 50px !important; /* Move up to clear black overlay on mobile */
    }
    
    .map-disclaimer {
        bottom: 15px; /* Back to original position on mobile */
        right: 16px;
        font-size: 9px;
    }
}

/* Custom Marker Styles */
.custom-marker {
    position: relative;
    z-index: 1;
}

/* World-wrapped marker styles */
.wrapped-marker {
    position: relative;
}

.wrap-indicator {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 16px;
    height: 16px;
    background: rgba(230, 184, 0, 0.9);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    pointer-events: none;
    z-index: 2;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}