@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@300..700&display=swap');

/* -------------------------------------------------------
   1. Root Variables & Base Layout
   ------------------------------------------------------- */
:root {
    --sidebar-width: 68px;
    --detail-width: 420px;
    --border-color: #eeeeee;
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --fav: #ef4444;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --slate-800: #1e293b;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    font-family: "Quicksand", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    background: #fff; 
    display: flex; 
    height: 100vh; 
    width: 100vw;
    overflow: hidden; 
    position: fixed; 
}

.left-rail { 
    display: flex; 
    height: 100vh; 
    flex: 0 0 auto; 
    z-index: 2000 !important; 
    overflow: visible !important; 
}

/* -------------------------------------------------------
   2. Column 1: Icon Bar & Navigation
   ------------------------------------------------------- */
.icon-bar {
    width: var(--sidebar-width);
    height: 100vh;
    background: #ffffff !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 100px 0 20px 0; 
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    overflow: visible !important; 
    z-index: 2001 !important; 
    position: relative;
    box-sizing: border-box;
}

.icon-bar .spacer { 
    flex-grow: 1 !important; 
    width: 100%; 
    height: auto !important;
}

.icon-bar a:last-child, 
.icon-bar div:last-child { 
    margin-bottom: 10px; 
}

.nav-link {
    position: relative;
    width: 42px;
    height: 42px;
    min-height: 42px;
    margin-bottom: 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    transition: var(--transition);
    cursor: pointer;
    flex-shrink: 0;
    text-decoration: none;
}

.nav-link svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    display: block;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.nav-link img {
    width: 24px;
    height: 24px;
    display: block;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.nav-link.active {
    color: var(--primary) !important;
    background-color: var(--primary-light) !important;
}

.nav-link:hover:not(.disabled):not(.active) {
    background: #f8fafc;
    color: var(--text-main);
}

.nav-link[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background: var(--slate-800);
    color: white;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 99999 !important;
    box-shadow: 4px 0 15px rgba(0,0,0,0.1);
}

.nav-link:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(15px);
}

.nav-link.disabled svg {
    opacity: 0.3;
    filter: grayscale(1);
    cursor: not-allowed !important;
}

.nav-link.disabled * {
    pointer-events: none;
}

.nav-link.disabled::after {
    /* color: #fda4af !important; */
}

/* -------------------------------------------------------
   3. Column 2: Detail Pane & UI Elements
   ------------------------------------------------------- */
.detail-pane {
    width: var(--detail-width);
    min-width: var(--detail-width);
    height: 100vh;
    background: #fff;
    border-right: 1px solid var(--border-color);
    position: relative;
    transition: margin-left var(--transition);
    z-index: 1000 !important;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}

.detail-pane.collapsed { margin-left: calc(var(--detail-width) * -1); }

#dynamicUI { flex: 1; width: 100%; overflow-y: auto; overflow-x: hidden; min-height: 0; }
#list { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#routeUI { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.header { padding: 20px; border-bottom: 1px solid #eee; }

