:root {
    --ocean-deep: #0a2540;
    --ocean-mid: #1e5f8b;
    --sand-light: #ffffff;
    --turtle-teal: #39CCCC;
    --sunset: #ff8c42;
    --sidebar-width: 360px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, var(--ocean-deep) 0%, var(--ocean-mid) 100%);
    color: var(--sand-light);
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* ===== HEADER NAVBAR ===== */

.header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-title-container {
    display: flex;
    align-items: center;
    gap: 3rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.navbar-logo {
    height: 40px;
    width: auto;
}

.navbar-title {
    font-size: 1.35rem;
    color: var(--sand-light);
    font-weight: 800;
    margin: 0;
    letter-spacing: 0.03em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6), 0 0 15px rgba(57, 204, 204, 0.4);
}

.navbar-title i {
    color: var(--turtle-teal);
    font-weight: 900;
    font-style: italic;
}

.navbar-subtitle {
    font-size: 0.75rem;
    color: var(--turtle-teal);
    opacity: 0.9;
    margin-top: 0.25rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-weight: 600;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ===== THEME SWITCHER ===== */
.theme-switch-container {
    display: inline-block;
    position: relative;
    width: 60px;
    height: 30px;
    cursor: pointer;
    flex-shrink: 0;
}

.theme-switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--turtle-teal);
    border-radius: 30px;
    transition: .4s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.theme-switch-slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: var(--ocean-deep);
    border-radius: 50%;
    transition: .4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

.theme-switch-container input:checked+.theme-switch-slider {
    background-color: var(--sand-light);
}

.theme-switch-container input:checked+.theme-switch-slider::before {
    transform: translateX(30px);
    background-color: var(--ocean-deep);
}

.theme-switch-slider .sun-icon,
.theme-switch-slider .moon-icon {
    z-index: 1;
    color: var(--ocean-deep);
    transition: 0.4s;
}

.theme-switch-container input:checked+.theme-switch-slider .moon-icon {
    color: var(--ocean-deep);
}

.theme-switch-container input:checked+.theme-switch-slider .sun-icon {
    color: rgba(10, 37, 64, 0.5);
}

/* ===== MAPPA ===== */

#map {
    position: absolute;
    top: 70px;
    /* Offset for the navbar */
    left: 0;
    width: 100%;
    height: calc(100% - 70px);
    z-index: 1;
}

#map::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    /* Blu di Prussia */

    pointer-events: none;
    z-index: 400;
    /* Sopra le tile/marker ma sotto i controlli */
    mix-blend-mode: multiply;
}

/* ===== PULSANTI TOGGLE SIDEBAR ===== */

.sidebar-toggles-container {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-toggle {
    /* Base styles shared */
    background: rgba(10, 37, 64, 0.95);
    border: 2px solid var(--turtle-teal);
    color: var(--turtle-teal);
    padding: 1rem 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    border-left: none;
    border-radius: 0 12px 12px 0;
    padding: 0.75rem;
}

.sidebar-toggle:hover {
    background: var(--turtle-teal);
    color: var(--ocean-deep);
}

.toggle-right {
    position: fixed;
    top: 50%;
    right: 0;
    left: auto;
    transform: translateY(-50%);
    z-index: 1500;
    border-radius: 12px 0 0 12px;
    border-right: none;
    border-left: 2px solid var(--turtle-teal);
}

.toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.toggle-icon svg {
    width: 100%;
    height: 100%;
    stroke-width: 2px;
}


/* ===== SIDEBAR BASE ===== */

.sidebar {
    position: fixed;
    background: rgba(10, 37, 64, 0.98);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(20px);
}

/* Sidebar Search (Standard Left Drawer) */
.sidebar-search {
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    border-right: 3px solid var(--turtle-teal);
}

.sidebar-search.open {
    transform: translateX(0);
}

/* Sidebar Info (Right Drawer) */
.sidebar-right {
    top: 0;
    right: 0;
    height: 100vh;
    width: var(--sidebar-width);
    transform: translateX(100%);
    border-left: 3px solid var(--turtle-teal);
}

.sidebar-right.open {
    transform: translateX(0);
}

/* Sidebar Position Overrides not needed with specific classes */

/* ===== SIDEBAR HEADER ===== */

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 2px solid var(--turtle-teal);
    background: rgba(10, 37, 64, 0.95);
    flex-shrink: 0;
}

.sidebar-header h3 {
    font-family: 'Roboto', sans-serif;
    color: var(--turtle-teal);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin: 0;
}

.sidebar-close {
    background: transparent;
    border: 2px solid var(--turtle-teal);
    color: var(--turtle-teal);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-close:hover {
    background: var(--turtle-teal);
    color: var(--ocean-deep);
}

/* ===== SIDEBAR CONTENT ===== */

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.sidebar-content::-webkit-scrollbar {
    width: 8px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--turtle-teal);
    border-radius: 4px;
}

