* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    overflow: hidden;
    background: #020617;
    color: white;
}

#map {
    width: 100vw;
    height: 100vh;
}

/* Base Marker Style */
.canal-marker {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 34px;
    height: 34px;
    border: 2px solid #ffffff;
    border-radius: 6px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.canal-marker svg {
    width: 20px;
    height: 20px;
    color: #ffffff; /* All icons will render white against their colored backdrops */
}

.canal-marker:hover {
    transform: scale(1.2);
    z-index: 999;
}

/* Category Color Coding */
.bg-navigation { background-color: #002f4a; }   /* Deep Trust Blue */
.bg-structure { background-color: #5c6b73; }    /* Engineering Slate Gray */
.bg-facility { background-color: #1c7c54; }     /* Amenity Green */
.bg-hydraulic { background-color: #0a5b8a; }   
.bg-access { background-color: #9d6408; }
.bg-industrial { background-color: #273032; }
.bg-terrain { background-color: #1c7c54; }

.sidebar {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
    width: 340px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 20px;
    border-radius: 28px;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255,255,255,0.08);
    transition:
    width 0.35s ease,
    transform 0.35s ease,
    opacity 0.35s ease;
}

.sidebar.collapsed {
    width: 78px;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-content {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    height: 0;
    transform: translateX(-10px);
    transition: all 0.25s ease;
}

.sidebar-content {
    transition: all 0.25s ease;
}

.persistent-header {
    position: relative;
    z-index: 20;
}

.sidebar.collapsed .title {
    display: none;
}

.sidebar.collapsed .persistent-header {
    justify-content: center;
    margin-bottom: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.collapse-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: white;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.25s ease;
}

.collapse-btn:hover {
    background: rgba(255,255,255,0.12);
    transform: scale(1.03);
}

.collapsed-title {
    display: none;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin-top: 12px;
}

.sidebar.collapsed .collapsed-title {
    display: block;
}

.context-card {
    border-radius: 18px;
    background: rgb(30,41,59);
    border: 1px solid rgb(71,85,105);
    padding: 16px;
    gap: 10px;
}

.context-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
}

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

.poi-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
}

.poi-button.active {
    background: rgb(59,130,246);
    color: white;
}

.poi-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    padding: 5px 10px 5px 5px;
    white-space: nowrap;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;

}

.poi-chip svg {
    width: 20px;
    height: 20px;
}

.poi-chip.active {
    background: rgb(59,130,246);
    color: white;
}

.poi-chip:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    transform: translateY(-1px);
    color: #334155;
}

.poi-chip-close {
    font-weight: bold;
    font-size: 14px;
    margin-left: auto;
}

.poi-close {
    margin-left: 4px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    opacity: 0.8;
}

.poi-popup{
    min-width:220px;
}

.poi-title{
    font-weight:600;
    font-size:15px;
}

.poi-category{
    margin-top:4px;
    color:#64748b;
    font-size:12px;
}

.poi-address{
    margin-top:10px;
    line-height:1.45;
    font-size:13px;
}

.nearby-error {

    padding:10px;

    border-radius:12px;

    background:#fef3c7;

    border:1px solid #f59e0b;

    color:#92400e;

    font-size:13px;

}

.context-action {

    display: flex;

    align-items: center;

    gap: 12px;

    padding: 8px 0;

    cursor: pointer;

}

.title {
    font-size: 26px;
    font-weight: 500;
    margin: 0 0 6px;
}

.subtitle {
    font-size: 14px;
    line-height: 1.6;
    color: #94a3b8;
    margin-bottom: 20px;
}

.search-area-button {
    position: absolute;
    /* float: left; */
    top: 10px;
    right: 50px;
    /* top: 72px;
    left: 50%;
    transform: translateX(-50%); */
    z-index: 100;
    /* display: flex; */
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: white;
    color: #1e293b;
    font-size: 13px;
    font-weight: 300;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.search-area-button:hover {
    transform:
        translateX(-10%)
        translateY(-1px);

    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.22);
}

.status-card,
.info-card {
    border-radius: 20px;
    padding: 14px;
    margin-bottom: 18px;
}

.status-card {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.info-card {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.card-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
    color: #93c5fd;
}

.card-text {
    font-size: 14px;
    line-height: 1.5;
    color: #e2e8f0;
}

.layers {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.layer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-radius: 18px;
    background: #1e293b;
    border: 1px solid rgba(148, 163, 184, 0.15);
    font-size: 14px;
}

.layer-toggle {

    display: flex;

    align-items: center;

    gap: 8px;

}

.layer-toggle i {
    font-size: 20px;
}


.layer-group {
    margin-bottom: 12px;
}

/* style="font-size:12px; text-transform:uppercase; letter-spacing:0.08em; color:#94a3b8; margin-bottom:10px;" */
.layer-group-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    /* font-weight: 600; */
    font-size:12px;
    text-transform:uppercase;
    letter-spacing:0.08em;
    color:#94a3b8;
    /* margin-bottom:10px; */
    border: none;
    background: transparent;
    cursor: pointer;
}

.layer-group-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-left: 8px;
}

.layer-group-content.collapsed {
    display: none;
}


.layer-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.layer-icon svg {
    width: 20px;
    height: 20px;
}

.layer-icon svg path {
	stroke: #ffffff;;
	fill: #ffffff;
}

.icon-large {
    font-size: 48px;
    color: #0077cc; /* Water blue */
}

.icon-green {
    font-size: 24px;
    color: #2ecc71;
}

.maplibregl-popup-content {
    border-radius: 18px !important;
}

#map-legend {
    display: none;
}

.map-legend {
    position: absolute;
    bottom: 24px;
    right: 24px;
    min-width: 220px;
    padding: 14px 16px;
    border-radius: 18px;
    /* background: rgba(15,23,42,0.78); */
    background: white;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.12);
    /*color: white;*/
    color: #728299;
    font-family: sans-serif;
    z-index: 100;
    box-shadow:
    0 8px 32px rgba(0,0,0,0.28);
}

.legend-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
    text-transform: uppercase
    /*color: #cbd5e1;*/
    color: #475569;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 13px;
}

