/**
 * Map Base Controls Styling
 * 
 * Styling voor kaart controls (layer switcher, locate button, etc.)
 */

/* Layer control buttons */
.map-control-btn {
    padding: 0.375rem 0.75rem;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text);
    transition: background-color 0.2s, transform 0.1s;
}

.map-control-btn:hover {
    background: #336699 !important; /* Brand color */
    color: white !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.map-control-btn:hover i {
    color: white !important;
}

/* Active state voor geselecteerde layer */
.map-control-btn.active {
    background: var(--color-brand-primary) !important;
    color: var(--color-white) !important;
    border: none;
    font-weight: 500 !important;
}

.map-control-btn.active:hover {
    background: var(--color-brand-dark) !important;
    color: var(--color-white) !important;
}

/* Layer switcher container styling */
.map-layer-switcher {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: none;
    display: flex;
    flex-direction: column;
}

/* First button - rounded top corners */
.map-control-btn:first-child {
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
}

/* Last button - rounded bottom corners */
.map-control-btn:last-child {
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

/* Borders between buttons */
.map-control-btn:not(:last-child) {
    border-bottom: none;
}

/* Locate button styling */
.map-locate-btn {
    padding: 0.375rem 0.75rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text);
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

/* Center icon when text is hidden (mobile) */
.map-locate-btn:has(i:only-child),
.map-locate-btn:has(i:not(:has(+ *))) {
    gap: 0;
    padding: 0.5rem;
}

.map-locate-btn:hover {
    background: #336699 !important; /* Brand color */
    color: white !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.map-locate-btn:hover i {
    color: white !important;
}

.map-locate-btn:active {
    transform: scale(0.98);
}

/* MapLibre native controls styling (zoom, navigation) */
.maplibregl-ctrl-group {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(4px) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-md) !important;
    margin: 0 !important;
    margin-bottom: 0 !important;
}

.maplibregl-ctrl-group button {
    background: transparent !important;
    border: none !important;
    color: var(--color-text) !important;
    transition: background-color 0.2s, transform 0.1s !important;
}

.maplibregl-ctrl-group button:hover {
    background: #336699 !important; /* Brand color */
    color: white !important;
    transform: translateY(-1px) !important;
    border-radius: var(--radius-md) !important; /* Add border radius on hover */
    border: none !important; /* Remove any borders on hover */
    outline: none !important; /* Remove outline */
}

/* Zoom controls (zoom-in, zoom-out, compass) - zachte grijze hover */
.maplibregl-ctrl-zoom-in:hover,
.maplibregl-ctrl-zoom-out:hover,
.maplibregl-ctrl-compass:hover {
    background: #333 !important; /* Zachte grijze hover */
    color: white !important;
}

/* Zorg dat iconen in zoom controls wit worden bij hover */
.maplibregl-ctrl-zoom-in:hover .maplibregl-ctrl-icon,
.maplibregl-ctrl-zoom-out:hover .maplibregl-ctrl-icon,
.maplibregl-ctrl-compass:hover .maplibregl-ctrl-icon {
    color: white !important;
    fill: white !important;
    stroke: white !important;
    /* Filter om zwarte iconen (background-image of SVG) wit te maken */
    filter: brightness(0) invert(1) !important;
}

/* SVG paths in iconen - zorg dat ze wit worden bij hover */
.maplibregl-ctrl-zoom-in:hover .maplibregl-ctrl-icon svg,
.maplibregl-ctrl-zoom-out:hover .maplibregl-ctrl-icon svg,
.maplibregl-ctrl-compass:hover .maplibregl-ctrl-icon svg {
    fill: white !important;
    stroke: white !important;
}

/* SVG paths binnen iconen */
.maplibregl-ctrl-zoom-in:hover .maplibregl-ctrl-icon svg path,
.maplibregl-ctrl-zoom-out:hover .maplibregl-ctrl-icon svg path,
.maplibregl-ctrl-compass:hover .maplibregl-ctrl-icon svg path {
    fill: white !important;
    stroke: white !important;
}

/* Ensure zoom control buttons have border radius on hover */
.maplibregl-ctrl-group button:first-child:hover {
    border-top-left-radius: var(--radius-md) !important;
    border-top-right-radius: var(--radius-md) !important;
    border: none !important;
}

.maplibregl-ctrl-group button:last-child:hover {
    border-bottom-left-radius: var(--radius-md) !important;
    border-bottom-right-radius: var(--radius-md) !important;
    border: none !important;
}

/* Hide container border when any button is hovered */
.maplibregl-ctrl-group:has(button:hover) {
    border: 1px solid transparent !important; /* Make border transparent on hover */
}

.maplibregl-ctrl-group button:active {
    transform: scale(0.95) !important;
}

/* Scale control styling */
.maplibregl-ctrl-scale {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(4px) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-md) !important;
    padding: 0.25rem 0.5rem !important;
    font-size: var(--font-size-sm) !important;
    color: var(--color-text) !important;
    margin: 0 !important;
    margin-bottom: 0 !important;
}

/* Hover tooltip styling - shared across all map layers */
.maplibregl-popup.hover-tooltip {
    pointer-events: none; /* Don't block mouse events */
    z-index: 10000; /* Ensure tooltips appear above everything */
}

.maplibregl-popup.hover-tooltip .maplibregl-popup-content {
    padding: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 8px;
    max-width: none !important; /* Allow tooltip to be as wide as needed */
    width: max-content !important; /* Fit content width */
}

.maplibregl-popup.hover-tooltip .maplibregl-popup-tip {
    display: none; /* Hide the arrow for cleaner look */
}

/* Mobile responsive: hide text, show only icons, size similar to hamburger menu */
@media (max-width: 640px) {
    .map-control-btn,
    .map-locate-btn {
        padding: 0.5rem; /* Similar to hamburger menu */
        min-width: 2.75rem; /* ~44px, slightly wider than hamburger (40px) */
        min-height: 2.25rem; /* ~36px, same as hamburger */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Hide text on small screens, keep only icons */
    .map-control-btn i,
    .map-locate-btn i {
        margin: 0;
    }
    
    /* Hide text nodes (everything except the icon) */
    .map-control-btn {
        font-size: 0;
    }
    
    .map-control-btn i {
        font-size: 1rem; /* Slightly larger icon for visibility */
    }
    
    .map-locate-btn {
        font-size: 0;
        gap: 0 !important; /* Remove gap when text is hidden */
        padding: 0.5rem; /* Center icon with equal padding */
        justify-content: center; /* Center icon */
    }
    
    .map-locate-btn i {
        font-size: 1rem; /* Slightly larger icon for visibility */
        margin: 0 !important; /* Remove any margin */
    }
    
    /* Layer switcher container */
    .map-layer-switcher {
        border-radius: var(--radius-md);
    }
    
    /* Search toggle button mobile styling */
    .map-search-toggle {
        padding: 0.5rem !important;
        min-width: 2.75rem !important; /* Same as other controls */
        min-height: 2.25rem !important;
        font-size: 1rem !important;
    }
    
    /* Search box mobile styling */
    .map-search-box {
        min-width: 280px !important;
    }
    
    /* Zoom controls - same size as other controls */
    .maplibregl-ctrl-group {
        border-radius: var(--radius-md) !important;
    }
    
    .maplibregl-ctrl-group button {
        width: 2.75rem !important; /* Same as other controls */
        height: 2.25rem !important;
        font-size: 1rem !important;
    }
    
    /* Info button (attribution) - keep small */
    .maplibregl-ctrl-attrib {
        /* Keep original small size */
    }
}

