:root {
    --primary-color: #d32f2f;
    --secondary-color: #fbc02d;
    --dark-color: #212121;
    --light-color: #fafafa;
    --text-color: #333;
    --border-color: #eee;
}

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

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-color);
    background-color: var(--light-color);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--primary-color);
    color: white;
}

.sidebar-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.sidebar-header h1 span {
    color: var(--secondary-color);
}

.sidebar-header p {
    font-size: 0.8rem;
    opacity: 0.9;
    margin-bottom: 15px;
}

.search-container input {
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    border: none;
    font-size: 0.9rem;
    background: rgba(255,255,255,0.2);
    color: white;
}

.search-container input::placeholder {
    color: rgba(255,255,255,0.7);
}

.itinerary-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.category-title {
    padding: 15px 20px 5px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    color: #888;
}

.location-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.location-item:hover {
    background: #f5f5f5;
}

.location-item.active {
    background: #fff8e1;
    border-left: 4px solid var(--secondary-color);
}

.location-item input[type="checkbox"] {
    margin-right: 15px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.location-info {
    flex: 1;
}

.location-name {
    font-weight: 400;
    font-size: 0.95rem;
}

.location-item.visited .location-name {
    text-decoration: line-through;
    color: #aaa;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer button {
    width: 100%;
    padding: 10px;
    background: none;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #666;
}

/* Map */
.main-content {
    flex: 1;
    position: relative;
}

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

.menu-toggle {
    display: none;
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1100;
    background: white;
    border: none;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    cursor: pointer;
    font-size: 1.2rem;
}

/* Map Legend */
.map-legend {
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    line-height: 1.5;
    font-size: 0.85rem;
    max-width: 200px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    cursor: pointer;
    transition: opacity 0.2s;
    user-select: none;
}

.legend-item:hover {
    opacity: 0.8;
}

.legend-item.hidden {
    opacity: 0.4;
    text-decoration: line-through;
}

.legend-color {
    width: 25px;
    height: 4px;
    margin-right: 10px;
    border-radius: 2px;
}

/* Colored Markers */
.custom-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-pin {
    width: 24px;
    height: 24px;
    border-radius: 50% 50% 50% 0;
    position: absolute;
    transform: rotate(-45deg);
    left: 50%;
    top: 50%;
    margin: -20px 0 0 -12px;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.marker-pin::after {
    content: '';
    width: 10px;
    height: 10px;
    margin: 7px 0 0 7px;
    background: white;
    position: absolute;
    border-radius: 50%;
    opacity: 0.8;
}

/* Path Markers (Inizio/Fine) */
.path-label {
    background: white;
    border: 2px solid;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    height: 22px;
}

.category-nav {
    padding: 0 20px 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-link {
    font-size: 0.7rem;
    color: var(--primary-color);
    text-decoration: none;
    background: #f0f0f0;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid #ddd;
}

.nav-link:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Leaflet Overrides */
.leaflet-popup-content-wrapper {
    border-radius: 10px;
}

.popup-link {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 10px;
    background: var(--primary-color);
    color: white !important;
    text-decoration: none;
    border-radius: 5px;
    font-size: 0.8rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        height: 100%;
        transform: translateX(-100%);
    }

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

    .menu-toggle {
        display: block;
    }
}