/**
 * MapyEditor - Styles
 * Main stylesheet for the route editor application
 */

/* ======================
   RESET & BASE
   ====================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    height: 100vh;
    overflow: hidden;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
}

/* ======================
   TOP TOOLBAR
   ====================== */
#top-toolbar {
    height: 60px;
    background: #2d2d2d;
    border-bottom: 1px solid #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
    z-index: 1000;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.app-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-name {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.toolbar-left .version-badge {
    /* Uses same style as .version-badge */
}

.source-selector {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.source-label {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
}

.source-select {
    background: #3d3d3d;
    border: 1px solid #4d4d4d;
    color: #ffffff;
    padding: 8px 32px 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    min-width: 200px;
    transition: background-color 0.2s, border-color 0.2s;
}

.source-select:hover {
    background-color: #454545;
    border-color: #5d5d5d;
}

.source-select:focus {
    outline: none;
    border-color: #4CAF50;
    background-color: #454545;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.about-link {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid #4d4d4d;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.about-link:hover {
    background: #3d3d3d;
    border-color: #5d5d5d;
}

.about-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.user-menu-container {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid #4d4d4d;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.user-menu-btn:hover {
    background: #3d3d3d;
    border-color: #5d5d5d;
}

.user-menu-btn .user-icon {
    flex-shrink: 0;
}

.user-menu-btn .dropdown-icon {
    transition: transform 0.2s;
    flex-shrink: 0;
}

.user-menu-container.active .user-menu-btn .dropdown-icon {
    transform: rotate(180deg);
}

.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #2d2d2d;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    padding: 8px 0;
    display: none;
    z-index: 1001;
}

.user-menu-container.active .user-menu {
    display: block;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.user-menu-item:hover {
    background: #3d3d3d;
}

.user-menu-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.user-menu-separator {
    height: 1px;
    background: #1a1a1a;
    margin: 8px 0;
}

/* ======================
   LAYOUT
   ====================== */
#app {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#map-container {
    flex: 1;
    position: relative;
}

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

#right-panel {
    width: 400px;
    background: #2d2d2d;
    padding: 0;
    overflow-y: hidden;
    border-left: 1px solid #1a1a1a;
    display: flex;
    flex-direction: column;
}

.source-header {
    padding: 20px 20px 16px 20px;
    border-bottom: 1px solid #1a1a1a;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.source-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    flex: 1;
}

.source-header-buttons {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.source-header-buttons button {
    white-space: nowrap;
}

/* ======================
   MAP CURSOR MODES
   ====================== */
#map.add-routing-mode {
    cursor: crosshair !important;
}

#map.add-routing-mode * {
    cursor: crosshair !important;
}

#map.add-manual-mode {
    cursor: crosshair !important;
}

#map.add-manual-mode * {
    cursor: crosshair !important;
}

#map.add-start-mode {
    cursor: crosshair !important;
}

#map.add-start-mode * {
    cursor: crosshair !important;
}

/* ======================
   STATUS BAR
   ====================== */
#status-bar {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 8px 16px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
    font-size: 14px;
    font-weight: 500;
}

/* ======================
   LOADING INDICATOR
   ====================== */
#loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    z-index: 2000;
    display: none;
}

/* ======================
   PANEL SECTIONS
   ====================== */
