body {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#app {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Non-dashboard views get container padding */
.view-container {
    padding: 1.5rem;
    max-width: 100vw;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto;
}

/* Dashboard layout */
.dashboard-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.dashboard-sidebar {
    width: 300px;
    min-width: 300px;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: margin-left 0.3s ease, opacity 0.3s ease;
    z-index: 500;
}

.dashboard-sidebar.collapsed {
    margin-left: -300px;
    opacity: 0;
    pointer-events: none;
}

.dashboard-sidebar .sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    flex-shrink: 0;
}

.dashboard-sidebar .municipality-list {
    padding: 0.5rem 1rem;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.dashboard-sidebar .form-check {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.dashboard-map {
    flex: 1;
    position: relative;
    min-width: 0;
}

#map {
    width: 100%;
    height: 100%;
}

.sidebar-toggle {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    background: white;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);
}

.sidebar-toggle:hover {
    background: #f4f4f4;
}

/* Ensure the navbar and its dropdowns always render above Leaflet map panes.
   Leaflet uses CSS transform on .leaflet-pane which creates a stacking context;
   without an explicit z-index on the nav the dropdown can disappear behind it. */
.navbar {
    position: relative;
    z-index: 1030;
}

.navbar .dropdown-menu {
    z-index: 1031;
}

/* Navbar right-side user controls */
.nav-lang-select {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
    padding: 0.25rem 1.75rem 0.25rem 0.5rem;
}

.nav-lang-select:focus {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
    box-shadow: none;
}

.nav-lang-select option {
    background-color: #212529;
    color: white;
}

.nav-user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50px;
    color: rgba(255, 255, 255, 0.9);
    padding: 3px 10px 3px 3px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.nav-user-btn:hover,
.nav-user-btn.show {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
    color: white;
}

.nav-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    letter-spacing: -0.02em;
}

.nav-username {
    font-size: 0.82rem;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-chevron {
    font-size: 0.58rem;
    opacity: 0.6;
    transition: transform 0.2s;
}

.nav-user-btn.show .nav-chevron {
    transform: rotate(180deg);
}

/* Emergency marker styles */
.emergency-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: #ef4444;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
    font-size: 11px;
    color: white;
}

/* Resource marker styles */
.resource-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    font-size: 14px;
    color: white;
}

/* Resource popup styles */
.resource-popup {
    font-size: 0.85rem;
    min-width: 220px;
}

.resource-popup-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    background: #f8f9fa;
    border-radius: 3px;
}

.resource-popup-header i {
    font-size: 1rem;
}

.resource-popup-body {
    padding: 0 0.25rem;
}

.resource-popup-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.2rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.resource-popup-row:last-child {
    border-bottom: none;
}

.resource-popup-label {
    color: #6c757d;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Municipality hierarchy tree */
.municipality-tree-node {
    user-select: none;
}

.municipality-tree-node .d-flex {
    padding: 0.15rem 0;
}

.tree-children {
    overflow: hidden;
}

.tree-children.tree-collapsed {
    display: none;
}

.tree-toggle {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.tree-toggle:hover {
    color: #495057 !important;
}

/* Profile page */
.profile-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    letter-spacing: -0.02em;
}

.profile-username-badge {
    display: inline-block;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
}

.profile-field-icon {
    width: 36px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}