/* ===== SIDEBAR SECTIONS ===== */

.sidebar-section {
    background: rgba(30, 95, 139, 0.2);
    border: 1px solid rgba(57, 204, 204, 0.3);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.section-title {
    font-family: 'Roboto', sans-serif;
    color: var(--turtle-teal);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(57, 204, 204, 0.3);
}

/* ===== TOGGLE SWITCHES ===== */

.view-toggles {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toggle-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.toggle-switch:hover {
    background: rgba(57, 204, 204, 0.1);
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    width: 50px;
    height: 26px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 13px;
    position: relative;
    transition: all 0.3s ease;
    margin-right: 1rem;
    flex-shrink: 0;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--sand-light);
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all 0.3s ease;
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--turtle-teal);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(24px);
}

.toggle-text {
    font-size: 0.95rem;
    color: var(--sand-light);
}

/* ===== CIRCLE CHECKBOX (Pallino che si riempie) ===== */

.circle-check {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 0.5rem;
}

.circle-check input {
    display: none;
}

.circle-check .circle-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(57, 204, 204, 0.5);
    background: transparent;
    position: relative;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.circle-check .circle-indicator::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--turtle-teal);
    transform: scale(0);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.circle-check input:checked+.circle-indicator {
    border-color: var(--turtle-teal);
}

.circle-check input:checked+.circle-indicator::after {
    transform: scale(1);
}

.circle-text {
    font-size: 0.8rem;
    color: var(--sand-light);
}

/* ===== SEARCH & FILTERS ===== */

.search-box {
    margin-bottom: 0.75rem;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid rgba(57, 204, 204, 0.5);
    border-radius: 8px;
    background: rgba(10, 37, 64, 0.8);
    color: var(--sand-light);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-box input:focus {
    border-color: var(--turtle-teal);
    box-shadow: 0 0 10px rgba(57, 204, 204, 0.3);
}

.filter-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.filter-row select {
    flex: 1;
    padding: 0.8rem 2.2rem 0.8rem 0.8rem;
    min-height: 44px;
    border: 2px solid rgba(57, 204, 204, 0.5);
    border-radius: 8px;
    background: rgba(10, 37, 64, 0.8) url('data:image/svg+xml;utf8,<svg fill="%2339CCCC" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>') no-repeat right 0.5rem center;
    background-size: 24px;
    color: var(--sand-light);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.filter-row select:focus {
    border-color: var(--turtle-teal);
}

.filter-row select::-ms-expand {
    display: none;
}

/* ===== YEAR SLIDER OVERLAY ===== */

.year-slider-overlay {
    position: fixed;
    bottom: 7px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: max-content;
    max-width: 90vw;
    pointer-events: auto;
}

/* Push Leaflet zoom controls above the slider */
.leaflet-bottom.leaflet-left {
    bottom: 70px !important;
}

.year-slider-container {
    background: rgba(10, 37, 64, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(57, 204, 204, 0.3);
    border-radius: 10px;
    padding: 0.3rem 1rem 0.45rem;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.3);
}

.year-slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.2rem;
}

.year-slider-title {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.year-slider-value {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--turtle-teal);
    background: rgba(57, 204, 204, 0.12);
    padding: 0.05rem 0.4rem;
    border-radius: 3px;
    min-width: 2rem;
    text-align: center;
    transition: all 0.2s ease;
}

.year-slider-track-wrapper {
    position: relative;
    width: 100%;
    padding: 0 2px;
}

/* Range Input - Custom Styling */
#filter-anno-slider {
    --slider-fill: 0%;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right,
            var(--turtle-teal) 0%,
            var(--turtle-teal) var(--slider-fill),
            rgba(255, 255, 255, 0.15) var(--slider-fill),
            rgba(255, 255, 255, 0.15) 100%);
    outline: none;
    cursor: pointer;
    margin: 0;
}

/* Thumb - WebKit */
#filter-anno-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--turtle-teal);
    border: 2px solid var(--ocean-deep);
    box-shadow: 0 0 8px rgba(57, 204, 204, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

#filter-anno-slider::-webkit-slider-thumb:hover {
    box-shadow: 0 0 12px rgba(57, 204, 204, 0.7), 0 2px 6px rgba(0, 0, 0, 0.4);
    transform: scale(1.15);
}

#filter-anno-slider:active::-webkit-slider-thumb {
    transform: scale(1.2);
    box-shadow: 0 0 16px rgba(57, 204, 204, 0.8), 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Thumb - Firefox */