.panel-section {
    background: #3a3a3a;
    padding: 20px;
    margin: 0 20px 16px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.panel-section:first-of-type {
    margin-top: 20px;
}

.panel-section h3 {
    margin-bottom: 12px;
    font-size: 16px;
    color: #e0e0e0;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    justify-content: space-between;
}

.panel-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-header-icon {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #FF9800, #4CAF50);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.panel-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #e0e0e0;
}

.about-link {
    color: #FF9800;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
    white-space: nowrap;
}

.about-link:hover {
    color: #4CAF50;
}

.version-badge {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

/* ======================
   INFO DISPLAY
   ====================== */
.info-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.info-label {
    font-weight: 500;
    color: #b0b0b0;
}

.info-value {
    color: #e0e0e0;
}

/* ======================
   BUTTONS
   ====================== */
button {
    width: 100%;
    padding: 10px;
    /*margin-bottom: 8px;*/
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

button.primary {
    background: #FF9800;
    color: white;
}

button.primary:hover {
    background: #F57C00;
}

button.success {
    background: #4CAF50;
    color: white;
}

button.success:hover {
    background: #388E3C;
}

button.secondary {
    background: #757575;
    color: white;
}

button.secondary:hover {
    background: #616161;
}

.btn-compact {
    padding: 6px 10px !important;
    font-size: 12px !important;
    min-width: auto;
}

.btn-compact svg {
    width: 12px !important;
    height: 12px !important;
}

button.warning {
    background: #F57C00;
    color: white;
}

button.warning:hover {
    background: #E65100;
}

button.muted {
    background: #616161;
    color: #e0e0e0;
}

button.muted:hover {
    background: #757575;
}

button:disabled {
    background: #e0e0e0 !important;
    color: #9e9e9e !important;
    cursor: not-allowed;
    opacity: 0.6;
}

.button-row {
    display: flex;
    gap: 8px;
}

.button-row button {
    margin-bottom: 0;
}

.button-row .btn-main {
    flex: 2;
}

.button-row .btn-secondary {
    flex: 1;
}

.button-compact {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.button-compact button {
    flex: 1;
    margin-bottom: 0;
    font-size: 13px;
    padding: 8px;
}

.button-compact button svg {
    vertical-align: middle;
    margin-right: 4px;
}

/* ======================
   TOOLBAR
   ====================== */
.toolbar {
    display: flex;
    gap: 6px;
}

.toolbar button {
    flex: 1;
    margin-bottom: 0;
    font-size: 12px;
    padding: 8px 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.toolbar button svg {
    flex-shrink: 0;
}

/* ======================
   FORMS
   ====================== */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #e0e0e0;
}

.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 14px;
    background: #2d2d2d;
    color: #e0e0e0;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #FF9800;
}

input[type="file"] {
    width: 100%;
    padding: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    background: #2d2d2d;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 4px;
}

/* ======================
   ATTRIBUTES FORM
   ====================== */
.attributes-form {
    margin-bottom: 16px;
}

.attributes-form .form-group {
    margin-bottom: 10px;
}

.attributes-form label .required {
    color: #FF9800;
    font-size: 12px;
}

/* Form row for side-by-side fields */
.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
}

.form-group-custom-color {
    flex: 0 0 80px !important;
}

.form-group input[type="color"] {
    width: 100%;
    height: 36px;
    padding: 2px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #2d2d2d;
    cursor: pointer;
}

.form-group input[type="color"]:focus {
    outline: none;
    border-color: #FF9800;
}

/* Textarea for custom data */
.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 14px;
    background: #2d2d2d;
    color: #e0e0e0;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.form-group textarea:focus {
    outline: none;
    border-color: #FF9800;
}

/* Custom data collapsible section */
.custom-data-section {
    margin-top: 8px;
    margin-bottom: 12px;
}

.custom-data-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #9e9e9e;
    text-decoration: none;
    font-size: 13px;
    padding: 4px 0;
}

.custom-data-toggle:hover {
    color: #FF9800;
}

.custom-data-toggle .toggle-icon {
    font-size: 10px;
    transition: transform 0.2s;
}

.custom-data-content {
    margin-top: 8px;
}

.custom-data-content textarea {
    width: 100%;
    box-sizing: border-box;
}

/* ======================
   DROPZONE
   ====================== */
.dropzone {
    border: 2px dashed #555;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #2d2d2d;
    margin-bottom: 12px;
    display: none;
}

.dropzone.visible {
    display: block;
}

.dropzone:hover {
    border-color: #FF9800;
    background: #353535;
}

.dropzone.dragover {
    border-color: #4CAF50;
    background: #2d4030;
    transform: scale(1.02);
}

.dropzone-content {
    pointer-events: none;
}

.dropzone svg {
    color: #b0b0b0;
    margin-bottom: 12px;
}

.dropzone-text {
    color: #e0e0e0;
    font-size: 14px;
    margin-bottom: 4px;
}

.dropzone-hint {
    color: #888;
    font-size: 12px;
    margin: 0;
}