.card { padding: 20px 16px; border: none; border-bottom: 1px solid #f1f5f9; background: #fff; cursor: pointer; transition: background 0.2s ease; position: relative; }
.card:hover { background: #f8fbff; }
.card.highlight-card { transform: translateX(4px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }

.route-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.route-link { font-weight: 700; font-size: 16px; color: var(--text-main); text-decoration: none; display: flex; align-items: center; gap: 6px; }

.variant-wrapper { background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; display: flex; align-items: center; transition: all 0.2s ease; }
.variant-wrapper:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15); }
.variant-tag { font-size: 11px; color: #64748b; font-weight: 600; text-decoration: none; padding: 4px 10px; }

.custom-dropdown { width: 100%; height: 38px; padding: 0 12px; border: 1px solid #cbd5e1; border-radius: 8px; background-color: #f8fafc; font-size: 13px; font-weight: 500; color: #334155; outline: none; cursor: pointer; box-sizing: border-box; transition: 0.2s ease; }
.custom-dropdown:hover { border-color: #94a3b8; }
.custom-dropdown:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

.tabs { display: flex; background: #f8fafc; border-bottom: 1px solid #eee; }
.tab { flex: 1; padding: 12px; text-align: center; cursor: pointer; font-weight: bold; font-size: 12px; color: var(--text-muted); }
.tab.active { color: var(--primary); border-bottom: 2px solid var(--primary); background: white; }

.content-area { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tab-content { display: none; padding-bottom: 20px; }
.tab-content.active { display: block; }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .3s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(16px); }

.switch-sm { width: 30px; height: 18px; margin-left: 10px; }
.switch-sm .slider:before { height: 12px; width: 12px; left: 3px; bottom: 3px; }
.switch-sm input:checked + .slider:before { transform: translateX(12px); }

.item-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; gap: 12px; border-bottom: 1px solid #f1f5f9; }
.item-row:hover { background-color: #f8fafc; }

.poi-body { display: flex; align-items: center; gap: 12px; flex: 1; cursor: pointer; }
.poi-name { font-size: 13px; font-weight: 600; color: var(--text-main); line-height: 1.2; }
.poi-group-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.cat-title { font-size: 11px; font-weight: 800; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; flex: 1; }

.btn-primary { width: 100%; padding: 14px; background: var(--primary); color: white; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; }
.btn-subtle-mini { width: 100%; padding: 12px 16px; background: #ffffff; color: var(--text-main); border: 1px solid #cbd5e1; border-radius: 10px; font-size: 13px; font-weight: 600; display: flex; align-items: center; }

.icon-action-btn { width: 38px; height: 38px; border-radius: 8px; border: 1px solid #cbd5e1; background: white; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #475569; transition: 0.2s; }
.icon-action-btn:hover { background: #f1f5f9; }
.btn-icon-delete { background: none; border: none; cursor: pointer; color: #ef4444; padding: 4px; border-radius: 4px; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.btn-icon-delete:hover { background: #fee2e2; }
.btn-icon-edit { background: none; border: none; cursor: pointer; color: #0284c7; padding: 4px; border-radius: 4px; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.btn-icon-edit:hover { background: #e0f2fe; }

/* -------------------------------------------------------
   4. Map, Filters & Right Pane
   ------------------------------------------------------- */
.main-content { flex: 1; position: relative; background: #aad3df; height: 100vh; overflow: hidden; }
#map-container { flex: 1; position: relative; background: #aad3df; }
#map { width: 100%; height: 100%; display: block; z-index: 1; }

.map-filter-bar { position: absolute; top: 20px; left: 20px; background: white; padding: 6px; border-radius: 12px; display: flex; align-items: center; gap: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 1100; border: 1px solid var(--border-color); }
.filter-btn { padding: 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; display: flex; align-items: center; transition: 0.2s; }
.filter-btn.active { background: #eff6ff; border-color: var(--primary); }
.filter-divider { width: 1px; height: 20px; background: #e2e8f0; margin: 0 4px; }
.filter-divider-nav { width: 20px; height: 1px; background: #e2e8f0; margin-bottom: 16px; }

#clearFilters { display: none; align-items: center; justify-content: center; width: 30px; height: 30px; color: #ef4444; background: #fef2f2; border-radius: 6px; border: 1px solid #fee2e2; cursor: pointer; font-weight: bold; transition: 0.2s; }
#clearFilters.visible { display: flex !important; }

.map-navigation-bar { position: absolute; top: 20px; left: 20px; z-index: 1000; display: flex; align-items: center; gap: 8px; }
.map-navigation-bar .child {
	background: white;
	box-shadow: 0 4px 15px rgba(0,0,0,0.15);
	border-radius: 12px;
	padding: 6px;
	display: flex; 
	align-items: center;
	gap: 8px;
}


.nav-overlay-btn { background: none; border: none; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 8px; font-size: 18px; color: var(--text-muted); transition: 0.2s; }
.nav-overlay-btn-grow { background: none; border: none; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 8px; font-size: 18px; color: var(--text-muted); transition: 0.2s; }
.nav-overlay-btn:hover { background: #f1f5f9; color: var(--primary); }

.right-pane { position: fixed; top: 0; right: -420px; width: 420px; height: 100vh; background: #fff; z-index: 3000; box-shadow: -5px 0 25px rgba(0,0,0,0.1); transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1); padding: 20px; box-sizing: border-box; overflow-y: auto; border-left: 1px solid var(--border-color); }
.right-pane.open { right: 0; }

/* -------------------------------------------------------
   5. Modals, Overlays & Leaflet Components
   ------------------------------------------------------- */
#infoOverlay { position: absolute; inset: 0; background: white; z-index: 1500; display: none; flex-direction: column; }
.overlay-header { padding: 15px 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }

.custom-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 10000; align-items: center; justify-content: center; }
.modal-content { background: white; padding: 20px; border-radius: 12px; width: 400px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); }

.leaflet-control-layers { margin-top: 80px !important; }
.leaflet-div-icon { background: transparent !important; border: none !important; }
.leaflet-marker-icon i, .poi-icon-sm i { font-size: 14px; }

.poi-popup { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; min-width: 160px; text-align: center; }
.poi-popup b { font-size: 14px; color: #1e293b; display: block; margin-bottom: 4px; }
.poi-popup img { width: 100%; max-height: 120px; object-fit: cover; border-radius: 6px; margin-bottom: 8px; }
.poi-popup-actions { display: flex; gap: 8px; margin-top: 12px; }
.poi-popup-actions .action-btn { flex: 1; padding: 8px; background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 6px; color: #334155; text-decoration: none; display: flex; align-items: center; justify-content: center; font-size: 14px; transition: 0.2s; cursor: pointer; }
.poi-popup-actions .action-btn:hover { background: #e2e8f0; color: #0f172a; }

.fav-toggle-btn { color: #64748b; transition: color 0.2s ease, transform 0.2s ease; }
.fav-toggle-btn .icon-filled { display: none; }
.fav-toggle-btn.is-active { color: #e11d48 !important; }
.fav-toggle-btn.is-active .icon-outline { display: none; }
.fav-toggle-btn.is-active .icon-filled { display: inline-block; fill: currentColor; stroke: none; }
.fav-toggle-btn:active { transform: scale(1.2); }

/* Specific sizing for the Info Modal */
.info-modal-content {
    width: 95%;
    max-width: 1400px;
    height: 90%;
    display: flex;
    flex-direction: column;
    padding: 0 !important; /* Managed by internal padding */
    overflow: hidden;
	position:relative;
}

.modal-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
}

#info-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0px;
	
}

.icon-action-btn-x { 
width: 45px; height: 45px;
font-size:32px;
border-radius: 8px;
border: 1px solid #cbd5e1;
background: white; 
cursor: pointer; 
display: flex; 
align-items: center; 
justify-content: center;
color: #475569; transition: 0.2s; 
}

.icon-action-btn-x:hover { 
background: #f1f5f9; 
}


.modalRightX{
position:absolute;
top:15px;
right:25px;
z-index:9999;
}