#filter-anno-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--turtle-teal);
    border: 2px solid var(--ocean-deep);
    box-shadow: 0 0 8px rgba(57, 204, 204, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

/* Track - Firefox */
#filter-anno-slider::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.15);
}

#filter-anno-slider::-moz-range-progress {
    height: 4px;
    border-radius: 2px;
    background: var(--turtle-teal);
}

/* Tick marks */
.year-slider-ticks {
    display: flex;
    justify-content: space-between;
    margin-top: 0.2rem;
    padding: 0 7px;
    /* half of 14px thumb width */
    pointer-events: none;
}

.year-tick {
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.5);
    width: 0;
    overflow: visible;
    position: relative;
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.year-tick::before {
    content: '';
    display: block;
    width: 1px;
    height: 4px;
    background: rgba(57, 204, 204, 0.35);
    margin: 0 auto 2px;
    border-radius: 1px;
}

.filter-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.75rem 0;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(57, 204, 204, 0.2);
}

.list-count {
    color: var(--turtle-teal);
    font-size: 0.85rem;
    font-weight: 600;
}

.reset-btn {
    padding: 0.4rem 0.75rem;
    border: 2px solid var(--sunset);
    border-radius: 6px;
    background: transparent;
    color: var(--sunset);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-btn:hover {
    background: var(--sunset);
    color: white;
}

/* ===== TURTLE LIST ===== */

.section-list {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    /* Important for flex scroll */
    overflow: hidden;
}

.turtle-list {
    flex: 1;
    overflow-y: auto;
    margin: 0 -0.5rem;
    padding: 0 0.5rem;
    /* Use 100% height since parent is flex */
    max-height: 100%;
    min-height: 200px;
}

.turtle-list::-webkit-scrollbar {
    width: 6px;
}

.turtle-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.turtle-list::-webkit-scrollbar-thumb {
    background: var(--turtle-teal);
    border-radius: 3px;
}

.turtle-item {
    background: rgba(30, 95, 139, 0.3);
    border: 1px solid rgba(57, 204, 204, 0.3);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.6rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.turtle-item:hover {
    background: rgba(57, 204, 204, 0.25);
    border-color: var(--turtle-teal);
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(57, 204, 204, 0.2);
}

.turtle-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.turtle-id {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: var(--sunset);
    background: rgba(255, 140, 66, 0.2);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.turtle-year {
    font-size: 0.7rem;
    color: var(--turtle-teal);
    background: rgba(57, 204, 204, 0.2);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    margin-left: auto;
}

.turtle-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--sand-light);
    margin-bottom: 0.2rem;
}

.turtle-location {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
}

.turtle-specie {
    font-size: 0.75rem;
    font-style: italic;
    color: var(--turtle-teal);
}

.turtle-region {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
}

.no-results {
    text-align: center;
    padding: 1.5rem;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

/* ===== SIDEBAR FOOTER ===== */

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 2px solid var(--turtle-teal);
    background: rgba(10, 37, 64, 0.95);
    text-align: center;
    flex-shrink: 0;
}

.admin-link {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 140, 66, 0.2);
    border: 2px solid var(--sunset);
    border-radius: 8px;
    color: var(--sunset);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.admin-link:hover {
    background: var(--sunset);
    color: white;
}

/* ===== STATS GRID ===== */

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.stat-card {
    background: rgba(10, 37, 64, 0.6);
    border: 1px solid rgba(57, 204, 204, 0.3);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.stat-card .stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--turtle-teal);
    line-height: 1;
    margin-bottom: 0.3rem;
}

.stat-card .stat-label {
    display: block;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== LEGEND ===== */

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
}