.dropzone-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.dropzone-loading p {
    color: #e0e0e0;
    margin-top: 12px;
    font-size: 14px;
}

/* ======================
   SPINNER
   ====================== */
.spinner {
    border: 3px solid #555;
    border-top: 3px solid #FF9800;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ======================
   LEAFLET MARKERS
   ====================== */
.leaflet-marker-icon.vertex-marker {
    cursor: pointer !important;
}

.leaflet-marker-icon.midpoint-marker {
    cursor: copy !important;
}

.leaflet-marker-icon.hover-midpoint-marker {
    cursor: copy !important;
    pointer-events: auto !important;
}

/* Waypoint label styling */
.waypoint-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    user-select: none;
    pointer-events: none;
}

.leaflet-interactive:focus {
    outline: none !important;
}

.leaflet-interactive:focus-visible {
    outline: none !important;
}

/* ======================
   ROUTE TOOLTIP
   ====================== */
.route-tooltip {
    background: rgba(0, 0, 0, 0.85) !important;
    border: 1px solid #444 !important;
    color: #e0e0e0 !important;
    font-size: 13px !important;
    padding: 6px 10px !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
}

.route-tooltip::before {
    border-top-color: rgba(0, 0, 0, 0.85) !important;
}

/* ======================
   ROUTE TEXT MARKER
   ====================== */
.text-marker {
    background: none;
    border: none;
    padding: 0;
    font-weight: bold;
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
    text-shadow: -1px -1px 0 #ffffff, 1px -1px 0 #ffffff, -1px 1px 0 #ffffff, 1px 1px 0 #ffffff, -1px 0 0 #ffffff, 1px 0 0 #ffffff, 0 -1px 0 #ffffff, 0 1px 0 #ffffff;
}

/* ======================
   CONTEXT MENU
   ====================== */
.context-menu {
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    padding: 4px 0;
    z-index: 10000;
    display: none;
}

.context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s;
}

.context-menu-item:hover {
    background-color: #f0f0f0;
}

.context-menu-item svg {
    width: 16px;
    height: 16px;
}

.context-menu-item.delete svg {
    color: #D32F2F;
}

.context-menu-item.split svg {
    color: #2196F3;
}

.context-menu-item.mode-routing svg {
    color: #FFC107;
}

.context-menu-item.mode-manual svg {
    color: #9E9E9E;
}

.context-menu-separator {
    height: 1px;
    background: #e0e0e0;
    margin: 4px 0;
}

/* ======================
   ROUTES MENU
   ====================== */
.routes-menu {
    min-width: 220px;
    max-width: 300px;
}

.routes-menu-header {
    padding: 8px 16px;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
    font-size: 13px;
}

.routes-menu-list {
    max-height: 300px;
    overflow-y: auto;
}

.routes-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}

.routes-menu-item:hover {
    background: #f5f5f5;
}

.routes-menu-item-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.routes-menu-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.routes-menu-item-name {
    font-size: 14px;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.routes-menu-item-subtitle {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.routes-menu-separator {
    height: 1px;
    background: #e0e0e0;
    margin: 4px 0;
}

/* ======================
   NOTE TOOLTIP
   ====================== */
.note-tooltip {
    background: rgba(0, 0, 0, 0.85) !important;
    border: 1px solid #444 !important;
    color: #e0e0e0 !important;
    font-size: 13px !important;
    padding: 6px 10px !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
    white-space: pre-line !important;
    min-width: 150px !important;
    max-width: 300px !important;
}

.note-tooltip::before {
    border-top-color: rgba(0, 0, 0, 0.85) !important;
}

/* Note marker cursor */
.leaflet-marker-icon:has(+ .note-tooltip),
.leaflet-marker-icon[data-note-marker] {
    cursor: grab !important;
}

.leaflet-marker-icon:has(+ .note-tooltip):active,
.leaflet-marker-icon[data-note-marker]:active {
    cursor: grabbing !important;
}

/* ======================
   NOTE POPUP
   ====================== */
.note-popup {
    position: absolute;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    z-index: 10001;
    min-width: 300px;
    max-width: 500px;
    display: none;
}

.note-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #444;
    font-weight: 600;
    font-size: 14px;
    color: #e0e0e0;
}

.note-popup-header span {
    flex: 1;
}

.note-popup-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: #999;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    width: 26px;
    height: 26px;
    margin-left: 12px;
    flex-shrink: 0;
}

