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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.mode-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 3px solid #e2e8f0;
}

.mode-tab {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #718096;
    transition: all 0.2s;
    margin-bottom: -3px;
}

.mode-tab:hover { color: #4a5568; }
.mode-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.mode-content { display: none; }
.mode-content.active { display: block; }

h1 { color: #333; margin-bottom: 10px; font-size: 28px; }
.subtitle { color: #666; margin-bottom: 25px; font-size: 14px; }
.controls { display: flex; gap: 15px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.input-group { display: flex; gap: 10px; align-items: center; }

input[type="text"], input[type="number"] {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

input[type="text"] { width: 300px; }
input[type="number"] { width: 80px; }

button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

button:hover { background: #5568d3; transform: translateY(-2px); }
button:active { transform: translateY(0); }
button.secondary { background: #48bb78; }
button.secondary:hover { background: #38a169; }
button.danger { background: #f56565; }
button.danger:hover { background: #e53e3e; }
input[type="file"] { display: none; }

.marker-type-selector {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.marker-type-btn {
    padding: 12px 20px;
    background: white;
    border: 3px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.marker-type-btn:hover { border-color: #cbd5e0; transform: translateY(-2px); }
.marker-type-btn.active { border-width: 4px; box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2); }

.marker-icon { width: 24px; height: 24px; }
.marker-icon.dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.marker-icon.dot.Waypoint { border-style: dashed; }

.gw2-marker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    margin-bottom: 15px;
}

.gw2-marker-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.gw2-marker-item:hover { border-color: #cbd5e0; transform: translateY(-2px); }
.gw2-marker-item.active { border-color: #667eea; border-width: 3px; box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2); }

.gw2-marker-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gw2-marker-name { font-size: 13px; font-weight: 600; }

.gw2-required-input {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
}

.gw2-required-input label { color: #666; }
.gw2-required-input input { width: 50px; padding: 3px 6px; font-size: 11px; }

.options-panel {
    display: flex;
    gap: 15px;
    padding: 12px 15px;
    background: #faf5ff;
    border-radius: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
    border: 2px solid #d6bcfa;
}

.option-group { display: flex; align-items: center; gap: 8px; }
.option-group label { font-weight: 600; color: #553c9a; font-size: 14px; }
input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }

.endpoint-mode-selector {
    display: flex;
    gap: 10px;
    padding: 12px 15px;
    background: #fff5f5;
    border-radius: 8px;
    margin-bottom: 15px;
    align-items: center;
    border: 2px solid #feb2b2;
}

.endpoint-mode-selector label { font-weight: 600; color: #742a2a; margin-right: 10px; }

.mode-option {
    padding: 8px 16px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    font-size: 13px;
}

.mode-option:hover { border-color: #cbd5e0; }
.mode-option.active { border-color: #f56565; background: #fff5f5; color: #c53030; }
.mode-description { font-size: 12px; color: #744210; margin-left: auto; font-style: italic; }

.main-content { display: grid; grid-template-columns: 1fr 450px; gap: 20px; margin-top: 20px; }
@media (max-width: 1200px) { .main-content { grid-template-columns: 1fr; } }

.canvas-container {
    position: relative;
    border: 3px solid #667eea;
    border-radius: 8px;
    overflow: hidden;
    background: #f7f7f7;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

canvas { display: block; cursor: crosshair; }

.marker {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
    transition: all 0.2s;
    z-index: 10;
}

.marker img { width: 24px; height: 24px; pointer-events: none; }
.marker:hover { transform: translate(-50%, -50%) scale(1.3); box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.marker.start { background: #48bb78; border: 3px solid white; }
.marker.end { background: #f56565; border: 3px solid white; }
.marker.Marker { background: #4299e1; border: 3px solid white; }
.marker.Waypoint { background: #9f7aea; border: 3px dashed white; cursor: ns-resize; }
.marker.gw2 { background: transparent; border: none; box-shadow: none; width: 32px; height: 32px; }

.legend {
    margin-top: 20px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 6px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }

.results-panel { display: none; }
.results-panel.active { display: block; }

.results-header {
    background: #667eea;
    color: white;
    padding: 15px 20px;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.results-header:hover { background: #5568d3; }
.toggle-icon { font-size: 20px; transition: transform 0.3s; }
.toggle-icon.expanded { transform: rotate(180deg); }

.results-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; }
.results-content.expanded { max-height: 2000px; }

.method-result {
    border: 2px solid #e2e8f0;
    border-top: none;
    padding: 15px;
    background: white;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

.method-result:hover {
    background: #ebf8ff;
    border-color: #4299e1;
    transform: translateX(5px);
    box-shadow: -3px 0 0 #4299e1;
}

.method-result:hover::before {
    content: '👁️ Previewing route';
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 11px;
    color: #4299e1;
    font-weight: 600;
}

.method-result:last-child { border-radius: 0 0 8px 8px; }
.method-result.best { background: #f0fff4; border-color: #48bb78; border-width: 3px; }

.method-name {
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.method-name .badge {
    background: #48bb78;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.method-distance { color: #667eea; font-weight: 600; font-size: 18px; margin-bottom: 8px; }
.method-route { color: #4a5568; font-size: 13px; line-height: 1.6; word-break: break-word; }

.placeholder { text-align: center; color: #999; padding: 40px; }
.placeholder-icon { font-size: 64px; margin-bottom: 15px; }
.computing { text-align: center; padding: 30px; color: #667eea; }
.computing-spinner { font-size: 32px; animation: spin 1s linear infinite; }

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.reminder-note {
    background: #fef5e7;
    border-left: 4px solid #f39c12;
    padding: 12px;
    margin-top: 15px;
    border-radius: 4px;
    font-size: 13px;
    color: #7d6608;
}