.legend-color {
    width: 30px;
    height: 14px;
    border-radius: 4px;
    margin-right: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

/* ===== PROJECT INFO ===== */

.project-info {
    font-size: 0.85rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.75rem;
}

.project-info:last-child {
    margin-bottom: 0;
}

.project-info strong {
    color: var(--turtle-teal);
}

/* ===== OVERLAY ===== */

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1900;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===== LEAFLET POPUP ===== */

.leaflet-popup-content-wrapper {
    background: rgba(10, 37, 64, 0.98);
    border: 2px solid var(--turtle-teal);
    border-radius: 8px;
    font-family: 'Space Mono', monospace;
    backdrop-filter: blur(10px);
}

.leaflet-popup-content {
    color: var(--sand-light);
    margin: 1rem;
    font-size: 0.85rem;
}

.leaflet-popup-content h4 {
    font-family: 'Roboto', sans-serif;
    color: var(--turtle-teal);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.leaflet-popup-content p {
    margin: 0.3rem 0;
    color: var(--sand-light);
}

.leaflet-popup-tip {
    background: rgba(10, 37, 64, 0.98);
    border: 2px solid var(--turtle-teal);
    border-top: none;
    border-right: none;
}

/* ===== TURTLE POPUP - ADOPTION STYLES ===== */

.turtle-popup {
    min-width: 200px;
}

.popup-turtle-image {
    margin: -1rem -1rem 1rem -1rem;
    border-radius: 6px 6px 0 0;
    overflow: hidden;
}

.popup-turtle-image img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.popup-adopt-section {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(57, 204, 204, 0.3);
}

.adopt-btn {
    display: block;
    width: 100%;
    padding: 0.85rem 1rem;
    background: linear-gradient(135deg, var(--turtle-teal) 0%, #1e9e9e 100%);
    border: none;
    border-radius: 8px;
    color: #ffffff !important;
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.adopt-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(57, 204, 204, 0.4);
    background: linear-gradient(135deg, #2dbdbd 0%, var(--turtle-teal) 100%);
    color: #ffffff;
}

/* ===== TURTLE LIST - ADOPTABLE STYLES ===== */

.turtle-adoptable {
    border-color: rgba(57, 204, 204, 0.6);
    background: rgba(57, 204, 204, 0.15);
}

.turtle-adoptable:hover {
    border-color: var(--turtle-teal);
    background: rgba(57, 204, 204, 0.25);
}

.turtle-adopt-badge {
    font-size: 0.65rem;
    color: var(--ocean-deep);
    background: var(--turtle-teal);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
}

/* Individual Marker Containers (invisible 24x24 touch target) */
.marker-square-container,
.marker-circle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none !important;
    cursor: pointer;
}

/* Square inner (adoptable) */
.marker-square-inner {
    width: 14px;
    height: 14px;
    background-color: #8B0000;
    border: 1px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Circle inner (non-adoptable) */
.marker-circle-inner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #8B0000;
    border: 1px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ===== MARKERS & CLUSTERS ===== */

/* Reset ALL Leaflet MarkerCluster default styles */
.marker-cluster {
    background: none !important;
    border-radius: 50% !important;
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: none !important;
    border-radius: 50% !important;
}



.marker-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* Base cluster bubble */
.custom-marker,
.legend-cluster-icon {
    border-radius: 50% !important;
    transition: all 0.3s ease;
    font-family: 'Space Mono', monospace;
    letter-spacing: 0.5px;
}

/* Specific sizing for legend icons */
.legend-cluster-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.legend-cluster-icon.small {
    width: 12px;
    height: 12px;
    background-color: var(--heatmap-low);
}

.legend-marker-icon {
    width: 30px;
    height: 30px;
    background-color: #8B0000;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    margin-right: 12px;
    /* Added spacing */
}

#legend-markers {
    /* No specific styles needed as container handles spacing */
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-marker-icon.circle {
    border-radius: 50%;
}

.legend-marker-icon.square {
    border-radius: 0;
}

.legend-concentric-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 0.5rem;
}

.legend-concentric-visual {
    position: relative;
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

.legend-cluster-icon.concentric {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    /* Override default margin */
}

.legend-cluster-icon.large.concentric {
    width: 50px;
    height: 50px;
    bottom: 0;
    z-index: 1;
}

.legend-cluster-icon.small.concentric {
    position: absolute;
    width: 20px;
    /* Reduced for better visual in legend */
    height: 20px;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    border: 1px solid var(--turtle-teal);
    margin: 0;
}

.legend-concentric-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 50px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
}

.legend-concentric-labels .label-high {
    align-self: flex-start;
}

.legend-concentric-labels .label-low {
    align-self: flex-start;
    margin-top: auto;
}


/* Tema Chiaro — palette oceano */
.custom-marker.light,
.legend-cluster-icon.light {
    background: var(--ocean-deep) !important;
    background: radial-gradient(circle, var(--ocean-mid) 0%, var(--ocean-deep) 100%) !important;
    border: 1px solid var(--turtle-teal);
    box-shadow: 0 2px 6px rgba(10, 37, 64, 0.8);
    color: var(--turtle-teal);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    opacity: 1 !important;
}

/* Tema Scuro — stessi colori del tema chiaro */
.custom-marker.dark,
.legend-cluster-icon.dark {
    background: var(--ocean-deep) !important;
    background: radial-gradient(circle, var(--ocean-mid) 0%, var(--ocean-deep) 100%) !important;
    border: 1px solid var(--turtle-teal);
    box-shadow: 0 2px 6px rgba(10, 37, 64, 0.8);
    color: var(--turtle-teal);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    opacity: 1 !important;
}

/* ===== PAGINA ADMIN ===== */

body:has(.admin-container),
body.admin-page {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.admin-container {
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, var(--ocean-deep) 0%, var(--ocean-mid) 100%);
    overflow: visible;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--turtle-teal);
}

.admin-header h1 {
    font-size: 2rem;
    color: var(--turtle-teal);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: rgba(57, 204, 204, 0.2);
    border: 2px solid var(--turtle-teal);
    border-radius: 8px;
    color: var(--turtle-teal);
    text-decoration: none;
    transition: all 0.3s ease;
}

.back-link:hover {
    background: var(--turtle-teal);
    color: var(--ocean-deep);
}

.admin-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.admin-section {
    background: rgba(10, 37, 64, 0.95);
    border: 2px solid var(--turtle-teal);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(20px);
}

.admin-section h2 {
    color: var(--turtle-teal);
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(57, 204, 204, 0.3);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--sand-light);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid rgba(57, 204, 204, 0.5);
    border-radius: 6px;
    background: rgba(10, 37, 64, 0.8);
    color: var(--sand-light);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--turtle-teal);
    box-shadow: 0 0 10px rgba(57, 204, 204, 0.3);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-primary {
    flex: 1;
    padding: 0.75rem 1.5rem;
    background: var(--turtle-teal);
    border: none;
    border-radius: 8px;
    color: var(--ocean-deep);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #2dbdbd;
    transform: translateY(-2px);
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 2px solid var(--turtle-teal);
    border-radius: 8px;
    color: var(--turtle-teal);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(57, 204, 204, 0.2);
}

.btn-danger {
    padding: 0.5rem 1rem;
    background: rgba(255, 65, 54, 0.2);
    border: 2px solid #FF4136;
    border-radius: 6px;
    color: #FF4136;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background: #FF4136;
    color: white;
}

.btn-edit {
    padding: 0.4rem 0.8rem;
    background: rgba(57, 204, 204, 0.2);
    border: 2px solid var(--turtle-teal);
    border-radius: 6px;
    color: var(--turtle-teal);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 0.5rem;
}

.btn-edit:hover {
    background: var(--turtle-teal);
    color: var(--ocean-deep);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(57, 204, 204, 0.2);
}

.admin-table th {
    background: rgba(57, 204, 204, 0.1);
    color: var(--turtle-teal);
    font-weight: 600;
}

.admin-table tr:hover {
    background: rgba(57, 204, 204, 0.05);
}

/* Badge Adottabile nella tabella admin */
.badge-adoptable {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    background: var(--turtle-teal);
    border-radius: 12px;
    color: var(--ocean-deep);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-not-adoptable {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
}

.table-container {
    max-height: 900px;
    overflow-y: auto;
}

.table-container::-webkit-scrollbar {
    width: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--turtle-teal);
    border-radius: 4px;
}

.message {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: none;
}

.message.success {
    display: block;
    background: rgba(46, 204, 64, 0.2);
    border: 1px solid #2ECC40;
    color: #2ECC40;
}

.message.error {
    display: block;
    background: rgba(255, 65, 54, 0.2);
    border: 1px solid #FF4136;
    color: #FF4136;
}

.message.info {
    display: block;
    background: rgba(57, 204, 204, 0.2);
    border: 1px solid var(--turtle-teal);
    color: var(--turtle-teal);
}

.message.warning {
    display: block;
    background: rgba(255, 220, 0, 0.2);
    border: 1px solid #FFDC00;
    color: #FFDC00;
}

.export-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(57, 204, 204, 0.3);
}

