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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.container {
    max-width: 100%;
    margin: 0 auto;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

header p {
    opacity: 0.9;
    font-size: 1rem;
}

.header-nav {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.nav-link {
    padding: 0.5rem 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-weight: 600;
    transition: all 0.3s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.nav-link.active {
    background: white;
    color: #667eea;
}

.main-content {
    display: flex;
    height: calc(100vh - 200px);
    gap: 1rem;
    padding: 1rem;
}

.sidebar {
    width: 350px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

.panel {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.panel h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #667eea;
}

.add-contractor-btn {
    width: 100%;
    padding: 0.75rem;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s;
    margin-bottom: 1rem;
}

.add-contractor-btn:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.contractor-form {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 2px solid #667eea;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.contractor-form h3 {
    margin: 0 0 1rem 0;
    color: #667eea;
    font-size: 1rem;
}

.contractor-form input,
.contractor-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    font-family: inherit;
}

.contractor-form input:focus,
.contractor-form textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.contractor-form input[required] {
    border-left: 3px solid #667eea;
}

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

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.contractor-item {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border-left: 4px solid #667eea;
    transition: all 0.2s;
}

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

.contractor-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.5rem;
}

.contractor-name {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
    margin: 0;
}

.contractor-actions {
    display: flex;
    gap: 0.25rem;
}

.contractor-item button {
    padding: 0.4rem 0.6rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-edit {
    background: #ffc107;
    color: #333;
}

.btn-edit:hover {
    background: #ffb300;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}

.contractor-details {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.6;
}

.contractor-details p {
    margin: 0.25rem 0;
}

.contractor-details strong {
    color: #333;
}

.map-container {
    flex: 1;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    gap: 0.5rem;
}

.map-controls button {
    padding: 0.75rem 1rem;
    background: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: background 0.2s;
}

.map-controls button:hover {
    background: #f0f0f0;
}

.map-controls button.active {
    background: #667eea;
    color: white;
}

.map-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#load-osm-btn {
    background: #ff9800;
    color: white;
}

#load-osm-btn:hover:not(:disabled) {
    background: #f57c00;
}

#selected-road-info {
    margin-bottom: 1rem;
}

.road-name-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.road-edit-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.road-edit-controls button {
    padding: 0.75rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.road-edit-controls button:first-child {
    background: #ffc107;
    color: #333;
}

.road-edit-controls button:first-child:hover {
    background: #ffb300;
}

.road-edit-controls button.active {
    background: #28a745;
    color: white;
}

.road-edit-controls button:not(:first-child):not(.active) {
    background: #6c757d;
    color: white;
}

.road-edit-controls button:not(:first-child):not(.active):hover {
    background: #5a6268;
}

.road-edit-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.assign-contractor {
    margin-top: 1rem;
}

.assign-contractor select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.assign-contractor button {
    width: 100%;
    padding: 0.75rem;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
}

.assigned-contractor {
    padding: 0.5rem;
    background: #e7f3ff;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.assigned-contractor span {
    font-size: 0.9rem;
}

.assigned-contractor button {
    padding: 0.25rem 0.5rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
}

.road-segments-panel {
    background: white;
    padding: 1.5rem;
    margin: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
}

.road-segments-panel h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #667eea;
}

.road-segment-item {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    border-left: 4px solid #667eea;
}

.road-segment-item h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.road-segment-item .contractors {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.5rem;
}

.road-segment-item .contractors strong {
    color: #333;
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        height: auto;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .map-container {
        height: 400px;
    }
}