.legend-color {
    width: 18px;
    height: 4px;
    border-radius: 999px;
    flex-shrink: 0;
}


.search-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}


#search-input {
    width: 100%;
    padding: 10px 40px 10px 38px;
    border-radius: 12px;
    border: 1px solid rgba(
        255,
        255,
        255,
        0.25
    );
    background: rgba(
        255,
        255,
        255,
        0.15
    );
    backdrop-filter: blur(10px);
    font-size: 14px;
    color: #e2e8f0;
}


#search-results {
    display: none;
    width: 100%;
    padding: 10px 40px 10px 38px;
    border-radius: 12px;
    border: 1px solid rgba(
        255,
        255,
        255,
        0.25
    );
    background: rgba(
        255,
        255,
        255,
        0.15
    );
    opacity: 1.0;
    backdrop-filter: blur(10px);
    font-size: 14px;
}


.search-icon {
    position: absolute;
    left: 12px;
    display: flex;
    align-items: center;
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 10px;
    /* display: flex; */
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    color: white;
    z-index: 20;
}

.search-result-error {
    display: flex;
    align-items: flex-start;
    gap: 10px;

    padding: 14px;
}

.search-result-error-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 28px;
    height: 28px;

    flex-shrink: 0;

    border-radius: 50%;

    background: #fef2f2;
    color: #dc2626;

    font-size: 15px;
}

.search-result-error-content {
    min-width: 0;
}

.search-result-error-title {
    font-size: 13px;
    font-weight: 600;

    color: #334155;
}

.search-result-error-message {
    margin-top: 3px;

    font-size: 12px;
    line-height: 1.4;

    color: #64748b;
}

.map-loading {
    position: absolute;
    inset: 0;
    z-index: 1000;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(2px);
}

.map-loading.hidden {
    display: none;
}

.install-links a {
    display: inline-flex;
    margin-left: 24px;
    text-decoration: none;
    color: #333;
    font-weight: 600;
    font-size: 14px;
}


.install-links a.install-btn {
    /* background: #007BFF;
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px; */
    padding: 10px 20px; 
    cursor:pointer; 
    background:#ffc800; 
    color:white; 
    border:none; 
    border-radius:28px;
    transition: transform 0.2s ease, color 0.2s ease;
}

.install-links a.install-btn:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.spinner {
    width: 42px;
    height: 42px;

    border: 4px solid rgba(255,255,255,.25);
    border-top-color: white;
    border-radius: 50%;

    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 12px;
    color: white;
    font-size: 14px;
}

@media (max-width: 768px) {
    .sidebar {
    width: calc(100vw - 32px);
    }
}