.export-section h3 {
    color: var(--turtle-teal);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.export-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

#map-picker {
    height: 280px;
    border-radius: 8px;
    border: 2px solid var(--turtle-teal);
    cursor: crosshair;
}

.marker-selected {
    background: var(--turtle-teal);
    border: 3px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
}

.coords-row {
    display: flex;
    gap: 1.5rem;
}

.coord-field {
    flex: 1;
}

.coord-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--turtle-teal);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.coord-field input {
    font-family: 'Space Mono', monospace;
    text-align: center;
}

.cell-id {
    color: var(--turtle-teal);
    font-family: 'Space Mono', monospace;
}

.actions-cell {
    white-space: nowrap;
}

.form-mode-indicator {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: none;
}

.form-mode-indicator.edit-mode {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 140, 66, 0.2);
    border: 1px solid var(--sunset);
    color: var(--sunset);
}

.form-mode-indicator .cancel-edit {
    padding: 0.25rem 0.75rem;
    background: transparent;
    border: 1px solid var(--sunset);
    border-radius: 4px;
    color: var(--sunset);
    cursor: pointer;
    font-size: 0.8rem;
}

.form-mode-indicator .cancel-edit:hover {
    background: var(--sunset);
    color: white;
}

#id.readonly {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 320px;
    }

    .header {
        padding: 1rem;
    }

    .header>div {
        gap: 1rem;
    }

    .header img {
        height: 80px !important;
    }

    .header h2 {
        font-size: 1.1rem;
    }

    .subtitle {
        font-size: 0.7rem;
    }

    .admin-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
    }

    .header {
        padding: 0.5rem 0.75rem;
    }

    .header>div {
        gap: 0.75rem;
    }

    .header img {
        height: 50px !important;
    }

    .header h2 {
        font-size: 0.85rem;
        line-height: 1.2;
    }

    .subtitle {
        font-size: 0.6rem;
        margin-top: 0.2rem;
    }

    .sidebar-toggle {
        padding: 0.75rem 0.5rem;
    }

    .toggle-icon {
        font-size: 1.2rem;
    }

    .toggle-label {
        font-size: 0.6rem;
    }

    .sidebar {
        width: 100%;
    }

    .sidebar-left {
        border-right: none;
        border-bottom: 3px solid var(--turtle-teal);
    }

    .sidebar-right {
        border-left: none;
        border-bottom: 3px solid var(--turtle-teal);
    }

    .style-buttons {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    .admin-container {
        padding: 1rem;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .admin-header h1 {
        font-size: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .coords-row {
        flex-direction: column;
        gap: 1rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .table-container {
        overflow-x: auto;
    }

    .admin-table {
        min-width: 600px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .header>div {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .header img {
        height: 40px !important;
    }

    .header h2 {
        font-size: 0.75rem;
    }

    .subtitle {
        display: none;
    }

    .style-buttons {
        grid-template-columns: 1fr 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card .stat-value {
        font-size: 2rem;
    }


    .filter-row {
        flex-direction: column;
    }
}

/* ===== MAP FILTERS & PRESETS ===== */

.map-filters-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(10, 37, 64, 0.95);
    border: 2px solid var(--turtle-teal);
    border-radius: 12px;
    padding: 1.5rem;
    z-index: 1000;
    width: 300px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.map-filters-overlay.hidden {
    transform: translateX(120%);
    opacity: 0;
    pointer-events: none;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(57, 204, 204, 0.3);
}

.filter-header h3 {
    color: var(--turtle-teal);
    margin: 0;
    font-size: 1.1rem;
}

.close-filters {
    background: none;
    border: none;
    color: var(--sand-light);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.close-filters:hover {
    color: var(--turtle-teal);
}

.filter-group {
    margin-bottom: 1.2rem;
}

.filter-group label {
    display: flex;
    justify-content: space-between;
    color: var(--sand-light);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.filter-value {
    color: var(--turtle-teal);
    font-family: 'Space Mono', monospace;
}

/* Range Slider Styling */
input[type=range] {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]:focus {
    outline: none;
}

input[type=range]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--turtle-teal);
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 5px rgba(57, 204, 204, 0.5);
    transition: transform 0.1s ease;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: #808080;
    /* Grigio richiesto */
    border-radius: 2px;
}

/* Presets */
.presets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(57, 204, 204, 0.3);
}

.preset-btn {
    background: rgba(57, 204, 204, 0.1);
    border: 1px solid var(--turtle-teal);
    color: var(--turtle-teal);
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-btn:hover {
    background: var(--turtle-teal);
    color: var(--ocean-deep);
}

/* Toggle Button used in Map Controls */
.filter-toggle-btn {
    background: rgba(10, 37, 64, 0.9);
    border: 2px solid var(--turtle-teal);
    width: 44px;
    height: 44px;
    border-radius: 8px;
    color: var(--turtle-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}


/* ===== DATASET MANAGEMENT ===== */

.dataset-management-container {
    display: block;
    width: 100%;
}

.dataset-list-panel {
    background: transparent;
    border: none;
    padding: 0;
}

.dataset-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    padding: 0.5rem;
    max-height: 500px;
    overflow-y: auto;
}

.dataset-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    padding: 1.5rem 1rem;
    background: rgba(10, 37, 64, 0.6);
    border: 1px solid rgba(57, 204, 204, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.dataset-item:hover {
    background: rgba(57, 204, 204, 0.15);
    border-color: var(--turtle-teal);
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.dataset-item.active {
    background: rgba(57, 204, 204, 0.2);
    border-color: var(--turtle-teal);
    box-shadow: 0 0 15px rgba(57, 204, 204, 0.2);
}

.dataset-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--turtle-teal);
}

.ds-icon {
    width: 64px;
    height: 64px;
    /* border-radius: 50%; rimosso per folder look */
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    flex-shrink: 0;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.ds-info {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.ds-info strong {
    color: var(--sand-light);
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.ds-info small {
    color: var(--turtle-teal);
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
}

.dataset-form-panel {
    background: rgba(10, 37, 64, 0.4);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid rgba(57, 204, 204, 0.2);
    height: 100%;
    /* Match height */
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--sand-light);
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}


@media (max-width: 1024px) {
    .dataset-management-container {
        grid-template-columns: 1fr;
    }
}

/* ===== MAP CONTROLS POSITIONING ===== */
/* Center the controls at the bottom */
.leaflet-bottom.leaflet-left {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    /* Align bottom */
    bottom: 24px;
    /* Lift up slightly */
    left: 0;
    pointer-events: none;
    /* Allow clicking through the full-width strip */
}

.leaflet-bottom.leaflet-left .leaflet-control {
    pointer-events: auto;
    /* Re-enable clicks on controls */
    margin-bottom: 0 !important;
    margin-right: 10px;
    /* Spacing between controls */
    border: 2px solid var(--turtle-teal);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.leaflet-control-zoom {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.leaflet-bar a {
    background-color: rgba(10, 37, 64, 0.92) !important;
    color: var(--turtle-teal) !important;
    border: 1px solid rgba(57, 204, 204, 0.3) !important;
    width: 38px !important;
    height: 38px !important;
    line-height: 38px !important;
    font-size: 18px !important;
    border-radius: 50% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(16px) !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3) !important;
}

.leaflet-bar a:hover {
    background-color: rgba(57, 204, 204, 0.1) !important;
    color: var(--turtle-teal) !important;
    transform: scale(1.05) !important;
}

/* Clear specific border radius overrides that kept them square */
.leaflet-bar a:first-child,
.leaflet-bar a:last-child {
    border-radius: 50% !important;
}

/* Screenshot button specific styling if needed */
/* Screenshot button specific styling */
.leaflet-control-simpleMapScreenshoter {
    background-color: rgba(10, 37, 64, 0.9);
    border: 1px solid var(--turtle-teal);
    border-radius: 4px;
    padding: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--turtle-teal);
    transition: all 0.2s ease;
    font-size: 0;
    /* Hide any default text */
}

.leaflet-control-simpleMapScreenshoter svg {
    stroke: var(--turtle-teal);
    transition: stroke 0.2s ease;
}

.leaflet-control-simpleMapScreenshoter:hover {
    background-color: var(--turtle-teal);
}

.leaflet-control-simpleMapScreenshoter:hover svg {
    stroke: var(--ocean-deep);
}

/* ===== MODAL STYLE ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(10, 37, 64, 0.85);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--ocean-deep);
    margin: 5% auto;
    /* 5% from the top and centered */
    padding: 0;
    border: 1px solid var(--turtle-teal);
    width: 90%;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem;
    background: rgba(57, 204, 204, 0.1);
    border-bottom: 1px solid rgba(57, 204, 204, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: var(--turtle-teal);
    font-size: 1.5rem;
}

.close-modal {
    color: var(--sand-light);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--turtle-teal);
    text-decoration: none;
}

.modal-body {
    padding: 2rem;
}


/* ===== POPUP TITLE FRAME ===== */
.popup-title-frame {
    background: rgba(57, 204, 204, 0.1);
    border-radius: 6px;
    padding: 0.8rem;
    margin: 0.5rem 0 1rem 0;
    border-left: 4px solid var(--turtle-teal);
}

.popup-title-frame h4 {
    margin-bottom: 0.2rem;
    margin-top: 0;
}

.turtle-id-badge {
    display: inline-block;
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: var(--ocean-deep);
    background: var(--sunset);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: bold;
    margin-top: 0.2rem;
}

/* ===== POPUP SECTIONS ===== */
.popup-section {
    margin-bottom: 0.8rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(57, 204, 204, 0.2);
}

.popup-section:last-of-type {
    border-bottom: none;
}

.popup-section-title {
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--turtle-teal);
    letter-spacing: 0.1em;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    opacity: 0.9;
}

/* ===== POPUP CURIOSITY BOX ===== */
.popup-curiosity-box {
    background: rgba(30, 95, 139, 0.4);
    border: 1px dashed rgba(57, 204, 204, 0.4);
    border-radius: 6px;
    padding: 0.6rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.85);
}

/* ===== RESPONSIVE POPUP ===== */
@media (max-width: 480px) {
    .leaflet-popup-content {
        margin: 0.8rem;
        min-width: 260px;
    }

    .popup-title-frame {
        padding: 0.6rem;
    }

    .popup-title-frame h4 {
        font-size: 1.1rem;
    }

    .popup-section p {
        font-size: 0.8rem;
    }

    .turtle-id-badge {
        font-size: 0.65rem;
    }
}



/* ===== NUOVI CONTROLLI UI FLOTTANTI ===== */

/* Theme Toggle Header */
.theme-toggle-btn {
    background: transparent;
    border: none;
    color: var(--turtle-teal);
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
    color: var(--sand-light);
    transform: scale(1.1);
}

.theme-toggle-btn svg {
    width: 20px;
    height: 20px;
}

/* Map View Controls (Bottom Center) */
.map-view-controls {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(10, 37, 64, 0.92);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(57, 204, 204, 0.3);
    border-radius: 30px;
    padding: 0.4rem 0.8rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.view-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-btn:hover {
    color: var(--turtle-teal);
    background: rgba(57, 204, 204, 0.1);
}

.view-btn.active {
    background: var(--turtle-teal);
    color: var(--ocean-deep);
    box-shadow: 0 0 10px rgba(57, 204, 204, 0.4);
}

.view-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 0.2rem;
}

/* Floating Legend (Bottom Right) */
.floating-legend {
    position: absolute;
    bottom: 30px;
    right: 20px;
    z-index: 1000;
    background: rgba(10, 37, 64, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(57, 204, 204, 0.3);
    border-radius: 12px;
    width: 220px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.floating-legend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.8rem;
    background: rgba(30, 95, 139, 0.3);
    border-bottom: 1px solid rgba(57, 204, 204, 0.2);
}

.legend-toggle-btn {
    background: transparent;
    border: none;
    color: var(--turtle-teal);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.legend-toggle-btn:hover {
    background: rgba(57, 204, 204, 0.15);
}

.legend-content {
    padding: 0.8rem;
}

/* Adjust zoom control position so it doesn't overlap legend */
.leaflet-bottom.leaflet-right .leaflet-control-zoom {
    margin-bottom: 30vh;
    margin-right: 10px !important;
    display: flex !important;
    flex-direction: column !important;
}

/* ===== RESPONSIVE MOBILE FIXES ===== */
@media (max-width: 768px) {

    /* Header */
    .header {
        padding: 1rem 1.5rem;
        flex-wrap: nowrap;
    }

    .header-title-container {
        flex: 1 1 auto;
        min-width: 0;
        gap: 0.5rem;
        margin-right: 0.5rem;
    }

    .navbar-title {
        font-size: 0.95rem;
        line-height: 1.2;
    }

    .navbar-subtitle {
        font-size: 0.65rem;
        letter-spacing: 0.05em;
        margin-top: 0.2rem;
    }

    .navbar-actions {
        flex: 0 0 auto;
        display: flex;
        justify-content: flex-end;
    }

    .theme-switch-container {
        width: 50px;
        height: 26px;
    }

    .theme-switch-slider {
        padding: 0 4px;
    }

    .theme-switch-slider::before {
        height: 18px;
        width: 18px;
        left: 4px;
        bottom: 4px;
    }

    .theme-switch-container input:checked+.theme-switch-slider::before {
        transform: translateX(24px);
    }

    .theme-switch-slider .sun-icon,
    .theme-switch-slider .moon-icon {
        width: 12px;
        height: 12px;
    }

    /* Floating Legend */
    .floating-legend {
        top: 85px;
        /* Below header */
        bottom: auto;
        /* Override base style */
        right: 15px;
        width: auto;
        min-width: 170px;
        max-width: 200px;
        max-height: calc(55vh - 90px);
        /* Leave space for the info toggle */
        overflow-y: auto;
        /* Scroll if too long */
    }

    .floating-legend-header {
        padding: 0.4rem 0.6rem;
    }

    .legend-content {
        padding: 0.6rem;
    }

    /* Map View Controls - Top Left on Mobile */
    .map-view-controls {
        top: 85px;
        /* Below header */
        bottom: auto;
        left: 15px;
        right: auto;
        transform: none;
        /* Remove X-axis centering */
        flex-direction: column;
        /* Stack buttons vertically */
        padding: 0.5rem 0.3rem;
    }

    .view-btn {
        width: 32px;
        height: 32px;
    }

    .view-btn svg {
        width: 16px;
        height: 16px;
    }

    .view-divider {
        width: 16px;
        height: 1px;
        margin: 4px 0;
    }

    /* Align Leaflet Zoom */
    .leaflet-bottom.leaflet-right .leaflet-control-zoom {
        display: flex !important;
        margin-bottom: 50px !important;
    }

    /* Sidebar Toggles Vertical Center fix */
    .sidebar-toggles-container {
        top: 60%;
    }

    .toggle-right {
        top: 60%;
    }

    /* Keep Search Sidebar comboboxes side-by-side */
    .filter-row {
        flex-wrap: nowrap;
    }

    .filter-row select {
        padding: 0.6rem 1.8rem 0.6rem 0.4rem;
        font-size: 0.8rem;
    }
}