.note-popup-close:hover {
    background: #3a3a3a;
    color: #e0e0e0;
}

.note-popup-close svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.note-popup-content {
    padding: 16px;
}

.note-popup-content textarea {
    width: 100%;
    min-height: 120px;
    padding: 8px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #1a1a1a;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
}

.note-popup-content textarea:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.note-popup-content textarea::placeholder {
    color: #666;
}

/* ======================
   PANEL MENU (3 dots)
   ====================== */
.panel-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0px;
}

.panel-header-row h3 {
    margin: 0;
}

.panel-menu-container {
    position: relative;
}

.panel-menu-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-menu-btn:hover {
    background: #e0e0e0;
    color: #333;
}

.panel-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 100;
    min-width: 150px;
}

.panel-menu.visible {
    display: block;
}

.panel-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.panel-menu-item:hover {
    background-color: #f0f0f0;
}

.panel-menu-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.panel-menu-item.delete {
    color: #D32F2F;
}

.panel-menu-item.delete svg {
    color: #D32F2F;
}

.panel-menu-separator {
    height: 1px;
    background: #e0e0e0;
    margin: 4px 0;
}

/* ======================
   HELP HINTS
   ====================== */
.help-hint {
    font-size: 12px;
    color: #b0b0b0;
    margin-top: 8px;
    line-height: 1.5;
}

.help-hint-item {
    margin-bottom: 4px;
}

.help-hint-item .key {
    background: #555;
    color: #fff;
    padding: 1px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 11px;
}

/* ======================
   ROUTES LIST
   ====================== */
#routes-list-container {
    flex: 1;
    overflow-y: auto;
    background: #3a3a3a;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

#routes-list-container.hidden {
    display: none;
}

.routes-search {
    padding: 16px;
    border-bottom: 1px solid #555;
    flex-shrink: 0;
}

.routes-search h3 {
    margin-bottom: 12px;
    font-size: 16px;
    color: #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.routes-count {
    font-size: 14px;
    color: #888;
    font-weight: normal;
    margin-left: 2px;
}

.routes-search h3 button {
    margin-left: auto;
    flex-shrink: 0;
}

.btn-icon-only {
    padding: 6px !important;
    min-width: auto !important;
    width: auto !important;
}

.btn-icon-only svg {
    margin: 0 !important;
}

.search-box {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-box input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 14px;
    background: #2d2d2d;
    color: #e0e0e0;
}

.search-box input:focus {
    outline: none;
    border-color: #FF9800;
}

.routes-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.route-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #2d2d2d;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.route-item:hover {
    background: #353535;
    transform: translateX(4px);
}

.route-color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.route-item-text {
    flex: 1;
    min-width: 0;
}

