:root {
    --primary: #c19b6c; /* Gold/Ochre */
    --bg: #fdfdfd;
    --sidebar-bg: #222;
    --text-light: #fff;
    --text-dark: #333;
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

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

body {
    font-family: var(--font-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg);
}

/* LEFT Sidebar Styling */
#sidebar {
    width: 300px;
    background-color: var(--sidebar-bg);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    z-index: 1000;
}

header {
    padding: 1rem;
    background: linear-gradient(135deg, #444, #222);
    border-bottom: 2px solid var(--primary);
}

header h1 {
    font-size: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--primary);
}

#filters {
    padding: 0.8rem 1rem;
    background: #2a2a2a;
    border-bottom: 1px solid #444;
}

.filter-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.4rem;
    font-size: 0.75rem;
    cursor: pointer;
    justify-content: space-between;
}

.filter-info {
    display: flex;
    align-items: center;
}

.filter-item input { margin-right: 8px; }

.only-btn {
    font-size: 0.6rem;
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.filter-item:hover .only-btn {
    opacity: 1;
}

.color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    display: inline-block;
}

.scroll-container {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 1rem;
}

.itinerary { padding: 1rem; }

.day-section {
    margin-bottom: 1.5rem;
    border-left: 2px solid var(--primary);
    padding-left: 0.8rem;
}

.day-section.collapsed {
    margin-bottom: 0.5rem;
}

.day-header {
    font-weight: bold;
    font-size: 0.95rem;
    color: var(--primary);
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.day-header::after {
    content: '▾';
    font-size: 0.8rem;
    transition: transform 0.2s;
    opacity: 0.5;
}

.day-section.collapsed .day-header {
    margin-bottom: 0;
}

.day-section.collapsed .day-header::after {
    transform: rotate(-90deg);
}

.day-section.collapsed .event {
    display: none;
}

.event {
    background: #333;
    margin-bottom: 0.4rem;
    padding: 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    position: relative;
}

.event:hover { background: #444; transform: translateX(5px); }
.event.hidden-item { opacity: 0.5; }
.event.deleted-item { border: 1px dashed #555; background: #1a1a1a; opacity: 0.6; }

.event .time { font-size: 0.65rem; color: var(--primary); display: block; margin-bottom: 0.2rem; }
.event .title { font-weight: 600; font-size: 0.8rem; padding-right: 40px; }

.event-actions {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.event:hover .event-actions { opacity: 1; }

.action-btn {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px;
    transition: color 0.2s;
}

.action-btn:hover { color: var(--primary); }
.action-btn.delete:hover { color: #ff4444; }
.action-btn.restore:hover { color: #44ff44; }

/* RIGHT (Map) Container */
#map-container {
    flex-grow: 1;
    position: relative;
}

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

/* Floating Panel */
#add-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 320px;
    max-height: calc(100vh - 100px);
    background: rgba(34, 34, 34, 0.92);
    color: #fff;
    padding: 0;
    border-radius: 8px;
    z-index: 1001;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    border: 1px solid #444;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#add-panel.collapsed {
    width: 140px;
    height: 42px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background: #2a2a2a;
    cursor: pointer;
    border-bottom: 1px solid #444;
    flex-shrink: 0;
}

.panel-header h3 {
    font-size: 0.8rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.toggle-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.panel-content {
    padding: 1.2rem;
    overflow-y: auto;
    transition: opacity 0.3s;
}

#add-panel.collapsed .panel-content {
    opacity: 0;
    pointer-events: none;
}

/* Search Results Styling */
#search-results {
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 4px;
    margin-bottom: 1rem;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.search-item {
    padding: 0.6rem;
    font-size: 0.75rem;
    border-bottom: 1px solid #333;
    cursor: pointer;
    transition: background 0.2s;
}

.search-item:hover {
    background: #333;
}

.search-item b { color: var(--primary); }

/* OSM Discovery Box */
#osm-preview {
    background: #1a1a1a;
    border: 1px dashed #555;
    padding: 0.8rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.75rem;
    display: none;
}

#osm-preview b { color: var(--primary); }

.btn-use-osm {
    margin-top: 0.5rem;
    padding: 4px 8px;
    background: #333;
    border: 1px solid var(--primary);
    color: var(--primary);
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: 3px;
    text-transform: uppercase;
}

.btn-use-osm:hover { background: var(--primary); color: #000; }

/* Map Controls (Locate & Center) */
.map-controls {
    position: absolute;
    bottom: 30px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1001;
}

.control-btn {
    width: 44px;
    height: 44px;
    background: rgba(34, 34, 34, 0.9);
    border: 1px solid #444;
    color: var(--primary);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    transition: background 0.2s;
}

.control-btn:hover { background: #444; }

/* Custom Control Styling (Zoom, Layers, etc.) */
.leaflet-bar, .leaflet-control-layers {
    border: 1px solid #444 !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3) !important;
}

.leaflet-bar a, .leaflet-control-layers-toggle {
    background-color: rgba(34, 34, 34, 0.9) !important;
    color: var(--primary) !important;
    backdrop-filter: blur(4px);
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 34px !important;
    height: 34px !important;
    border: none !important;
}

.leaflet-control-layers-toggle {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23c19b6c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='12 2 2 7 12 12 22 7 12 2'/%3E%3Cpolyline points='2 17 12 22 22 17'/%3E%3Cpolyline points='2 12 12 17 22 12'/%3E%3C/svg%3E") !important;
    background-size: 20px 20px !important;
    background-position: center !important;
    border-radius: 8px !important;
}

.leaflet-control-layers {
    background: rgba(34, 34, 34, 0.9) !important;
    color: #fff !important;
    font-family: var(--font-main);
    border-radius: 8px !important;
    border: 1px solid #444 !important;
}

/* Form Styling */
.form-group { margin-bottom: 0.8rem; }
.form-group label {
    display: block;
    font-size: 0.65rem;
    margin-bottom: 0.2rem;
    opacity: 0.7;
    text-transform: uppercase;
}
.form-group input {
    width: 100%;
    padding: 0.45rem;
    background: #444;
    border: 1px solid #555;
    color: #fff;
    border-radius: 4px;
    font-size: 0.8rem;
}
.form-row { display: flex; gap: 0.4rem; }
.btn-add {
    width: 100%;
    padding: 0.6rem;
    background: var(--primary);
    border: none;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    margin-top: 0.5rem;
    text-transform: uppercase;
    font-size: 0.75rem;
}

#import-url { border: 1px solid var(--primary); }

@media (max-width: 768px) {
    body { flex-direction: column; }
    #sidebar { width: 100%; height: 40vh; }
    #map-container { height: 60vh; }
    #add-panel { width: 90%; top: 10px; right: 5%; }
    .map-controls { bottom: 20px; right: 10px; }
}