.route-item-name {
    font-size: 14px;
    font-weight: 500;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.route-item-info {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.routes-list-empty {
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

/* ======================
   EDIT PANEL
   ====================== */
.edit-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
}

/* Detail Panel */
.detail-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: #3a3a3a;
}

.detail-panel-header {
    padding: 16px;
    border-bottom: 1px solid #555;
    flex-shrink: 0;
}

.detail-panel-header .panel-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-panel-header .panel-header-row h3 {
    flex: 1;
    margin: 0;
    font-size: 16px;
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.2;
}

.detail-title-name {
    font-size: 16px;
    font-weight: 600;
    color: #e0e0e0;
}

.detail-title-subtitle {
    font-size: 12px;
    color: #9e9e9e;
    font-weight: normal;
}

.detail-panel-header .panel-header-row button.primary {
    flex-shrink: 0;
    width: auto !important;
    min-width: auto;
    margin: 0;
    white-space: nowrap;
}

.btn-back {
    background: transparent;
    border: none;
    color: #9e9e9e;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    flex-shrink: 0;
    width: auto !important;
    min-width: auto;
    margin: 0;
}

.btn-back:hover {
    background: #4a4a4a;
    color: #ffffff;
}

.detail-scrollable-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Detail attributes (read-only display) */
.detail-attributes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-attribute {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-attribute-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-attribute-value {
    font-size: 14px;
    color: #e0e0e0;
}

.detail-attribute-value.empty {
    color: #666;
    font-style: italic;
}

/* Detail segments list (read-only) */
.detail-segments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-segment-item {
    background: #4a4a4a;
    padding: 10px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-segment-number {
    font-weight: 600;
    color: #ffffff;
    min-width: 20px;
}

.detail-segment-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-segment-type {
    font-size: 13px;
    color: #e0e0e0;
}

.detail-segment-wp-count {
    font-size: 11px;
    color: #888;
}

/* Edit Panel */
.edit-panel-header {
    padding: 16px;
    border-bottom: 1px solid #555;
    flex-shrink: 0;
}

.edit-panel-header .panel-header-row {
    margin-bottom: 12px;
}

.edit-panel-header .panel-header-row h3 {
    margin: 0;
    font-size: 16px;
    color: #e0e0e0;
}

.edit-scrollable-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Attributes section */
.attributes-section {
    margin-bottom: 20px;
}

.attributes-section h4 {
    font-size: 14px;
    color: #9e9e9e;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ======================
   SEGMENTS LIST
   ====================== */
.segments-section {
    margin-bottom: 16px;
}

.segments-section > h4 {
    font-size: 14px;
    color: #9e9e9e;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.segments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.segments-header h4 {
    font-size: 14px;
    color: #9e9e9e;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-add-segment {
    background: #FF9800 !important;
    color: white !important;
    padding: 6px 10px !important;
    font-size: 12px !important;
    margin: 0 !important;
    width: auto !important;
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    border-radius: 4px;
}

.btn-add-segment:hover {
    background: #F57C00 !important;
}

.btn-paste-segment {
    background: #2196F3 !important;
    color: white !important;
    padding: 6px 10px !important;
    font-size: 12px !important;
    margin: 0 !important;
    width: auto !important;
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    border-radius: 4px;
}

.btn-paste-segment:hover {
    background: #1976D2 !important;
}

.segments-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.segment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #2d2d2d;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.segment-item:hover {
    background: #353535;
}

.segment-item.active {
    border-color: #FF9800;
    background: #3a3020;
}

.segment-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.segment-number {
    font-weight: 600;
    color: #FF9800;
    font-size: 14px;
    min-width: 24px;
}

.segment-type {
    font-size: 13px;
    color: #e0e0e0;
}

.segment-wp-count {
    font-size: 12px;
    color: #888;
}

.segment-menu-btn {
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    padding: 4px 8px !important;
    border-radius: 4px;
    color: #888;
    font-size: 16px;
    width: auto !important;
    margin: 0 !important;
    line-height: 1;
}

.segment-menu-btn:hover {
    background: #444 !important;
    color: #e0e0e0;
}

/* Segment context menu */
.segment-menu {
    display: none;
    position: absolute;
    right: 10px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 100;
    min-width: 180px;
}

.segment-menu.visible {
    display: block;
}

/* ======================
   CLIPBOARD SECTION
   ====================== */
.clipboard-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #555;
}

.clipboard-segment-item {
    background: #2d2d2d;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.clipboard-segment-item .segment-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.clipboard-segment-item .segment-number {
    font-weight: 600;
    color: #2196F3;
    font-size: 14px;
    min-width: 24px;
}

.clipboard-segment-item .segment-type {
    font-size: 13px;
    color: #e0e0e0;
}

.clipboard-segment-item .segment-wp-count {
    font-size: 12px;
    color: #888;
}

.clipboard-clear-btn {
    background: transparent !important;
    border: none !important;
    color: #888 !important;
    padding: 6px 0 !important;
    font-size: 13px !important;
    text-decoration: underline;
    cursor: pointer;
    width: auto !important;
    margin: 0 !important;
    text-align: left;
}

.clipboard-clear-btn:hover {
    color: #e0e0e0 !important;
}

/* ======================
   RESPONSIVE
   ====================== */
@media (max-width: 768px) {
    #app {
        flex-direction: column;
    }

    #map-container {
        height: 60vh;
    }

    #right-panel {
        width: 100%;
        height: 40vh;
    }
}


